‎2006 Sep 21 6:32 PM
If I call an SAP function and it calls subsequent SAP function modules. A few levels into the calls, one of the SAP function modules issues an 'E' level message which dumps back to my main screen with the message at the bottom. This all startes inside a custom handler method for an SAP custom container with a tree control in it. When the user clicks anywhere on the screen the program exits back to the main menu. Is there any way I can catch the type "E" message that is explicitly issued inside the SAP function module?
Thanks,
Tom
‎2006 Sep 21 6:43 PM
Hi
Try to use <b>ERROR_MESSAGE</b>, from SAP help:
This exception instructs the system to ignore S messages, I messages and W messages until return from the function module (although they still appear in the log during background processing). When an E message or an A message occurs, the called function module terminates, as if the exception ERROR_MESSAGE has been triggered.
So you should call your fm in this way:
CALL FUNCTION <FUNCTION>
.................
EXCEPTIONS
..............
ERROR_MESSAGE = ....
Max
‎2006 Sep 21 6:43 PM
Hi
Try to use <b>ERROR_MESSAGE</b>, from SAP help:
This exception instructs the system to ignore S messages, I messages and W messages until return from the function module (although they still appear in the log during background processing). When an E message or an A message occurs, the called function module terminates, as if the exception ERROR_MESSAGE has been triggered.
So you should call your fm in this way:
CALL FUNCTION <FUNCTION>
.................
EXCEPTIONS
..............
ERROR_MESSAGE = ....
Max
‎2006 Sep 21 6:49 PM
That is how I am calling it, sorry I did not post the code earlier(see below). I think the problem is that the L_TO_PASS_DN is being run as a separate unit
CALL FUNCTION 'L_TO_CANCEL'
EXPORTING
I_LGNUM = I_LGNUM
I_TANUM = I_TANUM
I_SOLEX = I_solex
I_CANCL = i_cancl
I_SUBST = I_SUBST
I_QNAME = SY-UNAME
I_UPDATE_TASK = I_UPDATE_TASK
I_COMMIT_WORK = I_COMMIT_WORK
TABLES
T_LTAP_CANCL = T_LTAP_CANCL
EXCEPTIONS
TO_CONFIRMED = 1
TO_DOESNT_EXIST = 2
ITEM_CONFIRMED = 3
ITEM_DOESNT_EXIST = 4
FOREIGN_LOCK = 5
DOUBLE_LINES = 6
NOTHING_TO_DO = 7
XFELD_WRONG = 8
SU_MOVEMENT_PARTLY_CONFIRMED = 9
UPDATE_WITHOUT_COMMIT = 10
NO_AUTHORITY = 11
ERROR_MESSAGE = 98
OTHERS = 12.
Being called as qRFC
CALL FUNCTION 'L_TO_PASS_DN' IN BACKGROUND TASK
AS SEPARATE UNIT
‎2006 Sep 21 6:48 PM
Hi Tom,
it depends.
But not really. You can enter debug mode and set a break at command message - this will probably stop a couple of times at messages you are not interested in.
More efficient is to identify the message, go to the message class and message and do a where-used-list. Usually you can identify the program. Set soft breaks at the suspicious code and provole the error.
Hope it helpd,
Clemens