03-31-2008 12:54 PM
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.
03-31-2008 1:11 PM
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
03-31-2008 1:01 PM
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
03-31-2008 1:11 PM
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
03-31-2008 1:22 PM
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.