Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Performace Improve

Hello All,

Could you please have a look at the below given code and provide pointers on improving the performance

    LOOP AT X_ZZXG1A .
      IF  X_ZZXG1A-DRCRK   EQ   'H'.   "credit
**  find a table entry with same posting date and document *   no. and the credit account no. and credit amount not
*   yet populated
        READ TABLE T_LG WITH KEY BUDAT  =   X_ZZXG1A-BUDAT
                             DOCNR  =   X_ZZXG1A-DOCNR
                             RACCT_CR  =   SPACE
                             CR        =   0
                             DOCLN     =   X_ZZXG1A-DOCLN.
        IF SY-SUBRC EQ 0.
          T_LG-RACCT_CR  =    X_ZZXG1A-RACCT.
          T_LG-CR        =    X_ZZXG1A-HSL  * -1.
          T_LG-DOCLN     =    X_ZZXG1A-DOCLN.               
          APPEND T_LG.
        ELSE.
**  if no valid table entry exists in T_LG, add a new 
*   entry
          CLEAR  T_LG.
          MOVE-CORRESPONDING X_ZZXG1A TO T_LG.
          T_LG-RACCT_CR     =    X_ZZXG1A-RACCT.
          T_LG-CR =    X_ZZXG1A-HSL  * -1.
          APPEND T_LG.
        ENDIF.

      ELSEIF X_ZZXG1A-DRCRK EQ  'S'.   "debit
**  find a table entry with same posting date and document
*   no. and
*   the debit account no. and debit amount not yet 
*   populated
     READ TABLE T_LG WITH KEY BUDAT     =   X_ZZXG1A-BUDAT
                       DOCNR     =   X_ZZXG1A-DOCNR
                       RACCT_DR  =   SPACE
                       DR        =   0
                       DOCLN     =  X_ZZXG1A-DOCLN.
        IF SY-SUBRC EQ 0.
          T_LG-RACCT_DR  =    X_ZZXG1A-RACCT.
          T_LG-DR        =    X_ZZXG1A-HSL.
*          t_lg-docln     =    x_zzxg1a-docln.
          APPEND T_LG.
        ELSE.
**  if no valid table entry exists, add a new entry
          CLEAR  T_LG.
          MOVE-CORRESPONDING X_ZZXG1A TO T_LG.
          T_LG-RACCT_DR     =    X_ZZXG1A-RACCT.
          T_LG-DR           =    X_ZZXG1A-HSL.
          T_LG-DOCLN        =    X_ZZXG1A-DOCLN.            "4703886
          APPEND T_LG.
        ENDIF.
      ENDIF.
    ENDLOOP.

Currently the output of this LOOP and ENDLOOP is 2,65,000 records and the report is failing at this point with the message 'SYSTEM_CANCELED'.

Any pointers on improving this would be of great help.

Regards,

- PSK

Tags:
Not what you were looking for? View more on this topic or Ask a question