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

Problem with join statement

Former Member
0 Likes
1,281

Hi expert,

I have an internal table name equip which will get data from caufv view and other tables as follow:

SELECT
      ...
    into corresponding fields of table equip
    FROM caufv
              join afih on afih~aufnr = caufv~aufnr
              join iloa on iloa~iloan = afih~iloan
              join iflos  on iflos~tplnr = iloa~tplnr
              join iflotx on iflos~tplnr = iflotx~tplnr
              join vbak on vbak~aufnr = caufv~aufnr
              join equz on equz~equnr = afih~equnr
              join equi on equi~equnr = equz~equnr
              join vbap on vbak~vbeln = vbap~vbeln
    WHERE
          ...

The requirement is using only one more JOIN statement to add more following fields to display in ALV list:

1. Add service event type description (field source is T356_T-PRIOKX ) where T356_T-PRIOK = QMEL-PRIOK and T356_T-ARTPR = u2018ZSu2019 and T356_T-SPRAS = SY-LANGU.

2. Add Service order type text (field source is T003P-TXT ) where T003P-AUART = AUFK-AUART AND T003P-SPRAS = SY-LANGU.

3. Add Activity type text (field source is T353I_T-ILATX ) where T353I_T- ILART = AFIH-ILART AND T353I_T-SPRAS = SY-LANGU.

Please suggest me. Points are for sure.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
902

Hi Khanh,

Do consider another way of doing this - from the performance point of view.

Instead of joining all 10 tables, try to use the SELECT statement with the addition FOR ALL ENTRIES IN. This will have to be done multiple times.

Hope this helps.

Regards,

Nimish

4 REPLIES 4
Read only

Former Member
0 Likes
902

Well, you are joining 9 tables already. it aint wise to join over 10 tables performancewise.

Read only

0 Likes
902

Hi Florian,

Thanks for your comment. I'm maintaining for this report because it is now a bit slow performance.

I just found a view but there are no views for these three tables.

Read only

Former Member
0 Likes
903

Hi Khanh,

Do consider another way of doing this - from the performance point of view.

Instead of joining all 10 tables, try to use the SELECT statement with the addition FOR ALL ENTRIES IN. This will have to be done multiple times.

Hope this helps.

Regards,

Nimish

Read only

former_member229729
Active Participant
0 Likes
902

Hi,

It is not not advised by SAP to use multiple joins in a query by performance wise.

Hence, please split your query into different segment and output your result records into to a final internal table.

Thanks and regards,

Ramani N.