‎2007 Jun 01 12:25 AM
hello abapers,
below is my scenario,
Extract each entry from DBtab1 for FLD1 in DBtab2-FLD1, and FLD2 in DBtab3-FLD2
sum(FLD3) by FLD2 into
internal tab ITAB (fields FLD2, FLD3).
i thought something like this;
select FLD1 FLD2 sum( FLD3) into ITAB from DBtab1 where FLD1 = DBtab2-FLD1 and FLD2 = DBtab3-FLD2
GROUP by FLD2.
i know this doesnot work, because fld1 should check each and every entry in DBtab2 and same is the case with DBtab3,
i should be using inner or outer join, can some one help.
thank you.
‎2007 Jun 01 12:43 AM
If you want to have SAP write the code for you use the quick viewer to build a join and generate the code.
Run the quuey. Do a system > statuson the result and lift the code.
Quick viewer is either System >services >quick viewer or systemt >quick viewer can't remember which from the session manager transaction.
Also to view the documentation in the abap editor type the word join and hit F1.
‎2007 Jun 01 12:31 AM
Hi saritha,
Either use inner join, or get the data into the internal tables by using FOR ALL ENTRIES.
Regards,
Atish
‎2007 Jun 01 12:43 AM
If you want to have SAP write the code for you use the quick viewer to build a join and generate the code.
Run the quuey. Do a system > statuson the result and lift the code.
Quick viewer is either System >services >quick viewer or systemt >quick viewer can't remember which from the session manager transaction.
Also to view the documentation in the abap editor type the word join and hit F1.
‎2007 Jun 01 1:37 AM
See the example code :
select matnr shkzg meins sum( fklmg )
into table i_billed
from ( vbrk as k INNER JOIN vbrp as p on kvbeln = pvbeln )
where ( vbtyp = 'M' or "invoice
vbtyp = 'N' ) and "invoice cancellation
k~fkdat in so_vdatu and
matnr in so_matnr and
p~werks = p_werks
group by matnr shkzg meins.
‎2007 Jun 01 3:17 AM
Hi,
Its better if u use Inner Join or For All entries.......to join the tables.....
with regards,
madhuri.
‎2007 Jun 01 3:18 AM
Hi,
Its better if u use Inner Join or For All entries.......to join the tables.....
with regards,
madhuri.