Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3160

LOOP in LOOP, (self loop) performance tuning ?

$
0
0

Hi ABAP folks,

 

Can you please advise on the below code. My transformation program is taking 55 minutes to complete 1 round for 100,000 records....which is very bad coding. I am not good in abap. Can you please help me to fine tune the below code for optimum performance. I know its difficult to understand other's code without the actual scenario . But at-least at a high level any suggestion's like using field symbol's or sort or binary search any key words is much appreciated. I will be great at-least if it comes down 15 minutes.

 

If you need more details, I can update you. Basically this is written in the end-routine of the DSO. to get the add quanity and sub quantity of the material's based on the material movements and to get the price of the material's in the 2nd block based on the PO amount and Material amount.

 

 

      LOOP AT RESULT_PACKAGE ASSIGNING <fs_rp>.

        CLEAR: subqty, addqty, wa_ITAB1, WA_ITAB2, WA_ITAB3.

 

        LOOP AT it_ITAB1 INTO wa_ITAB1 WHERE PLANT =

        <fs_rp>-PLANT

        AND MATERIAL = <fs_rp>-MATERIAL

          AND PSTNG_DATE = <fs_rp>-DATE0.

 

          IF wa_ITAB1-MOVETYPE EQ '312'.

            addqty = addqty + wa_ITAB1-QUANT_B.

 

          ELSEIF wa_ITAB1-MOVETYPE EQ '202'.

            subqty = subqty + wa_ITAB1-QUANT_B.

          ENDIF.

 

        ENDLOOP.

 

        <fs_rp>-/BIC/YIO_ADD = addqty.

        <fs_rp>-/BIC/YIO_SUB = subqty.

 

*Calculating material price in the below code

 

        IF <fs_rp>-/BIC/YIOFLAG EQ 'Y'.

 

          READ TABLE it_ITAB2 INTO WA_ITAB2 WITH KEY MATERIAL =

          <fs_rp>-MATERIAL.

 

          IF SY-SUBRC = 0.

<FS_RP>-/BIC/YIOQNTPR = WA_ITAB2-NETPRICE.

<FS_RP>-LOC_CURRCY = WA_ITAB2-LOC_CURRCY.

          ENDIF.

 

        ELSEIF <fs_rp>-/BIC/YIOFLAG  EQ 'N'.

 

          READ TABLE IT_ITAB3 INTO WA_ITAB3 WITH key MATERIAL =

          <FS_RP>-MATERIAL

          PLANT =  <FS_RP>-PLANT

          CALMONTH = <FS_RP>-CALMONTH.

 

          IF SY-SUBRC = 0.

<FS_RP>-/BIC/YIOQNTPR = WA_ITAB3-PRICE_VAL.

<FS_RP>-LOC_CURRCY = WA_ITAB3-CURRENCY.

          ENDIF.

 

        ENDIF.

 

 

      ENDLOOP.

 

Thanks

DR


Viewing all articles
Browse latest Browse all 3160

Trending Articles



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