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 <fs_lips> LIKE LINE OF lt_lips.
FIELD-SYMBOLS <fs_vbpok> 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 <fs_lips>
WHERE lgort NE '1009'.
APPEND INITIAL LINE TO lt_vbpok ASSIGNING <fs_vbpok>.
<fs_vbpok>-vbeln_vl = <fs_lips>-vbeln.
<fs_vbpok>-posnr_vl = <fs_lips>-posnr.
<fs_vbpok>-kzlgo = 'X'.
<fs_vbpok>-werks = <fs_lips>-werks.
<fs_vbpok>-lgort = '1009'. " Here put your stor. loc
<fs_vbpok>-xwmpp = 'X'.
<fs_vbpok>-lgpla = <fs_lips>-lgpla.
<fs_vbpok>-lgtyp = <fs_lips>-lgtyp.
<fs_vbpok>-bwlvs = <fs_lips>-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.
网友评论