Skip to Content
0
Former Member
Sep 15, 2011 at 04:35 AM

Optimisation Advice required for a code

17 Views

Hi Gurus

Please help in optimising the code. It takes 1 hr for 3-4000 records. Its very slow.

My Select is reading from a table which contains 10 Million records.

I am writing the select on large table and Retrieving the values from large tables by comparing my table which has 3-4 k records.

I am pasting the code. please help

Data: wa_i_tab1 type tys_tg_1 .

DATA: i_tab TYPE STANDARD TABLE OF tys_tg_1.

Data : wa_result_pkg type tys_tg_1,

wa_result_pkg1 type tys_tg_1.

SELECT /BIC/ZSETLRUN AGREEMENT /BIC/ZREB_SDAT /BIC/ZLITEM1 from

/BIC/PZREB_SDAT *******************THIS TABLE CONTAINS 10 MILLION RECORDS

into CORRESPONDING FIELDS OF table i_tab

FOR ALL ENTRIES IN RESULT_PACKAGE***************CONTAINS 3000-4000 RECORDS

where

/bic/ZREB_SDAT = RESULT_PACKAGE-/BIC/ZREB_SDAT

AND

AGREEMENT = RESULT_PACKAGE-AGREEMENT

AND /BIC/ZLITEM1 = RESULT_PACKAGE-/BIC/ZLITEM1.

sort RESULT_PACKAGE by AGREEMENT /BIC/ZREB_SDAT /BIC/ZLITEM1.

sort i_tab by AGREEMENT /BIC/ZREB_SDAT /BIC/ZLITEM1.

loop at RESULT_PACKAGE into wa_result_pkg.

read TABLE i_tab INTO wa_i_tab1 with key

/BIC/ZREB_SDAT =

wa_result_pkg-/BIC/ZREB_SDAT

AGREEMENT = wa_result_pkg-AGREEMENT

/BIC/ZLITEM1 = wa_result_pkg-/BIC/ZLITEM1.

IF SY-SUBRC = 0.

move wa_i_tab1-/BIC/ZSETLRUN to

wa_result_pkg-/BIC/ZSETLRUN.

wa_result_pkg1-/BIC/ZSETLRUN = wa_result_pkg-/BIC/ZSETLRUN.

modify RESULT_PACKAGE from wa_result_pkg1

TRANSPORTING /BIC/ZSETLRUN.

ENDIF.

CLEAR: wa_i_tab1,wa_result_pkg1,wa_result_pkg.

endloop.