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

Join

Former Member
0 Likes
446

Hi,

Can ne1 plz help me out by telling me a simple code that uses the concept of the join query. Join is very confusing for me.

Thanks & Regards,

Mohit Goel.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
423

Hi,

check this code..



SELECT A~MATNR B~WERKS
             FROM MARA AS A
             INNER JOIN MARC AS B
             ON A~MATNR = B~MATNR
             WHERE A~MATNR = 'TEST123'.

Thanks

Naren

2 REPLIES 2
Read only

Former Member
0 Likes
424

Hi,

check this code..



SELECT A~MATNR B~WERKS
             FROM MARA AS A
             INNER JOIN MARC AS B
             ON A~MATNR = B~MATNR
             WHERE A~MATNR = 'TEST123'.

Thanks

Naren

Read only

Former Member
0 Likes
423

Check these examples -

Example of a JOIN containing more than 2 tables: Select all flights from Frankfurt to New York between 10th and 20th September 1997 where there are free places, and display the name of the airline.

DATA: BEGIN OF itab occurs 0,

FLIGHT TYPE SFLIGHT,

PFLI TYPE SPFLI,

CARR TYPE SCARR,

END OF itab.

SELECT * INTO table itab

FROM ( SFLIGHT AS F INNER JOIN SPFLI AS P

ON FCARRID = PCARRID AND

FCONNID = PCONNID )

INNER JOIN SCARR AS C

ON FCARRID = CCARRID

WHERE P~CITYFROM = 'FRANKFURT'

AND P~CITYTO = 'NEW YORK'

AND F~FLDATE BETWEEN '19970910' AND '19970920'

AND FSEATSOCC < FSEATSMAX.

TABLES: SCUSTOM, SBOOK.

SELECT SCUSTOMNAME SCUSTOMPOSTCODE SCUSTOM~CITY

SBOOKFLDATE SBOOKCARRID SBOOKCONNID SBOOKBOOKID

INTO (SCUSTOM-NAME, SCUSTOM-POSTCODE, SCUSTOM-CITY,

SBOOK-FLDATE, SBOOK-CARRID, SBOOK-CONNID,

SBOOK-BOOKID)

FROM SCUSTOM LEFT OUTER JOIN SBOOK

ON SCUSTOMID = SBOOKCUSTOMID AND

SBOOK~FLDATE = '19971015'

ORDER BY SCUSTOMNAME SBOOKFLDATE.

WRITE: / SCUSTOM-NAME, SCUSTOM-POSTCODE, SCUSTOM-CITY,

SBOOK-FLDATE, SBOOK-CARRID, SBOOK-CONNID,

SBOOK-BOOKID.

ENDSELECT.

For more details check link

http://www.geocities.com/rmtiwari/Resources/Utilities/ABAPReference/ABAPReference.html

Check JOIN Command.

ashish