Simplify SAP R/3 development with Excel VBA/VB RFC  
Home> UserExit>MWMIDI05



User Exits for IDOC Setup in WM
The processing of the IDOCs of message type WMTREQ sent to the SAP System from external systems via the MM-MOB or WM-LSR interfaces can be influenced by this user exit (Create/Cancel transfer requirement). A customer-specific processing can also be accessed in this case.

General information on IDOC processing during receipt

The IDOCS set up in the external system are passed on to the SAP application. The ALE interface is responsible for receiving this data and for saving it in the SAP System. Using the Customizing tables, you determine how the incoming IDOCs are to be processed. In the case of the MM-MOB and WM-LSR interfaces, the IDOCs are processed immediately by the application as soon as they are received. The IDOCS are processed in a function module that is determined and controlled by ALE via the message type. The processing results are returned to ALE by the application so that the IDOCS can be marked accordingly and error processing can be activated, if required.

Call location and important marginal conditions

The user exit is programmed in the function module which processes the IDOCs of message type WMTREQ and occurs after the IDOC has been taken and checked, but before the direct processing in the application is. This means that the data for transfer requirement processing has already been determined and edited, but that the function module for creating or cancelling has not yet been accessed. The standard function module for processing message type WMTREQ is called L_IDOC_INPUT_WMTREQ. The IDOC is processed online, which means that the source code is also run online.

If an error occurs, messages must not be issued because the processing runs in the background and the result of the processing must always be returned to the ALE interface. For this reason, key words such as MESSAGE, COMMIT WORK, LEAVE and so on, must not be used. If errors do occur in the user exit and these should be passed on to the ALE interface or influence the result of the processing, then you must also use user exit MWMIDI01 (EXIT_SAPLLIDI_001) because this is the only exit in which separate errors can be taken into account (see the documentation for the user exit).

Parameters and options

The user exit in the program is function module EXIT_SAPLLIDI_005 . To be able to use it, you need to create Include ZXLIDU13 and activate the enhancement with transaction CMOD. You can access the following data as parameters:

  • Transfer requirement data for creation or cancellation already determined from the received IDOC
    • Indicator as to whether transfer requirements are to be created or canceled (import parameter I_FLG_TR_CANCEL )
    • Transfer requirement data with I_FLG_TR_CANCEL = ' ' that is, to be created (table parameter T_LTBA )
    • Transfer requirement data with I_FLG_TR_CANCEL = 'X' that is, to be canceled (table parameter T_LTBC )
  • Data from the IDOC received:
    • Control record of the IDOC (import parameter I_IDOC_CONTROL)
    • Data records of the IDOC (table parameter T_IDOC_DATA)

This user exit can be used to:

  • influence the data determined for the creation or the cancellation of a transfer requirement.
  • valuate and process data that is transferred via customer-specific segments.
  • Additional activities.


In the documentation of the user exit MWMIDI02, you will find several examples of how a user exit is to be programmed upon receipt of an IDOC that is sent to SAP from external systems via MM-MOB or WM-LSR interfaces. You can also use the individual examples themselves as the basis for this exit.

  • EXIT_SAPLLIDI_005: Customer Exit for IDOC WMTRID01 (Create/Cancel TR) on Receipt