SAP VL02N 修改库位


REPORT test.
DATA: lt_lips LIKE TABLE OF lips.
DATA: lt_vbpok LIKE TABLE OF vbpok.
DATA: lt_prot LIKE TABLE OF prott.
FIELD-SYMBOLS  LIKE LINE OF lt_lips.
FIELD-SYMBOLS  LIKE LINE OF lt_vbpok.
DATA p_vbeln LIKE lips-vbeln.
DATA ls_vbkok LIKE vbkok.
p_vbeln = '0080002563'.
SELECT
     *
   FROM
     lips
   INTO TABLE
     lt_lips
   WHERE
     vbeln = p_vbeln.

* Insert storage location if empty or different
LOOP AT lt_lips ASSIGNING 
  WHERE lgort NE '1009'.
  APPEND INITIAL LINE TO lt_vbpok ASSIGNING .
  -vbeln_vl = -vbeln.
  -posnr_vl = -posnr.
  -kzlgo    = 'X'.
  -werks    = -werks.
  -lgort    = '1009'. " Here put your stor. loc
  -xwmpp    = 'X'.
  -lgpla    = -lgpla.
  -lgtyp    = -lgtyp.
  -bwlvs    = -bwlvs.
ENDLOOP.

IF sy-subrc EQ 0.
  ls_vbkok-vbeln_vl   = p_vbeln.
  CALL FUNCTION 'WS_DELIVERY_UPDATE'
    EXPORTING
      vbkok_wa  = ls_vbkok
      delivery  = p_vbeln
      commit    = 'X'
    TABLES
      vbpok_tab = lt_vbpok
      prot      = lt_prot
    EXCEPTIONS
      OTHERS    = 1.
  BREAK-POINT.
ENDIF.

你可能感兴趣的:(SAP VL02N 修改库位)