Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

function module within loop

$
0
0

HI ,

 

I am using fuction module within loop

which is taking lots of time please tell me any trick how to do fast processing

my code is

 

LOOP AT IT_HD INTO WA_HD .

     var = var +  1.

     CALL FUNCTION 'BBP_PD_SC_GETDETAIL'

       EXPORTING

         I_GUID    = WA_HD-GUID

       IMPORTING

         E_HEADER  = E_HEADER

       TABLES

         E_ITEM    = E_ITEM

         E_ACCOUNT = E_ACCOUNT

         E_PARTNER = E_PARTNER

         E_STATUS  = E_STATUS .

   delete E_STATUS WHERE INACT 'X'.

   READ TABLE  E_STATUS INTO  WA_STATUS INDEX 1.

   select single TXT30 from TJ02T into TXT30 WHERE  ISTAT =   WA_STATUS-STAT and SPRAS = 'E'.

 

      loop at E_ITEM INTO WA_ITEM .

     READ TABLE  E_PARTNER INTO  WA_PARTNER WITH KEY PARTNER_FCT = '00000019'.

 

       READ TABLE IT_ORG INTO WA_ORG WITH KEY BE_PUR_GROUP  = WA_ITEM-BE_PUR_GROUP

                                                BE_PUR_ORG = WA_ITEM-BE_PUR_ORG

                                                BE_CO_CODE  = WA_ITEM-BE_CO_CODE.

       IF SY-SUBRC = 0.

         IF E_HEADER-POSTING_DATE IN  POS_DATE.

           SELECT SINGLE  BE_OBJECT_ID FROM BBP_PDBEI INTO WA_SC-BE_OBJECT_ID WHERE GUID = WA_ITEM-GUID.

           SELECT SINGLE NAME_ORG1 FROM BUT000 INTO WA_SC-NAME_ORG1 WHERE PARTNER_GUID  WA_PARTNER-PARTNER_NO .

         ENDIF.

 

             READ TABLE  E_PARTNER INTO  WA_PARTNER WITH KEY PARTNER_FCT = '00000019'.

           WA_SC-ZZSOCOREQ = TXT30.

 

         READ TABLE E_ACCOUNT INTO WA_ACCOUNT INDEX 1 .

         CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'

           IMPORTING

             OWN_LOGICAL_SYSTEM = SYST_ID.

         .

         SELECT  SINGLE RFC_SYS FROM ZLOGICAL_SYS INTO RFC_SYS WHERE OWN_SYS = SYST_ID.

         IF SY-SUBRC = 0.

           CALL FUNCTION 'Z_SRM_PO_INFO' DESTINATION RFC_SYS

             EXPORTING

               BE_OBJECT_ID = WA_SC-BE_OBJECT_ID

               GL_CODE      = WA_ACCOUNT-G_L_ACCT

               COST_CTR     = WA_ACCOUNT-COST_CTR

               FUND         = WA_ACCOUNT-FUNDs_ctr

             IMPORTING

               AEDAT        = WA_SC-AEDAT

               GL_CODE_DES  = WA_SC-GL_CODE_DES

               C_C_D        = WA_SC-C_C_D

               FUND_DES     = WA_SC-FUND_DES.

           .

 

           CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

             EXPORTING

               INPUT         WA_ITEM-ORDERED_PROD

            IMPORTING

              OUTPUT        =    WA_ITEM-ORDERED_PROD

                     .

 

           WA_SC-CREATED_BY = WA_HD-CREATED_BY .

           WA_SC-POSTING_DATE  E_HEADER-POSTING_DATE .

           WA_SC-BE_PUR_GROUP = WA_ITEM-BE_PUR_GROUP .

           WA_SC-BE_PUR_ORG   =   WA_ITEM-BE_PUR_ORG .

           WA_SC-BJECT_ID E_HEADER-OBJECT_ID .

           WA_SC-DESCRIPTION E_HEADER-DESCRIPTION.

           WA_SC-ORDERED_PROD = WA_ITEM-ORDERED_PROD.

           WA_SC-DESCRIPTION1 WA_ITEM-DESCRIPTION.

           WA_SC-QUANTITY     =   WA_ITEM-QUANTITY .

           WA_SC-CTR_HDR_NUMBER =   WA_ITEM-CTR_HDR_NUMBER .

           WA_SC-CTR_ITEM_NUMBER =   WA_ITEM-CTR_ITEM_NUMBER .

           WA_SC-CURRENCY    WA_ITEM-CURRENCY .

           WA_SC-GROSS_PRICE    WA_ITEM-PRICE *  WA_ITEM-QUANTITY.

           WA_SC-ACC_CAT  WA_ACCOUNT-ACC_CAT.

           WA_SC-COST_CTR  = WA_ACCOUNT-COST_CTR.

           WA_SC-ORDER_NO WA_ACCOUNT-ORDER_NO.

           WA_SC-NETWORK  = WA_ACCOUNT-NETWORK.

           WA_SC-ACTIVITY = WA_ACCOUNT-ACTIVITY.

           WA_SC-FUND  WA_ACCOUNT-FUNDs_ctr.

           WA_SC-ZZPRODUCT = WA_ACCOUNT-ZZPRODUCT.

           WA_SC-GL_CODE = WA_ACCOUNT-G_L_ACCT .

           IF  G_L_ACCT IS NOT INITIAL AND COST_CTR IS NOT INITIAL .

             READ TABLE E_ACCOUNT INTO WA_ACCOUNT INDEX 1.

             IF WA_ACCOUNT-G_L_ACCT = G_L_ACCT  AND WA_ACCOUNT-COST_CTR COST_CTR.

 

               APPEND WA_SC TO IT_SC .

                  ENDIF .

           ENDIF .

           IF  G_L_ACCT IS NOT INITIAL AND COST_CTR IS INITIAL .

             READ TABLE E_ACCOUNT INTO WA_ACCOUNT INDEX 1.

             IF WA_ACCOUNT-G_L_ACCT = G_L_ACCT  .

 

               APPEND WA_SC TO IT_SC .

 

 

             ENDIF .

           ENDIF .

           IF  G_L_ACCT IS INITIAL AND COST_CTR IS NOT INITIAL .

             READ TABLE E_ACCOUNT INTO WA_ACCOUNT INDEX 1.

             IF WA_ACCOUNT-COST_CTR = COST_CTR.

 

               APPEND WA_SC TO IT_SC .

 

             ENDIF .

           ENDIF .

           IF  G_L_ACCT IS INITIAL AND COST_CTR IS  INITIAL .

 

             APPEND WA_SC TO IT_SC .

 

 

           ENDIF .

         ENDIF .

       ENDIF .

 

   ENDLOOP .

    ENDLOOP .


Viewing all articles
Browse latest Browse all 8332

Trending Articles



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