‎2007 Apr 05 9:24 AM
‎2007 Apr 05 9:28 AM
manikam,
For this you have to use innerjoins.
SELECT a~mandt
a~vbeln
a~posnr
a~lprio
a~matnr
a~kwmeng
a~vrkme
a~netwr
a~waerk
a~kdmat
a~werks
a~pstyv
a~charg
a~route
u~absta
u~fksta
u~gbsta
u~lfsta
a~posex
a~vgbel
u~besta
v~bsark
v~ihrez
INTO TABLE i_vbap
FROM vbap AS a
INNER JOIN vbup AS u ON uvbeln = avbeln AND uposnr = aposnr
INNER JOIN vbkd AS v ON vvbeln = avbeln AND vposnr = aposnr
FOR ALL ENTRIES IN i_vbak
WHERE a~vbeln EQ i_vbak-vbeln.
Don't forget ot reward if useful
‎2007 Apr 05 9:27 AM
Hi Manikam,
U can use joins on two tables if they have any fields in common.
e.g. if we want to select the data from tables VBAK and VBAK then we can write as follows :
SELECT VBAKVBELN VBAKAUART VBAPPOSNR into correspodning fields of table itab from VBAK join VBAP on VBAKVBELN = VBAP~VBELN WHERE
<conditions>.
Other way is to use SELECT ...... FOR ALL ENTRIES.
Regards,
Himanshu
‎2007 Apr 05 9:28 AM
manikam,
For this you have to use innerjoins.
SELECT a~mandt
a~vbeln
a~posnr
a~lprio
a~matnr
a~kwmeng
a~vrkme
a~netwr
a~waerk
a~kdmat
a~werks
a~pstyv
a~charg
a~route
u~absta
u~fksta
u~gbsta
u~lfsta
a~posex
a~vgbel
u~besta
v~bsark
v~ihrez
INTO TABLE i_vbap
FROM vbap AS a
INNER JOIN vbup AS u ON uvbeln = avbeln AND uposnr = aposnr
INNER JOIN vbkd AS v ON vvbeln = avbeln AND vposnr = aposnr
FOR ALL ENTRIES IN i_vbak
WHERE a~vbeln EQ i_vbak-vbeln.
Don't forget ot reward if useful
‎2007 Apr 05 9:30 AM
hi,
u have make use of inner join for selecting records from more than onew table but u have to have atleast one common field in both the tables.
regards,
ravi
‎2007 Apr 05 9:34 AM
Hi,
There are two ways of doing this.
1. Using Joins as mentioned earlier by some.
2. Declare two internal tables for the two database tables and populate any one of them. then use FOR ALL ENTRIES in that filled internal table and populate the other internal table from the other database table. Now declare one final internal table and move the data from the two tables into this. Use the final internal table for displaying the records or for reports.
hope this helps....
reward if helpful....
naba
‎2007 Apr 05 11:09 AM
hi
good
you can select data from two table using the INNER JOIN or OUTER JOIN statement.
thanks
mrutyun^