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 while using Select Query

Former Member
0 Likes
1,219

Data:LT_GLT0             TYPE SORTED TABLE OF GLT0 WITH NON-UNIQUE KEY BUKRS RACCT,

SELECT * FROM SKB1

    INTO TABLE LT_SKB1

    WHERE BUKRS IN BUKRS AND

          SAKNR IN SAKNR AND

          WAERS IN WAERU AND

          FDLEV IN FDLEV

    ORDER BY BUKRS.

The below table is taking very long time and could you please any one  can give any suggestions on this.

SELECT * FROM GLT0

      INTO TABLE LT_GLT0

      FOR ALL ENTRIES IN LT_SKB1_TMP

      WHERE  RLDNR = '00'       AND

             RRCTY = '0'        AND

             RVERS = '001'      AND

             BUKRS = LT_SKB1_TMP-BUKRS AND

             RYEAR = LV_GJAHR   AND

        "    racct = lt_skb1-saknr AND

             RBUSA = SPACE      AND

             RPMAX = '16'.


As per my analysis that

  1.Instead of using  SELECT * FROM GLT0 and I will be specify the column names which are required.

  2.I will  be remove the FOR ALL ENTRIES  and will be using INNER JOIN.

Any other suggestions which can help the performance?

it is taking very huge time to execute the Query

8 REPLIES 8
Read only

former_member183804
Active Contributor
0 Likes
1,130

Hello Vemula,

the SELECT for all entries may issue a full table retrieval in case the internal table is empty. If the snippet captures all relevant code the first query might be intended to populate the internal table. There is however no check of sy-subrc and/or sy-dbcnt after the first query. Maybe adding such an check already solves some of the performance issues you experience currently.

On releated track the Code Inspector (TA SCI) and the ABAP Test Cockpit contains a check "Unsecure use of FOR ALL ENTRIES" that can be used for code scans in order to avoid such a flaw.

Best Regards

  Klaus

Read only

Former Member
0 Likes
1,130

Hi,

if LT_SKB1_TMP[] is not initial.


     SELECT * FROM GLT0

      INTO TABLE LT_GLT0

      FOR ALL ENTRIES IN LT_SKB1_TMP

      WHERE  RLDNR = '00'       AND

             RRCTY = '0'        AND
             RVERS = '001'      AND

             BUKRS = LT_SKB1_TMP-BUKRS AND

             RYEAR = LV_GJAHR   AND

        "    racct = lt_skb1-saknr AND

             RBUSA = SPACE      AND

             RPMAX = '16'.

endif.




Read only

Former Member
0 Likes
1,129

Hello,

Check if you can use the view ENT2006 instead of the table . That should improve performace significantly.

Thanks,

Sushma

Read only

0 Likes
1,129

Hi,

could you please let me know how to use the view ENT2006.

Thanks

Durga Prasanth

Read only

former_member404244
Active Contributor
0 Likes
1,129

Hello,

Yes you can go for inner join and also you can check if you can create a secondary index.

I hope you are checking the initiality of the master table before going for 'FOR ALL ENTRIES'.

Regards,

Nagaraj

Read only

Former Member
0 Likes
1,129

hi,

use fm  FAGL_GET_GLT0

Read only

0 Likes
1,129

I had used the function module FAGL_GET_GLT0 and still we are getting the performance issue.

Read only

Former Member
0 Likes
1,129

In your code you are extracting the entries from SKB1 into LT_SKB1 where as in Select from GLT0 you are using for all entries in LT_SKB1_TMP. Are you moving the contents across the table otherwise the TMP table will be empty and the entire records for GLT0 will be read which could be slowing the process.

Regards