Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9129

Re: Performance issue in select and loop

$
0
0

Hi,

 

If possible use a JOIN between bw_table and result_package table.

If it's not possible, assure that the values of the fields in FAE-table used in WHERE-clause of SELECT are unique.

Use a SORTED TABLE for it_bw_table to optimize access in LOOP with WHERE-clause.

 

Example:

DATA it_bw_table type SORTED TABLE of ltype_bw_table
with non-unique key cond1 cond2 cond3.

LOOP AT Result_package ASSIGNING <result>.
COLLECT <result>-condx into condx_table.   "assumption: <result>-condx is non-numeric
ENDLOOP.

SELECT * FROM bw_table
INTO TABLE it_bw_table
FOR ALL ENTRIES IN condx_table
WHERE cond1 = condx_table-table_line.

LOOP AT Result_package ASSIGNING <result>

  LOOP AT it_bw_table INTO ls_bw_table
     WHERE cond1 = <result>-cond1
       AND cond2 = <result>-cond2
       AND cond3 = <result>-cond3

  IF statement

  ELSEIF statement

  ENDIF

  ENDLOOP

ENDLOOP

 

Best Regards, Randolf


Viewing all articles
Browse latest Browse all 9129

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>