report ztest .
tables:mara,marc,mard.
data:begin of it_final occurs 0,
matnr like mara-matnr,
mtart like mara-mtart,
meins like mara-meins,
werks like marc-werks,
pstat like marc-pstat,
lgort like mard-lgort,
labst like mard-labst,
end of it_final.
select-options:s_matnr for mara-matnr.
start-of-selection.
select matnr
mtart
meins
from mara
into table it_final
where matnr in s_matnr.
if sy-subrc = 0.
loop at it_final.
select single
werks
pstat
from marc
into (it_final-werks,it_final-pstat)
where matnr = it_final-matnr.
modify it_final.
if sy-subrc = 0.
select single
lgort
labst
from mard
into (it_final-lgort,it_final-labst)
where werks = it_final-werks.
modify it_final.
endif.
endloop.
endif.
if sy-subrc = 0.
loop at it_final.
write:/ it_final-matnr,
it_final-mtart,
it_final-meins,
it_final-werks,
it_final-pstat,
it_final-lgort,
it_final-labst.
endloop.
endif.
No comments:
Post a Comment