Code: Alles auswählen.
Tables: vbrk, kna1, knbk.
Types: Begin of satz,
name1 type kna1-name1,
kunrg type vbrk-kunrg,
bankn type knbk-bankn,
end of satz.
Types: tabelle type standard table of satz.
Data: itab type tabelle,
wa type satz.
Data: it_vbrk type table of vbrk,
wa_vbrk like line of it_vbrk.
Data: it_kna1 type table of kna1,
wa_kna1 like line of it_kna1.
Data: it_knbk type table of knbk,
wa_knbk like line of it_knbk.
Select * from vbrk into wa_vbrk.
where fkdat between '20060201' and '20080229'
and vkorg = '3000'
and fkart = 'ZES'.
Append wa_vbrk to it_vbrk.
Select * from kna1 into wa_kna1
where kunnr = vbrk-kunrg.
Append wa_kna1 to it_kna1.
Select * from knbk into wa_knbk
where kunnr = kna1-kunnr.
Append wa_knbk to it_knbk.
Endselect.
Endselect.
Endselect.
Loop at it_vbrk into wa_vbrk.
wa-kunrg = wa_vbrk-kunrg.
Loop at it_kna1 into wa_kna1.
wa-name1 = wa_kna1-name1.
Loop at it_knbk into wa_knbk.
wa-bankn = wa_knbk-bankn.
Append wa to itab.
Endloop.
Endloop.
Endloop.
Loop at itab into wa.
write: / 'Itab: ', wa-kunrg, wa-name1, wa-bankn.
Endloop.
Code: Alles auswählen.
SELECT kna1~name1 vbrk~kunag knbk~bankn
INTO CORRESPONDING FIELDS OF TABLE satz
FROM ( vbrk INNER kna1
on kna1~kunnr = vbrk~kunag
inner join knbk
on knbk~kunnr = kna1~kunnr )
where vbrk~fkdat between '20060201' and '20080229'
and vbrk~vkorg = '3000'
and vbrk~fkart = 'ZES'.