2010 Nov 06 2:19 AM
Hi,
I wrote a function module abc. I used the pattern button to call it from a class method. It dumps because of some issue with message ID. When I debugged my function module it returned an exception FILE_ERROR with rc 2. In my calling class method it dumps because some issue with message ID. How can I handle this situation.Why is the SY-MSGID giving problem.
IF SY-SUBRC <> 0.
Dumps -
> MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Edited by: Vighneswaran CE on Nov 6, 2010 4:42 AM
2010 Nov 06 8:44 AM
Hi
The pattern places that code after the call of function module by default, but it often needs to change it by himself or not to delete the asterisks.
The problem is the standard function module (but also custom one) rarely set a message as soon as an excption is raised, so the system variable SY-MSGTY, SY-MSGID.......are empty and a dump can occur.
You need to make sure the called function sets a message for the exception and you can do it by seeing how the excption is raised, i.e. you have to check the abap code of that function module.
If a message is set, you should see an abap code like this:
MESSAGE ID <class message> TYPE <type message> NUMBER <nr message>..... RAISING EXCPTION <EXCPETION>.
In this situation can use :
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.But if the exceptions are simply raised: RAISE <EXCEPTION>, than any message will be set, and you can't use the code above, but you need to mananage the SY-SUBRC by yourself.
It's usually used a WHEN statament in order to trigger a certain message for every value returned in SY-SUBRC:
CASE SY-SUBRC.
WHEN 0. "It's Ok -> do nothing
WHEN 1. MESSAGE EXXX(YY) WITH .....................
.................
ENDCASE.Max
Hi,
I wrote a function module abc. I used the pattern button to call it from a class method. It dumps because of some issue with message ID. When I debugged my function module it returned an exception FILE_ERROR with rc 2. In my calling class method it dumps because some issue with message ID. How can I handle this situation.Why is the SY-MSGID giving problem.
IF SY-SUBRC <> 0.
Dumps -
> MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Edited by: Vighneswaran CE on Nov 6, 2010 4:42 AM
2010 Nov 06 5:47 AM
Comment the Exception part, that may be due to u haven't specify message id at the begining of the program.
example.
call function 'ABC'.
Export
p1 =
Import
p2 =
if sy-subrc = 0.
message ........
*
endif.
2010 Nov 06 8:44 AM
Hi
The pattern places that code after the call of function module by default, but it often needs to change it by himself or not to delete the asterisks.
The problem is the standard function module (but also custom one) rarely set a message as soon as an excption is raised, so the system variable SY-MSGTY, SY-MSGID.......are empty and a dump can occur.
You need to make sure the called function sets a message for the exception and you can do it by seeing how the excption is raised, i.e. you have to check the abap code of that function module.
If a message is set, you should see an abap code like this:
MESSAGE ID <class message> TYPE <type message> NUMBER <nr message>..... RAISING EXCPTION <EXCPETION>.
In this situation can use :
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.But if the exceptions are simply raised: RAISE <EXCEPTION>, than any message will be set, and you can't use the code above, but you need to mananage the SY-SUBRC by yourself.
It's usually used a WHEN statament in order to trigger a certain message for every value returned in SY-SUBRC:
CASE SY-SUBRC.
WHEN 0. "It's Ok -> do nothing
WHEN 1. MESSAGE EXXX(YY) WITH .....................
.................
ENDCASE.Max