This website is not affiliated with, sponsored by, or approved by SAP AG.

Join expanation

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Join expanation

Postby Madhavi .S » Mon Nov 11, 2002 9:36 am

I would like to know how to code for joins. Can any one send me good information on joins in ABAP. If possible explain me with the following join condition how it works.

* Select from PROJ, AFVC, AFVV and AFVU tables
select proj~pspid proj~post1
afvc~aufpl afvc~sumnr afvc~aplzl

afvc~vornr afvc~ltxa1 afvc~arbid afvc~objnr
vcna~vornr vcna~ltxa1


into table itab_nae

from ( ( ( ( ( proj

inner join prps on prps~psphi eq proj~pspnr )

inner join afvc on afvc~projn eq prps~pspnr
and afvc~sumnr ne '00000000' )

inner join afvv on afvv~aufpl eq afvc~aufpl
and afvv~aplzl eq afvc~aplzl )

inner join afvu on afvu~aufpl eq afvc~aufpl
and afvu~aplzl eq afvc~aplzl )

inner join afvc as vcna
on vcna~aufpl eq afvc~aufpl
and vcna~aplzl eq afvc~sumnr )

where proj~pspid in s_pspid

and proj~loevm ne 'X'
and prps~loevm ne 'X'

and afvc~arbid in s_arbid

and afvc~loekz ne 'X'
and vcna~loekz ne 'X'.
Madhavi .S

Postby ocvantol » Mon Nov 11, 2002 10:03 am

Press F1 on SELECT, then click on FROM clause.
Posts: 929
Joined: Tue Oct 22, 2002 3:19 am
Location: The Hague

Join definitions

Postby Jimj » Mon Nov 11, 2002 11:56 am

An inner join between two files selects fields from the files where matching records exist i.e. intersection based upon the criteria listed e.g.
1)select a~fld1 b~fld2
2)from fileA as a inner join fileB as b on a~fldx = b~fldy (the criteria between the two files!!)
3)where ... (possible other general selection criteria)

This will select fields fld1 and fld2 from fileA and fileB respectively (at 1)...when there are matching records in the two files that meet criteria fldX (from fileA) equals fldY (from fileB) (at 2)... plus where the standard other criteria are met also (at 3).

The other join i.e. (left) outer join is the union of the two files

Hope this helps

Posts: 126
Joined: Mon Oct 21, 2002 5:59 am
Location: North East England

Return to ABAP

Who is online

Users browsing this forum: No registered users and 3 guests

This website is not affiliated with, sponsored by, or approved by SAP AG.