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



User Exits for IDOC Setup in WM
With this customer exit, the error handling can be influenced customer-specifically when processing IDOCs that were sent from external systems to SAP via the MM-MOB and WM-LSR interfaces.

This exit can be used for the following message types:

  • WMMBXY - Goods movements
  • WMTORD - Create transfer order
  • WMINVE - Counting data entry

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.

General information on the error handling in the inbox

If an error occurs during the IDOC processing in the application, the ALE layer creates a work item for each incorrect IDOC. The work item is sent to the inbox of all users of a certain department that was defined in the partner profile for handling errors of a certain message type. The work item refers to the error including the corresponding error text and allows you to repost the incorrect IDOC.

In the MM-MOB and WM-LSR interface, the work item is not only used for incorrect IDOCs. The work item is also used to pass on important notes to certain users to inform them, fro example, about conflict. These work items are also placed into the inbox of the responsible users; however, they do not need to be processed as the errors, but must be completed.

Exchange of Information Between Application and ALE Interface

The ALE interface transmits a set of IDOCs to the application function module defined for a message type. These IDOCs were transmitted from the external system and must be processed by the application. The application also communicates the processing results to the ALE interface. The following data is transmitted to ALE by the application:

  • Results of the method for Workflow (Return code).

Via a return code, the ALE interface is informed whether an error occurred while the IDOCs were being processed. The following return codes are used in the MM-MOB and WM-LSR interfaces:

  • "0000" - all IDOCs were processed successfully
  • "9999" - at least one IDOC was not processed because of an error, or a work item is to be created for transmission of a message.
  • Table of IDOCs with the processing status of the individual IDOCs.
  • This table is the basis for ALE in order to update the IDOCs with the current status. The following statuses are used in the MM-MOB and WM-LSR interfaces:

    • "53" - IDOC was processed
    • "52" - IDOC was not processed fully
    • "51" - IDOC was not processed
  • Table of results variables with values for workflow.
  • With the help of this table, all the required data is transmitted from the application to ALE. The following data is transmitted to the MM-MOB and WM-LSR interfaces:

    • For each IDOC, a parameter is set for workflow processing. This parameter decides whether a workflow is to be created for the respective IDOC. The following parameters are used for this purpose:

    "Processed_IDOCs" - the IDOC was processed; no work item is created.

    "Error_IDOCs" - the IDOC was not processed because of an error; a work item is created in order to repost the incorrect IDOCs.

    "Continue_IDOCs" - the IDOC was processed; however, a work item is creatd so that important messages can be transmitted.

    "Retry_IDOCs" - the IDOC cannot be processed because, for example, an application object is currently being processed. Re-processing this IDOC at a later point could solve the problem automatically. For this purpose, a work item is created, as in the case of an error.

    • If a document, such as a transfer order or an IM document, is created from an IDOC, the numbers of these documents are noted for each IDOC under the parameter "Appl_Objects".

    Call transaction and other important requirements

    The customer exit is performed in function modules that process the IDOCs of the above-mentioned message types:


    The IDOC processing is performed online.

    Parameters and options

    The customer exit in the program is function module EXIT_SAPLLMDE_001. In order to be able to use the customer exit, you must create Include ZXLIDU09 and activate the enhancement with transaction CMOD. As parameters, you can use the IDOC data and the data for the error handling that were determined in the function modules when processing the individual IDOCs:

    • Message type (import parameter I_MESTYP).
    • IDOC number (import parameter I_DOCNUM).
    • Return code from the function module that performs the functions such as 'Create Transfer Order' or 'Block storage Bins' (import parameter I_SUBRC).
    • Indicator: The error causes a ROLLBACK (import parameter I_FLG_ERROR_ROLLBACK).
    • Identification of the error message (import parameter X_LMESS).
    • Determined return code for further IDOC processing (import parameter X_RETURNCODE).
    • Determined error category for the workflow processing in the ALE interface (import parameter X_CATEGORIE).
    • Return code as processing result for the ALE interface (import parameter X_RESULT).

    The customer exit transfers the modified data of the error handling that control the further processing process and that are returned to the ALE interface:

    • Identification of the error message (export parameter X_LMESS)
    • Determined return code for further IDOC processing. (export parameter X_RETURNCODE)
    • Determined error category for the workflow processing in the ALE interface (export parameter X_CATEGORIE).
    • Return code as processing result for the ALE interface (export parameter X_RESULT).

    If an error causes a rollback (import parameter I_FLG_ERROR_ROLLBACK is set), the determined error data cannot be influenced.

    If the parameter X_RETURNCODE is returned to the calling program unequal to 0, the IDOC is regarded as being incorrect and the IDOC is marked with status '51'.

    You can use the following values for parameter X_CATEGORIE:

    • 'Processed_IDOCs'
    • 'Error_IDOCs'
    • 'Continue_IDOCs'
    • 'Retry_IDOCs'

    The following characteristics are currently used for parameter X_RESULT:

    • '0000' - The IDOC were processed successfully
    • '9999' - The IDOC was not processed because of an error


    In the documentation of customer exit 'MWMIDI01', you will find several examples how to use an user exit during the error handling of the IDOC processing. You can also use the individual examples as the basis for this exit.

    • EXIT_SAPLLMDE_001: User Exit for Error Handling IDOC Receipt (MDE)