Skip to Content

When developing Dialogue transactions using ABAP, or while doing updates in standard SAP Enhancements, I have often come across scenario where my program calls a standard Function Module which however does not handle a particular condition and throws Error Messages Internally. This, results in Program behaving indifferently. A typical scenario where you would like to avoid Error Messages would be while developing RF Programs. In this blog I would like to share with you a small option that helped me a lot in my ABAP developments.

Case where the function module throws error internally and the main program cannot handle it.

I am creating a function module Y_THROW_MESSAGE which has a Message Statement as shown below:

image 

 

I create a program,Y_HANDLE_MSG which calls this function module. You may note that the function module does not throw any exception.

 image

On Execution the program is unable to proceed since the function module throws an Error Message.

However, now we will handle this message like handling any other exception normally thrown by a function moudle.

 image

Now, we have handled the internal message by setting the sy-subrc value through ERROR_MESSAGE option. Thus we can check the sy-surbc and decide the program flow.

 image

I have found this option to be useful when calling standard function modules in custom reports or transactions or inside sap enhancements. You now have control over your transaction. This is extremely useful if you are developing RF Programs in ABAP. So, now if your delivery updates BAPI or a Print Function throws Error internally in the function module you could handle it as an exception and customize the Message in your RF Program.

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply