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

joining 5 tables

Former Member
0 Likes
3,179

anybody tell how to join 5 tables .....if u have coding plz send me ........

anybody tell how to join 5 tables .....if u have coding plz send me ........

5 REPLIES 5
Read only

Former Member
0 Likes
1,439

Hi..

Joining 5 tables will give performance issue...if u r very sure then only go ahead..

Message was edited by:

Dhananjay Patil

Read only

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

Hi,

Why dont you create Views and then use the view in your SELECT query.

Generic example of JOINING 5 tables

SELECT FLD1 FLD2 FLD3 FLD4 FLD5 INTO CORRESPONDING FIELDS OF TABLE ITAB FROM TABLE1 <b>INNER JOIN</b> TABLE2 ON TABLE1FLD1 = <b>TABLE2FLD1<b> INNER JOIN</b> TABLE3 ON TABLE2FLD2 = TABLE3FLD2 INNER JOIN</b> TABL4 ON TABLE3FLD3 = TABLE4FLD3 <b>INNER JOIN</b> TABLE5 ON TABLE4FLD4 = TABLE5FLD5 WHERE FLD1 = 'AA'.

Regards,

Sesh

Read only

Former Member
0 Likes
1,439

HI,

There is no difference in joining 2 tables are 5 tables.. the systax goes like this.

select table1field table2field table3~field..... from table1

join table2 on table1field = table2field

join table3 on table2field = table3field........

where <your condiation> ex... table~field in s_field..

Thanks

Mahesh

Read only

0 Likes
1,439

hi ravi,

SAP limited joining of 3 tables maximum,and also avoid using joining fro that use for all entries.

Read only

Former Member
1,439

Hi Ravi,

Dont use joins on five tables, it will impact the performence very badly.. instead use FOR ALL ENTRIES..

Proceed as follows:

SELECT xxxx

FROM xxxx

INTO tab1

WHERE selection condtions.

IF sy-subrc EQ 0

AND NOT tab1[] IS INITIAl.

SELECT yyyy

FROM yyyy

INTO tab2

FOR ALL ENTRIES IN tab1

WHERE xxx EQ tab1-xxx.

and so on.. for all the 5 tables..

Thanks and Best Regards,

Vikas Bittera.

**Points for useful answers**