Mapping columns on distributing into EWM

Firmenzentrale SAP

During distribuiton a delivery from ERP to EWM we can add some ERP-related data into EWM delivery tables:

/SCWM/IF_EX_MAPIN_OD_SAVEREPL~MAPIN
 
METHOD /scwm/if_ex_mapin_od_saverepl~mapin.
 
  DATA: lv_break TYPE char1,
        lt_vbeln TYPE TABLE OF zerp_get_pkkey_vbeln,
        lv_dest         TYPE char10.
 
  FIELD-SYMBOLS: <ls_item_data> LIKE LINE OF it_bapi_item_data,
                 <ls_vbeln> LIKE LINE OF lt_vbeln,
                 <ls_dlv_request> LIKE LINE OF ct_dlv_request,
                 <ls_keymap> TYPE /scdl/dl_keymap_item_str,
                 <ls_item> TYPE /scdl/af_dr_item_str.
 
  IF is_bapi_header_data-dlv_type = 'ZKBN'.
 
    LOOP AT it_bapi_item_data ASSIGNING <ls_item_data>.
      APPEND INITIAL LINE TO lt_vbeln ASSIGNING <ls_vbeln>.
      <ls_vbeln>-vbeln = <ls_item_data>-deliv_numb.
      <ls_vbeln>-posnr = <ls_item_data>-itm_number.
    ENDLOOP.
 
    lv_dest = zcl_ewm_main=>get_destination( ).
    CALL FUNCTION 'ZERP_GET_PKKEY' DESTINATION lv_dest
      TABLES
        it_vbeln = lt_vbeln
      EXCEPTIONS
        not_data = 1
        OTHERS   = 2.
    IF sy-subrc = 0.
      LOOP AT ct_dlv_request ASSIGNING <ls_dlv_request>.
        LOOP AT <ls_dlv_request>-t_item ASSIGNING <ls_item>.
          LOOP AT <ls_item>-t_keymap_item ASSIGNING <ls_keymap>.
            READ TABLE lt_vbeln ASSIGNING <ls_vbeln> WITH KEY vbeln = <ls_keymap>-docno
                                                              posnr = <ls_keymap>-itemno.
            IF sy-subrc = 0.
              <ls_item>-s_eew-zzpkkey = <ls_vbeln>-pkkey.
            ENDIF.
          ENDLOOP.
        ENDLOOP.
      ENDLOOP.
    ENDIF.
  ENDIF.
 
 
ENDMETHOD.

Schreibe einen Kommentar



All fields are required. Your email address will not be published.