Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

number of exceptions -does this mean we need to code that many SY-SUBRC

Former Member
0 Kudos

Q]In a program relating to a FUNCTION MODULE if there are say “n” number of exceptions -


does this mean we need to code that many values for SY-SUBRC in F,M.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

You can define your own message class (trx: se91) by giving your error messages. The use this exception class to handle the errors in your FM.

Refer:

http://help.sap.com/saphelp_nw70/helpdata/EN/d1/801b3e454211d189710000e8322d00/frameset.htm

3 REPLIES 3

Former Member
0 Kudos

Hi,

u need not use that many SY-SUBRC checks as many as exceptions that u get.

Every exception is defined with a number, so when an exception is raised a number is thrown. So the FM returns a number which signifies the type of exception raised. SY-SUBRC would hold that number immediately after the Function call.

So though there are plenty of exceptions raised by the FM, once SY-SUBRC check would do. but if you require to do different actions for different SY-SUBRC values, they go ahead using a case statement.

Reward points if this helps,

Kiran

Former Member
0 Kudos

You can define your own message class (trx: se91) by giving your error messages. The use this exception class to handle the errors in your FM.

Refer:

http://help.sap.com/saphelp_nw70/helpdata/EN/d1/801b3e454211d189710000e8322d00/frameset.htm

Former Member
0 Kudos

Hi,

It is not necessary to do as many SY-SUBRC checks as there are exceptions.

Normally SY-SUBRC is checked for ZERO.

But if your requirement is such that you have to check for a particular exception value or values then you can use as many SY-SUBRC checks as there are exceptions or for a particular exception.

Reward if it helps.

Regards.

Abhisek.