I created custom index 004 on GLPCA table for fields RYEAR, POPER, RBUKRS, RACCT, BUDAT, KOSTL, AUFNR and LIFNR. But, when I run my report, my select statement which has GLPCA fields is running for ever. My doubt is that I really appreciate if someone could point me in right direction.
Below is my select statement:
*Use dirty trick to mislead DB-optimizer
CALL FUNCTION 'DB_DO_NOT_USE_CLIENT_INDEX'
VALUE = SY-MANDT
MANDTTAB = R_RCLNT.
SELECT RLDNR RRCTY RVERS RBUKRS RPRCTR
KOKRS RACCT ACTIV HSL BLART FROM GLPCA
INTO TABLE GT_FINAL
WHERE RCLNT IN R_RCLNT
AND RRCTY IN S_RRCTY AND RVERS EQ P_RVERS AND RYEAR EQ P_RYEAR AND POPER IN S_POPER
AND RBUKRS EQ P_RBUKRS
AND RPRCTR IN S_RPRCTR AND KOKRS EQ P_KOKRS
AND RACCT IN S_RACCT.
IF SY-SUBRC = 0.
SORT GT_FINAL BY RACCT RPRCTR BLART ACTIV HSL ASCENDING.
LOOP AT GT_FINAL INTO WA_FINAL.
COLLECT WA_FINAL INTO GT_FINAL1.
DELETE GT_FINAL1 WHERE HSL EQ 0.
Hi nani G,
I am not sure about the "dirty trick" function. Seems to be outdated and of little use (try it without?). May I suggest you run your report through SE30 and see if it is really database access that is causing the long runs. Also, look at your conditions (you have alot) of the select and make sure there are no redundancies or conditions that are not needed to get you your results. Finally, consider using a hash table if there are ALOT of entries. However you will be limited with what you can do with the hash table.