‎2008 Jan 24 5:56 AM
Hi all,
I want to query a inner join via some tools in sap GUI. till now, i could not query a inner join between two tables via SE11. can someone tell are there some other ways to achieve this?
any response will be awarded!
thanks and regards,
samson
‎2008 Jan 24 6:17 AM
samson,
You use SQ02 and SQ01 tcodes to inner join to tables.
For more detaisls.
Step-by-step guide for creating ABAP query
http://www.sappoint.com/abap/ab4query.pdf
After query development
Execute the query (SQ01) then goto tcode SE38-->display(F7).
No need to enter program name automaticaaly when you execute the query it will show the program name.
In code you can find inner join created by program....
Don't forget to reward if useful...
‎2008 Jan 24 6:17 AM
samson,
You use SQ02 and SQ01 tcodes to inner join to tables.
For more detaisls.
Step-by-step guide for creating ABAP query
http://www.sappoint.com/abap/ab4query.pdf
After query development
Execute the query (SQ01) then goto tcode SE38-->display(F7).
No need to enter program name automaticaaly when you execute the query it will show the program name.
In code you can find inner join created by program....
Don't forget to reward if useful...
‎2008 Jan 24 6:27 AM
hi samson,
Proper use of Inner Join
When multiple SAP tables are logically joined, it is always advisable to use inner join to read the data from them. This certainly reduces the load on the network.
Let us take an example of 2 tables, zairln and zflight. The table zairln has the field airln, which is the airline code and the field lnnam, which is the name of the airline. The table zflight has the field airln, the airline code and other fields which hold the details of the flights that an airline operates.
Since these 2 tables a re logically joined by the airln field, it is advisable to use the inner join.
Select aairln alnnam bfligh bcntry into table int_airdet
example 2:--
Inner join: If you have common fields between 2 or more tables, its betterto use Inner join.
Check the below example:
VBAK & VBAP table has common fields, hence we can use inner join.
SELECT akunnr avbeln anetwr abnddt a~knumv
avkbur aerdat avdatu aaugru
aktext bmatnr barktx bkwmeng b~kzwi6
bvolum bposnr b~kdmat
INTO CORRESPONDING FIELDS OF TABLE g_t_quot
FROM vbak AS a INNER JOIN vbap AS b
ON avbeln = bvbeln
WHERE a~vbeln IN so_vbeln
AND a~trvog ='2'
AND a~vkorg IN so_vkorg
AND a~vtweg IN so_vtweg
AND a~vkbur IN so_vkbur
AND a~audat IN so_audat
AND a~kunnr IN so_kunag.
FOR ALL ENTRIES:
If you get some data into one internal table and if you want to fetch data from other table based on it, use FOR ALL ENTRIES.
g_t_quot is an internal table.
SELECT spras augru bezei FROM tvaut INTO TABLE g_t_tvaut
FOR ALL ENTRIES IN g_t_quot
WHERE augru = g_t_quot-augru AND spras = sy-langu.
From zairln as a inner join zflight as b on aairln = bairln.
In order to restrict the data as per the selection criteria, a where clause can be added to the above inner join.