Code: Alles auswählen.
method if_ex_mb_migo_badi~post_document.
"----> Lokale Daten deklaration
types: begin of ty_lgfsb,
matnr type matnr,
lgfsb type lgfsb,
end of ty_lgfsb,
tty_lgfsb type table of ty_lgfsb with key matnr.
data: l_pobjid type pl_pobjid,
lt_hupos type table of bapihupiposition,
lt_return type table of bapiret2,
lt_leihgut type ztty_vph_leihgut,
lt_lgfsb type tty_lgfsb.
"<----
loop at it_mseg assigning field-symbol(<fs_mseg>).
if <fs_mseg>-bwart = '101'.
select single pkp~pobjid from kotp410 as ktp
inner join kondp as kdp
on kdp~knumh = ktp~knumh
inner join packkp as pkp
on pkp~packnr = kdp~packnr
into l_pobjid
where kappl = 'PO'
and kschl = 'RCPT'
and matnr = <fs_mseg>-matnr
and werks = <fs_mseg>-werks
and lifnr = <fs_mseg>-lifnr
and datbi >= sy-datlo
and datab <= sy-datlo.
if sy-subrc = 0.
clear: lt_hupos, lt_return.
call function 'BAPI_HU_PI_READ'
exporting
pikey = l_pobjid
tables
positions = lt_hupos
return = lt_return.
...
endif.
...
endif.
...
endloop.
...
endmethod.