Code: Alles auswählen.
DATA: ls_vbkok TYPE vbkok,
lf_vbtyp TYPE vbtyp,
lf_vbeln TYPE vbeln,
lt_prot TYPE TABLE OF prott,
lt_hus TYPE TABLE OF hum_rehang_hu,
lt_vekp TYPE TABLE OF vekp,
lt_vepo TYPE TABLE OF vepo,
lf_pos TYPE rfpos_vl.
SELECT SINGLE vbtyp FROM likp INTO lf_vbtyp
WHERE vbeln = if_vbeln.
lf_vbeln = if_vbeln.
ls_vbkok-vbeln_vl = ls_vbkok-vbeln = if_vbeln.
ls_vbkok-vbtyp_vl = lf_vbtyp.
ls_vbkok-wabuc = 'X'.
SELECT * FROM vekp INTO TABLE lt_vekp
FOR ALL ENTRIES IN mt_hus
WHERE exidv = mt_hus-hunum.
SELECT * FROM vepo INTO TABLE lt_vepo
FOR ALL ENTRIES IN lt_vekp
WHERE venum = lt_vekp-venum
AND velin = '1'.
LOOP AT lt_vekp ASSIGNING FIELD-SYMBOL(<lfs_hu>).
APPEND INITIAL LINE TO lt_hus ASSIGNING FIELD-SYMBOL(<lfs_assign_hu>).
lf_pos = lf_pos + 1.
<lfs_assign_hu>-top_hu_internal = <lfs_hu>-venum.
<lfs_assign_hu>-top_hu_external = <lfs_hu>-exidv.
* Pro position ein rehang-satz
LOOP AT lt_vepo ASSIGNING FIELD-SYMBOL(<lfs_vepo>)
WHERE venum = <lfs_hu>-venum.
<lfs_assign_hu>-venum = <lfs_vepo>-venum.
<lfs_assign_hu>-vepos = <lfs_vepo>-vepos.
<lfs_assign_hu>-rfbel = if_vbeln.
<lfs_assign_hu>-rfpos = lf_pos.
ENDLOOP.
ENDLOOP.
CALL FUNCTION 'WS_DELIVERY_UPDATE'
EXPORTING
vbkok_wa = ls_vbkok
commit = 'X'
delivery = lf_vbeln
TABLES
prot = lt_prot
it_handling_units = lt_hus.