Gyan Factory

Gyan Factory
SAP Technical Project Support

Friday, January 8, 2016

Handling Exceptions in Function modules [without message class]

Step1. Let's have a FM with the below importing parameters.




Step2. Export parameters.





Step3. Here define the exceptions to be raised in the FM source code under the Exceptions tab.



Step4. raise those defined exceptions in the source code depending on some checks. 





Step5. Here we have the program that calls the FM with specific set of parameters. When you call this FM automatically the system assigns a integer value to each of the exception. When in the FM source code a particular exception is raised then the sy-subrc value is the value assigned to the exception.




Step6. Here exception MISSING_PARAMETER raised and observe the value of  sy-subrc.





Step7. So here we have the O/P.















Step8. Again change some value of the FM exporting parameter so that it would generate a different exception. Execute the program.





Step9. Observe the sy-subrc value.




Step10. So here we have the O/P.


--------------------------------------------------------------------------------------

No comments:

Post a Comment