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

select statement with JOINS

Former Member
0 Likes
2,323

Hi friends,

basically i'm not a ABAPER, but i have to write this code.. and fetch the data .. i want to extract data from three tables <b> INOB</b> (CUOBJ ,OBJEK ), <b>AUSP</b>(OBJEK ,ATINN ,ATWRT ,ATFLV ) and ,<b>CABN</b> (ATINN, ATNAM)

these fields i want to extract so, can one give me the exact select statement with using inner join based on above common fields..

i need it urgent... answers will be highly appriciated..

regards

Babu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,568

select a~CUOBJ

a~objek

B~ATINN

B~ATWRT

B~ATFLV

c~ATNAM

from INOB as a

INNER JOIN AUSP as b

ON aOBJEK = bOBJEK

INNER JOIN CABN as c

ON bATINN = cATINN

into table <your final table>

where <your conditions>.

But using inner joins on three tables is not preferable

you can code like this also

Use innre join on two tables and then for all entries on third table.

rewards if useful,

regards,

nazeer

Message was edited by:

'Nazeer'

4 REPLIES 4
Read only

Former Member
0 Likes
1,568

IF GT_IMAK[] IS NOT INITIAL.

SELECT A~POSNR

A~OBJNR

B~PRNAM

B~POSID

B~GJAHR

FROM IMZO AS A

INNER JOIN IMPR AS B ON

APOSNR = BPOSNR

INTO CORRESPONDING FIELDS OF TABLE GT_INVT

FOR ALL ENTRIES IN GT_IMAK

WHERE A~OBJNR = GT_IMAK-OBJNR1.

ENDIF.

try this sample code , u have to join in Primary keys.

Regards

Peram

Read only

Former Member
0 Likes
1,569

select a~CUOBJ

a~objek

B~ATINN

B~ATWRT

B~ATFLV

c~ATNAM

from INOB as a

INNER JOIN AUSP as b

ON aOBJEK = bOBJEK

INNER JOIN CABN as c

ON bATINN = cATINN

into table <your final table>

where <your conditions>.

But using inner joins on three tables is not preferable

you can code like this also

Use innre join on two tables and then for all entries on third table.

rewards if useful,

regards,

nazeer

Message was edited by:

'Nazeer'

Read only

varma_narayana
Active Contributor
0 Likes
1,568

Hi..

Declare ITAB with all these fields:

SELECT INOBCUOBJ INOBOBJEK

AUSPATINN AUSPATWRT AUSP~ATFLV

CABN~ATNAM

FROM INOB

INNER JOIN AUSP

ON INOBOBJEK = AUSPOBJEK

INNER JOIN CABN

ON AUSPATINN = CABNATINN

INTO TABLE ITAB.

<b>Reward if Helpful.</b>

Read only

seshatalpasai_madala
Product and Topic Expert
Product and Topic Expert
0 Likes
1,568

Hi,


DATA: begin of itab occurs 0,
INCLUDE STRUCTURE INOB.
DATA:ATINN TYPE CAMN-ATINN,
end of itab.

SELECT * FROM INOB INNER JOIN AUSP ON INOB~OBJEK = AUSP~OBJEK
INNER JOIN CABN ON INOB~ATINN = CABN~ATINN into corresponding fields of table itab.

Regards,

Sesh