Code: Alles auswählen.
data: ls_ekko type ekko,
lt_ekpo type standard table of ekpo,
ls_ekpo type ekpo.
select-options s_matnr for ls_ekpo-matnr.
start-of-selection.
select * from ekpo into table lt_ekpo where matnr in s_matnr.
if sy-subrc > 0.
message s000(vz) with 'Material in keiner Bestellung enthalten'.
else.
sort lt_ekpo by ebeln ebelp.
loop at lt_ekpo into ls_ekpo.
at new ebeln.
select * from ekko into ls_ekko.
write: / ls_ekko-ebeln.
endat.
write: /2 ls_ekpo-ebelp.
endloop.
endif.