a month ago
Hi,
As per my requirement i fetched multiple Queries, but while preparing final Internal table.
Taking lot of time. One Scenario having 10 Days having 19k Records. Any possible way I Can improve the performance.
* SORT lt_cdpos BY changenr.
* SORT lt_user_addr BY bname.
* SORT lt_usr21 BY bname.
* SORT lt_adr6 BY persnumber.
LOOP AT lt_cdhdr ASSIGNING FIELD-SYMBOL(<ls_cdhdr>).
READ TABLE lt_cdpos WITH KEY changenr = <ls_cdhdr>-changenr ASSIGNING FIELD-SYMBOL(<ls_cdpos>).
IF sy-subrc = 0.
READ TABLE lt_user_addr WITH KEY bname = <ls_cdhdr>-username ASSIGNING FIELD-SYMBOL(<ls_user_addr>).
IF sy-subrc = 0.
READ TABLE lt_usr21 WITH KEY bname = <ls_user_addr>-bname ASSIGNING FIELD-SYMBOL(<ls_usr21>).
IF sy-subrc = 0.
READ TABLE lt_adr6 WITH KEY persnumber = <ls_usr21>-persnumber ASSIGNING FIELD-SYMBOL(<ls_adr6>).
ENDIF.
ENDIF.
ENDIF.
APPEND VALUE #( uname = <ls_cdhdr>-username
udate = <ls_cdhdr>-udate
utime = <ls_cdhdr>-utime
tcode = <ls_cdhdr>-tcode
Objvale = <ls_cdhdr>-objectid
tabname = <ls_cdpos>-tabname
fname = <ls_cdpos>-fname
valueold = <ls_cdpos>-value_old
valuenew = <ls_cdpos>-value_new
fstname = <ls_user_addr>-name_first
lstname = <ls_user_addr>-name_last
email = <ls_adr6>-smtp_addr ) TO rt_output.
ENDLOOP.
a month ago - last edited a month ago
Make sure you are using sorted/hashed tables with appropriate keys or BINARY SEARCH.
a month ago
Hello @AadivaramAbbulu
You really should have shared the entire code especially the declarations of the internal tables and have the source code correctly formatted. Without internal tables declarations it's all but impossible to tell how READs are executed.
As the first try add BINARY SEARCH to READs as @Ryan-Crosby advised.
Best regards
Dominik Tylczynski
a month ago
4 weeks ago
Hi @AadivaramAbbulu , I suggest write a CDS for the tables and fields required - CDHDR , CDPOS , USR21 , ADR6 . use appropriate joins to fetch all fields required and then use it in your report. It will improve the performance of the report rather than using loops and read statement and appending.