Hi,
In these cases ,you will have to use joins to select data from different tables.I am sending a simple eg on how to do it.Plz go through it and implement in you case.Plz do reward points if useful.
Thankx.
SELECT aebeln bebelp aernam aekgrp a~bedat
btxz01 bnetwr bafnam beffwr
INTO CORRESPONDING FIELDS OF TABLE it_po
FROM ekpo AS b INNER JOIN ekko AS a
ON bebeln = aebeln
WHERE a~bukrs = s_bukrs AND
a~aedat LE p_date AND
a~ebeln IN s_ebeln AND
a~bedat IN s_bedat AND
a~ekgrp IN s_ekgrp AND
a~frgke NE 'E' AND
b~loekz NOT IN ('L', 'S', 'X').
Hi,
Select vbeln
kokrs
from vbak into table it_vbak
where vbeln in s_vbeln.
if not it_vbak[] is initial.
select bezei
from tka01 into table it_tka01
for all entries in it_vbak
where kokrs eq it_vbak-kokrs.
endif.
Regards,
Prashant
Hi,
tables: vbak. types: begin of ty_vbak, vbeln type vbeln, kokrs type kokrs, end of ty_vbak, begin of ty_it_tka01, kokrs type kokrs, bezei type bezei, end of ty_tka01. data: it_vbak type table of ty_vbak, wa_vbak type ty_vbak, it_tka01 type table of ty_tka01, wa_tka01 type ty_tka01. Select-options: s_vbeln for vbak-vbeln. Select VBELN KOKRS from VBAK into table it_VBAK where vbeln in s_vbeln. if sy-subrc = 0. select KOKRS BEZEI from TKA01 into it_tka01 for all entries in it_vbak where kokrs = it_vbak-kokrs. endif. Loop at it_vbak into wa_vbak. read table it_tka01 into wa_tka01 with key kokrs = wa_vbak-kokrs. if sy-subrc = 0. * Move data to final internal table. endif. endloop.
Regards,
Satish
Add a comment