×

[PR]この広告は3ヶ月以上更新がないため表示されています。
ホームページを更新後24時間以内に表示されなくなります。




Sapass

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



Index

MWMIDI02

User Exits for IDOC Setup in WM
With this user exit you can influence the IDOC processing of message type WMTOCO (Confirm Transfer Order) that is sent to SAP from external systems via MM-MOB or WM-LSR interfaces. Customer-specific processing can also be used 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 transaction and other important requirements

The user exit is performed in the function module that processes the IDOC of message type WMTOCO directly after the IDOC has been taken and checked, but processing in the application was not yet initiated. This means that the data for the transfer order confirmation has already been determined and edited, but the function module for the confirmation was not yet executed an access. The standard function module for processing message type WMTOCO is called L_IDOC_INPUT_WMTOCO. The IDOC is processed online, which means that the source code is also executed online.

If an error occurs, no messages may be issued because processing is executed in the background and the processing result must always be returned to the ALE interface. Therefore no key words such as MESSAGE, COMMIT WORK, LEAVE, and so on may be used. If errors are found in the user exit that should be passed on to the ALE interface or that influence the processing result, you must use user exit MWMIDI01 (EXIT_SAPLLIDI_001) because errors can only be considered by means of this user exit (see the documentation on the user exit).

Parameters and options

The user exit in the program is the function module EXIT_SAPLLIDI_002 . In order to be able to use the user exit, you must create Include ZXLIDU05 and activate the enhancement with transaction CMOD. As parameters, you can access the following data:

  • Transfer order data for the confirmation that has already been determined from the received IDOC:
    • Indicator whether the confirmation is made via the transport order number or the storage unit number (import parameter I_FLG_CONF_SU)
    • Warehouse number (import parameter I_LGNUM)
    • Transfer order number for I_FLG_CONF_SU = ' ' (import parameterI_TANUM)
    • Storage unit number for I_FLG_CONF_SU = 'X' (import parameter I_LENUM)
    • User ID for the confirmation (import parameter X_CUSER)
    • Table of the items to be confirmed (table parameter T_LTAP_CONF)
  • Data of the received IDOC:
    • Control record of the IDOC (import parameter I_IDOC_CONTROL)
    • Data records of the IDOC (table parameter T_IDOC_DATA)

This user exit can basically be used to:

  • Influence the determined data for the transfer order confirmation. The following data can be changed in this case:
    • User ID for the confirmation (export parameter X_CUSER)
    • The item data of the transfer order (table parameter T_LTAP_CONF)
  • In addition, performance data can be verified to the transfer order using the confirmation IDoc (as of Release 4.0A). This data can then be changed in the user exit.
    • X_SOLEX : Planned processing time determined externally
    • X_PERNR : Personnel number of the person executing the TO
    • X_STDAT : Start date of TO processing
    • X_ENDAT : End time of TO processing
    • X_STUZT : Start time of TO processing
    • X_ENUZT : End time of TO processing
    • X_ISTWM : Act. time = Duration of TO processing, alternatively to start and end time specifications
  • Evaluate and process data that is transferred via customer-specific segments
  • Access additional activities.

Examples

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

  • The confirmation data of the individual items is influenced.

If differences are reported for the transfer order items to be confirmed, they should be posted to a separate difference interface because all reported differences to the external system must be displayed separately.

To do this, a new difference indicator is set for the relevant items that also must be defined accordingly in WM Customizing.

 
*---------------------------------------------------------------------*
*   INCLUDE ZXLIDU05                                                  *
*---------------------------------------------------------------------*
 
  loop at t_ltap_conf.
    check not t_ltap_conf-ndifa is initial or
          not t_ltap_conf-rdifa is initial.
    if t_ltap_conf-kzdif is initial.
      move 'Z' to t_ltap_conf-kzdif.
      modify t_ltap_conf.
    endif.
  endloop.
 

  • During the confirmation of a transfer order, a certain activity should be called up additionally.

It this a stock removal transfer order for a transfer requirement and if differences were reported during the confirmation, a new transfer order is to be created for the missing quantity. The entire transfer order is confirmed (for a piece by piece confirmation, the source code would require some slight changes).

If differences are found, function module L_COMMUNICATION_TO_CREATE is accessed to create a new transfer order for the missing quantity. In this case, a mail indicator Z1 is explicitly transferred to the function module which must be defined in WM Customizing for the "automatic TO creation".

 
*---------------------------------------------------------------------*
*   INCLUDE ZXLIDU05                                                  *
*---------------------------------------------------------------------*
 
 
tables: ltak.
data: begin of xltbub occurs 10.
        include structure ltbub.
data: end of xltbub.
 
data: h_mblnr like mseg-mblnr,
      h_mjahr like mseg-mjahr,
      h_mailk like t333m-mailk.
 
*........Pr・en, ob Vorgang relevant und Differenzen vorhanden..........
 
  check i_flg_conf_su is initial.
 
  select single * from ltak
    where lgnum eq i_lgnum
      and tanum eq i_tanum.
  check sy-subrc eq 0.
 
  check not ltak-tbnum is initial.
  check ltak-trart eq 'A'.
 
  loop at t_ltap_conf.
    if not t_ltap_conf-ndifa is initial.
      exit.
    endif.
  endloop.
  check not t_ltap_conf-ndifa is initial.
 
*........Die relevanten Daten vorbereiten.........................
 
  refresh xltbub.
  clear   xltbub.
  move:
        i_lgnum    to xltbub-lgnum,
        ltak-tbnum to xltbub-tbnum.
  append xltbub.
 
  clear h_mblnr.
  clear h_mjahr.
  move 'Z1' to h_mailk.


 
*........Transportauftrag zum Transporbedarf veranlassen...............
 
  call function 'L_COMMUNICATION_TO_CREATE' in background task
       exporting
            mbeleg  = h_mblnr
            mjahr   = h_mjahr
            mailk   = h_mailk
            buser   = space
            express = 'X'
            lvsdz   = space
       tables
            t_ltbub = xltbub.
 

  • Together with user exit MWMIDI01 (EXIT_SAPLLIDI_001) the user
    Function/Program:
    • EXIT_SAPLLIDI_002: Customer Exit for Inbound IDOC WMTID01 (Confirm TO) on Receipt

02-Oct-2005