Sapass

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



Index

MWMIDI01

User Exits for IDOC Setup in WM
With this user 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:

  • WMTOCO - Confirm transfer order
  • WMCATO - Reverse transfer order
  • WMTREQ - Create/reverse transfer requirement
  • WMBBIN - Block storage bins
  • WMSUMO - Move storage unit

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 user exit is performed in function modules that process the IDOCs of the above-mentioned message types:

    • L_IDOC_INPUT_WMTOCO
    • L_IDOC_INPUT_WMCATO
    • L_IDOC_INPUT_WMTREQ
    • L_IDOC_INPUT_WMBBIN
    • L_IDOC_INPUT_WMSUMO

    The IDOC processing is performed online.

    Parameters and options

    The user exit in the program is the function module EXIT_SAPLLIDI_001. In order to be able to use the user exit, you must create Include ZXLIDU04 and activate the enhancement with transaction CMOD. As parameters, you can use the IDOC data and the data for 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 workflow processing in the ALE interface (import parameter X_CATEGORIE).
    • Return code as processing result for the ALE interface (import parameter X_RESULT).

    The user 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 was processed successfully
    • '9999' - The IDOC was not processed because of an error

    Examples

    Below, you will find some conceivable changes including the necessary source code.

    • When you create a transfer requirement from message type WMTREQ, the processing is to be marked as being incorrect for a certain message number and a separate error message is to be stored in the created work item.
       
      *--------------------------------------------------------------------*
      *   INCLUDE ZXLIDU04                                                 *
      *--------------------------------------------------------------------*
       
        case i_mestyp.
          when 'WMTREQ'.
            if x_returncode ne 0.
              if x_lmess-msgno eq '442'.
                move 1 to x_returncode.
                move 'Error_IDOCs' to x_categorie.
                move '9999' to x_result.
                move 'LK' to x_lmess-msgid.
                move '901' to x_lmess-msgno.
                move i_docnum to x_lmess-msgv2.
              endif.
            endif.
        endcase.
       
    • When blocking the storage bins via message type WMBBIN, a work item is always to be created to inform certain users that some storage bins were blocked by the external system.
       
      *--------------------------------------------------------------------*
      *   INCLUDE ZXLIDU04                                                 *
      *--------------------------------------------------------------------*
       
        case i_mestyp.
         when 'WMBBIN'.
            if x_returncode eq 0.
              move 1 to x_returncode.
              move 'Continue_IDOCs' to x_categorie.
              move '9999' to x_result.
              move 'LK' to x_lmess-msgid.
              move '902' to x_lmess-msgno.
            endif.
        endcase.
       
       
    • You can also use the user exit together with other user exits of the MM-MOB and WM-LSR interfaces. In the user exit EXIT_SAPLLIDI_002 where the transfer order confirmation is received, you can, for example, determine whether the external system reported a difference. A flag is set for differences that was defined as global variable in module pool SAPLXLID. In the user exit for the error handling, work items are created if the flag is set to inform certain users.

    1. EXIT_SAPLLIDI_002 to confirm transfer orders

     
    *--------------------------------------------------------------------*
    *   INCLUDE ZXLIDU05                                                 *
    *--------------------------------------------------------------------*
     
      clear flg_differenz.
      loop at t_ltap_conf.
        if not t_ltap_conf-ndifa is initial.
          move 'X' to flg_differenz.
          modify t_ltap_conf.
        endif.
      endloop.
     

    2. EXIT_SAPLLIDI_002 for error handling

     
      case i_mestyp.
        when 'WMTOCO'.
          if not flg_differenz is initial.
            move 1 to x_returncode.
            move 'Continue_IDOCs' to x_categorie.
            move '8888' to x_result.
            move 'LK' to x_lmess-msgid.
            move '903' to x_lmess-msgno.
          endif.
      endcase.
     

    • When you confirm a transfer order, the standard system always creats a work item in form of a note, if the transfer order to be confirmed or the transfer order item has already been confirmed. If no work item is to be created in this case, you have to adjust the error category.
       
      *--------------------------------------------------------------------*
      *   INCLUDE ZXLIDU04                                                 *
      *--------------------------------------------------------------------*
       
        case i_mestyp.
          when 'WMTOCO'.
            if x_lmess-msgid eq 'LK'  and
               x_lmess-msgno eq '043' and
               x_categorie   eq 'Continue_IDOCs'.
              clear x_lmess.
              move 0 to x_returncode.
              move '0000' to x_result.
              move 'Processed_IDOCs' to x_categorie.
            endif.
            if i_subrc       eq 01 and
               x_categorie   eq 'Continue_IDOCs'.
              clear x_lmess.
              move 0 to x_returncode.
              move '0000' to x_result.
              move 'Processed_IDOCs' to x_categorie.

      Function/Program:
      • EXIT_SAPLLIDI_001: Customer Exit for Error Handling of Inbound IDOCs on Receipt

    02-Oct-2005