Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

tables: vbak,

vbap.

types: begin of lty_data


vbeln type vbeln_va
erdat type erdat
erzet type erzet
ernam type ernam
end of lty_data.

types: begin of lty_data1


vbeln type vbeln_va
posnr type posnr_va
matnr type matnr
end of lty_data1.

Selection-screen: begin of block b1 with frame text 000.


select-options: s_vbeln for vbak-vbeln obligatory no interval
selection-screen: end of block b1.

Data: lt_data type table of lty_data,


ls_data type lty_data,
lt_data1 type table of lty_data1,
ls_data1 type table of ty_data1.

select vbeln, erdat, erzet, ernam from vbak into table lt_data
where vbeln in s_vbeln.

select vbeln posnr matnr


from vbap
into table lt_data1
for all enteries in lt_data (** the first internal table)
where vbeln = lt_data-vbeln. ( vbeln is the common key and the fields from the
first table which corrosponds to the vbeln)

Loop at lt_data1 into ls_data1.

read table lt_data into ls_data with key vbeln = ls_data1-vbeln. ( with key works
as where condition) (read statement is used to retrieve the table data to the work
area by using the comparing clasue)

write: ls_data-vbeln, ls_data-erdat, ls_data- ernamm, ls_data1-posnr, ls_data1-


matnr. (** we have made a loop on the second table that is why multiple enteries
have been displayed).

End loop.

You might also like