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

Performance issue: table used twice for select statements

Former Member
0 Likes
948

This anlage table used two time how can use only one time can you guys assist me plz. 

SELECT anlage sparte vstelle anlart
           FROM eanl
           INTO TABLE gt_eanl
            FOR ALL ENTRIES IN gt_ever
            WHERE anlage = gt_ever-anlage.
    SORT gt_eanl BY anlage.

    IF gt_eanl[] IS NOT INITIAL.

   SELECT a~anlage a~sparte  b~operand b~betrag b~bis FROM
             eanl AS a INNER JOIN ettifn AS b
             ON a~anlage = b~anlage
             INTO  TABLE gt_ettifn
             FOR ALL ENTRIES IN gt_eanl
             WHERE a~anlage = gt_eanl-anlage
             AND b~operand EQ 'YVMAKVAL'
             AND a~sparte EQ '07'.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
908

Hi,

I don't see the necessity to perform the selection by the first request. Simply use the second one:

IF gt_ever[] IS NOT INITIAL.

   SELECT a~anlage a~sparte  b~operand b~betrag b~bis FROM
             eanl AS a INNER JOIN ettifn AS b
             ON a~anlage = b~anlage
             INTO  TABLE gt_ettifn
             FOR ALL ENTRIES IN gt_ever
             WHERE a~anlage = gt_ever-anlage
             AND b~operand EQ 'YVMAKVAL'
             AND a~sparte EQ '07'.

ENDIF.

This anlage table used two time how can use only one time can you guys assist me plz. 

SELECT anlage sparte vstelle anlart
           FROM eanl
           INTO TABLE gt_eanl
            FOR ALL ENTRIES IN gt_ever
            WHERE anlage = gt_ever-anlage.
    SORT gt_eanl BY anlage.

    IF gt_eanl[] IS NOT INITIAL.

   SELECT a~anlage a~sparte  b~operand b~betrag b~bis FROM
             eanl AS a INNER JOIN ettifn AS b
             ON a~anlage = b~anlage
             INTO  TABLE gt_ettifn
             FOR ALL ENTRIES IN gt_eanl
             WHERE a~anlage = gt_eanl-anlage
             AND b~operand EQ 'YVMAKVAL'
             AND a~sparte EQ '07'.

4 REPLIES 4
Read only

Former Member
0 Likes
909

Hi,

I don't see the necessity to perform the selection by the first request. Simply use the second one:

IF gt_ever[] IS NOT INITIAL.

   SELECT a~anlage a~sparte  b~operand b~betrag b~bis FROM
             eanl AS a INNER JOIN ettifn AS b
             ON a~anlage = b~anlage
             INTO  TABLE gt_ettifn
             FOR ALL ENTRIES IN gt_ever
             WHERE a~anlage = gt_ever-anlage
             AND b~operand EQ 'YVMAKVAL'
             AND a~sparte EQ '07'.

ENDIF.

Read only

0 Likes
908

hi thanks for your response but it's not working in the report some fields are missing.

Read only

yuri_ziryukin
Product and Topic Expert
Product and Topic Expert
0 Likes
908

Well, ofc. you have to modify a little more and make sure that fields "vstelle", "anlart" are also selected from EANL table and populated to the corresponding fields in the output structure of the report.

Read only

Former Member
0 Likes
908

The performance issue could be because of the condition

AND a~sparte EQ '07'.

try removing the condition and see if it is making any difference.

i.e. Remove the condition from select query, fetch all the data in internal table and the delete the unwanted data from internal table so that you have correct data without any performance issues.