Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

inner join query

Former Member
0 Likes
1,710

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
795

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...

2 REPLIES 2
Read only

Former Member
0 Likes
796

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...

Read only

Former Member
0 Likes
795

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.