ā2012 Aug 02 6:32 AM
Hello ,
I have standard class, in this class there is a bapi used . In this bapi a error messaged is raised.
How can i capture this error message in my z FM.
Please note that there is no expection in the standard class and error message is raised by the bapi.
ZFM ---> standard class ----> Bapi.
ā2012 Aug 02 2:51 PM
Please call the ZFM within TRY...CATCH..ENDTRY block.
In CATCH, you can catch exception into a reference variable (for example CX_ROOT) and get the message from GET_TEXT method.
ā2012 Aug 02 8:24 PM
According to OP, standard class does not raise any exception, so TRY...CATCH... has nothing to catch.
ā2012 Aug 09 3:16 PM
Don't catch CX_ROOT. You should only catch exceptions you're expecting to have raised, and react to those accordingly. If you get an unexpected error and use CX_ROOT, it can be a pain to find the cause of the error - as those who use BW will know...
ā2012 Aug 02 8:24 PM
If the standard class doesn't expose the error to you, there's nothing you can do about it. Check to see if the class has any error parameters, or sets any attributes, with the error data. That's the point of classes, give the calling program (in your case, ZFM) access to what it needs, and hide from it everything else.
If you post which class you are using, and how you're calling it, someone with experience with that class may be able to be helpful
ā2012 Aug 03 8:56 PM
Hello Alex,
thanks for ur help.
FM : /SAPRCX/SHPPLC
Class :
CALL METHOD g_shp_appl->place_railcar.
I am calling the above fm in another z fm.
thanks
amit
ā2012 Aug 05 7:33 AM
Dear Amit,
please give class name which u r using and how u r using it.
or
if you want to capture error message which is raised in bapi then create z class and modify it.