Hello,
Introduction:
There is a performance problem with VF03. When You provide only BUKRS(company code) and XBLNR (reference)on the selection screen and press Search, then You must wait several minutes before a screen with 1 selected entry pops up. Data are read from table BKPF.
I have implemented the OSS notes 789098 and 964587 so that the database index BKPF_1 is used, but it obviously isn't. I checked it in the SQL Trace.
Index BKPF_1 comprises fields: MANDT, BUKRS, BSTAT, XBLNR.
After having debugged the VF03 I discovered that the data is retrieved in the funcion module F4_GET_RESULT.
I wrote a small program which retrieves data in the same way as the function module and my program uses index and returns data in a flash.
I don't understand why F4_GET_RESULT does not use the index.
<b>How can one make F4_GET_RESULT use it ?</b>
Here's the program:
-
REPORT ZTEST_CURSOR.
DATA: WA_BKPF TYPE BKPF,
IT_BKPF LIKE STANDARD TABLE OF WA_BKPF,
SELTAB(20),
C1 TYPE CURSOR,
CONDITION TYPE STRING.
START-OF-SELECTION.
SELTAB = 'BKPF'.
CONDITION = 'BSTAT = '' '' AND BUKRS = 4005 AND XBLNR LIKE ''0096183992'''.
OPEN CURSOR C1 FOR
SELECT * FROM (SELTAB)
WHERE (CONDITION)
%_HINTS ORACLE 'first_rows' DB6 'OPT_FOR_ROWS 1'.
END-OF-SELECTION.
FETCH NEXT CURSOR C1 INTO table it_BKPF.
loop at it_bkpf into wa_bkpf.
write:/ wa_bkpf-xblnr, wa_bkpf-bukrs.
endloop.