2008 Apr 25 2:41 PM
I am using a standard SAP function module to create a transfer Order for a storage unit. The function module is "L_TO_CREATE_MOVE_SU". The issue with this function module is that, if the user enters the wrong Storage bin for a fixed storage type, the function module raises an exception and exits out of the function module. The message displayed is "Storage bin XXXX is not a fixed bin for material XXXXXX." I would like to capture this error before calling the function module, so that it does not dump like that. Can anyone suggest why this error comes and how I can capture it?
I am using a standard SAP function module to create a transfer Order for a storage unit. The function module is "L_TO_CREATE_MOVE_SU". The issue with this function module is that, if the user enters the wrong Storage bin for a fixed storage type, the function module raises an exception and exits out of the function module. The message displayed is "Storage bin XXXX is not a fixed bin for material XXXXXX." I would like to capture this error before calling the function module, so that it does not dump like that. Can anyone suggest why this error comes and how I can capture it?
2008 Apr 25 2:51 PM
Hi Kaustub,
If u are getting the MESSAGE type as error after calling the FM then the ur program execution will stop at that point. So Comment the messages provided by the FM(Comes when u call the FM from Pattern) and handle the exceptions by checking the sy-subrc. Probably After calling the FM check the sy-subrc value. If it is Not 0 then pass that data to one internal table and display all those records as error log.
eg: CALL FUNCTION 'xxxxx'.
*IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
Comment the above message and do like below.
IF NOT sy-subrc IS INITIAL.
wa_errors-doc = ur doc number or what ever data u have.
APPEND wa_errors to i_errors.
ENDIF.
After processing all the records.
LOOP AT i_errors INTO wa_errors.
WRITE wa_errors-doc.
ENDLOOP.
Thanks,
Vinod.
2008 Apr 25 3:01 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |