‎2009 Feb 17 6:05 AM
tab1 : select 10 rows.
tab2 : for the above 10 rows for each has 20 rows in tab2 ( duplicare records ).
but both tables common field is BUKRS only .
how can i select data .
Regards,
Mk.
‎2009 Feb 17 6:08 AM
Hi Kumar,
What r the Tables.. I mean the table Name & what is your scenario..
‎2009 Feb 17 6:09 AM
Hi,
Use Upto 10 rows in select statement.
eg.
SELECT * FROM mara UP TO 10 ROWS INTO TABLE itab.
in the first select query and use for all entries in first select query internal table the second select query.
This will solve ur problem.
‎2009 Feb 17 6:09 AM
first select ..
select bukrs f2 f3 ... from table1 into itab1 up to 10 rows.
if sy-subrc = 0.
select (all the key fields) from table2 into itab2
for all entries in itab1
where bukrs = itab1-bukrs.
endif.
‎2009 Feb 17 6:13 AM
Thanks to all for reply,
the code is below plz coorect me :
form get_data.
SELECT bukrs belnr budat awkey
INTO TABLE it_final
FROM bkpf
WHERE bukrs = bukrs AND
budat IN budat AND
( blart = 'RE' OR
blart = 'RN' ) .
SORT IT_FINAL BY belnr.
LOOP at it_final.
V_AWKEY = it_final-awkey(10).
SELECT BUKRS belnr ebeln ebelp matnr menge salk3 kschl wrbtr lifnr shkzg xblnr BUZEI
INTO TABLE it_rseg
from rseg
where belnr = V_AWKEY .
SORT it_rseg by belnr.
LOOP AT it_rseg.
it_final-belnr = it_rseg-belnr.
it_final-xblnr = it_rseg-xblnr.
it_final-buzei = it_rseg-buzei.
enDLOOP.
modify it_final.
CLEAR it_final.
CLEAR V_AWKEY.
CLEAR it_rseg.
ENDLOOP.
ENDFORM.
‎2009 Feb 17 6:10 AM
HI,
Use LEFT OUTER JOIN hope will solve out your problem, Have a look at the following Sample Code.
select anla~anln1 anla~ord41 anla~ord43 anla~ord44 anla~invnr anla~sernr anlu~zdate anlu~zztot_status
a~ordtx as tot_desc b~ordtx as mod_desc c~ordtx as injec_cat
into corresponding fields of table it_asset_details
from anla
inner join anlu on ( anla~bukrs = anlu~bukrs and anla~anln1 = anlu~anln1 and anla~anln2 = anlu~anln2 )
left outer join t087t as a on ( anla~ord41 = a~ord4x and a~spras = 'E' and a~ordnr = '1' )
left outer join t087t as b on ( anla~ord43 = b~ord4x and b~spras = 'E' and b~ordnr = '3' )
left outer join t087t as c on ( anla~ord44 = c~ord4x and c~spras = 'E' and c~ordnr = '4' )
where anlu~zzssok = outlet_id.
sort it_asset_details by zdate.Kind Regards,
Faisal
‎2009 Feb 17 6:11 AM
Hi,
Use FOR ALL ENTERIES,
for the second table query write as
select <required Fields> from <tabname> into table itab2 FOR ALL ENTERIES <first Table Name>
where BUKRS = itab1-BUKRS.
‎2009 Feb 17 6:11 AM
Hi,
Try this:
select * from tab1 into itab1.
select * from tab2 FOR all entries in itab1 into itab2 where bukrs = itab1-bukrs.
Cheers,
Surinder
‎2009 Feb 17 6:12 AM
try this,
use for all entries ....
{select <field names>
bukrs
from tale1
into table itab1.
if sy-subrc = 0.
select <field names>
from table2
into table itab2
for all entries in itab1
where bukrs = itab1-bukrs.
endif.}
‎2009 Feb 17 6:25 AM
Hi,
Don't post same question multiple times, Use same thread.
‎2009 Feb 24 11:27 AM