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

Re: ABAP performance tuning the BW Function Module code

$
0
0

Hi Amy, try this.., i hope helps.

SELECT sold_to

               salesorg

               division

               distr_chan

               /BIC/ZLASTSALE

INTO TABLE t_ods

FROM /BIC/AZPO_CTDT00

WHERE /BIC/ZLASTSALE < lv_Date and     

               SOLD_TO <> ''.

 

IF sy-subrc EQ 0. 

     SORT t_ods BY sold_to salesorg division distr_chan.

ENDIF.     

 

SELECT sold_to

INTO  t_equipment

FROM BIC/AZPO_EQMM00

FOR ALL ENTRIES  t_ods

WHERE sold_To = Sold_To  AND     

VALIDTO > SY-DATUM AND     

sold_to <> ''.

 

IF sy-subrc EQ 0. 

     SORT t_ods BY sold_to.

ENDIF.

 

SELECT sold_to

INTO t_cust

FROM /BI0/MCUST_SALES

FOR ALL ENTRIES IN t_ods

WHERE  cust_sales = cust_sales AND       

               salesorg = sales_org    AND

               division  = division    AND

               distr_chan = distr_chan AND       

               /BIC/ZORDBLK = ''.

 

IF sy-subrc EQ 0. 

     SORT t_ods BY sold_to.

ENDIF.

 

LOOP AT t_ods INTO w_ods.

          "Exist in table equipment?

          READ TABLE t_equipment INTO w_equipment WITH KEY sold_to = w_ods-sold_to

          BINARY SEARCH.

          IF sy-subrc EQ 0. 

                    " /BIC/ZORDBLK is initial. 

                    READ TABLE t_cust INTO w_cust WITH KEY sold_to = w_ods-sold_to 

                    BINARY SEARCH. 

                    IF sy-subrc EQ 0.      

                              " add values     

                              MOVE: t_ods-sold_to  TO E_T_DATA-sold_to,                   

                                           t_ods-salesorg TO E_T_DATA-salesorg.     

                                   APPEND E_T_DATA.         

                    ENDIF.

          ENDIF.

          CLEAR: w_ods.

ENDLOOP.


Viewing all articles
Browse latest Browse all 8545

Trending Articles



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