Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error in L_TO_CREATE_MOVE_SU

Former Member
0 Likes
2,924

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?

2 REPLIES 2
Read only

vinod_vemuru2
Active Contributor
0 Likes
1,743

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.

Read only

Former Member
0 Likes
1,743

Hi,

Check in LEIN table if the combination exists