2007 Oct 03 3:09 PM
Hello,
I am an experienced abaper, and I'd like to know if there's a way to retrieve the exception name from a failed CALL FUNCTION without having to enter all the exception names (because I don't even understand what all of them are about, so I'd just like to forward the exception name):
For example, assume there is a function:
FUNCTION zzz.
IF x = 0. RAISE name1. ELSE. RAISE name2. ENDIF.
ENDFUNCTION.
I would want to do something like that
DATA excep_name(30) TYPE c.
CALL FUNCTION 'ZZZ' EXCEPTIONS OTHERS = 1.
IF sy-subrc NE 0.
excep_name = get exception name???
WRITE : / excep_name.
ENDIF.
That would print "name1" or "name2"
thx a lot
PS: I don't want to do (I am too lazy!):
CALL FUNCTION 'ZZZ' EXCEPTIONS NAME1 = 1 NAME2 = 2 OTHERS = 3.
IF SY-SUBRC = 1. WRITE : / 'name1'. ELSEIF SY-SUBRC = 2. Etc.
2007 Oct 03 3:27 PM
Hello,
I am an experienced abaper, and I'd like to know if there's a way to retrieve the exception name from a failed CALL FUNCTION without having to enter all the exception names (because I don't even understand what all of them are about, so I'd just like to forward the exception name):
For example, assume there is a function:
FUNCTION zzz.
IF x = 0. RAISE name1. ELSE. RAISE name2. ENDIF.
ENDFUNCTION.
I would want to do something like that
DATA excep_name(30) TYPE c.
CALL FUNCTION 'ZZZ' EXCEPTIONS OTHERS = 1.
IF sy-subrc NE 0.
excep_name = get exception name???
WRITE : / excep_name.
ENDIF.
That would print "name1" or "name2"
thx a lot
PS: I don't want to do (I am too lazy!):
CALL FUNCTION 'ZZZ' EXCEPTIONS NAME1 = 1 NAME2 = 2 OTHERS = 3.
IF SY-SUBRC = 1. WRITE : / 'name1'. ELSEIF SY-SUBRC = 2. Etc.
2007 Oct 03 3:18 PM
HI,
Look at this , may be useful
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/dbaa0635c111d1829f0000e829fbfe/content.htm
Regards
Sudheer
2007 Oct 03 5:56 PM
error_message general exception can only be used for controlling MESSAGE e001(00) or MESSAGE a001(00) sent by the function or above. It can't control RAISE or MESSAGE ... RAISING.
2007 Oct 03 3:27 PM
2007 Oct 03 5:56 PM