Skip to Content
0
Former Member
Jan 10, 2008 at 08:21 AM

Read VBAK records till given date

579 Views

Hi,

How can I improve performance for below statement ?

SELECT VBELN VKORG VTWEG ERDAT

INTO TABLE I_VBAK

FROM VBAK

WHERE ERDAT BETWEEN MIN_ERDAT AND P_ERDAT

AND VKORG IN S_VKORG

AND VTWEG IN S_VTWEG

AND VBTYP IN R_VBTYP.

P_ERDAT would normally contain today's date. It is a user selection. User wants all records till P_ERDAT from VBAK.

MIN_ERDAT : It is derived in program so BETWEEN statement can be used instead of using statement as WHERE ERDAT LE P_ERDAT. It would contain the first record from VBAK table.

Thanks.