Skip to Content

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

SQL- Performance With VBAP table

Hi Guys,

I have a query on table VBAP which fetches data based on date-time stamp and few other fields. Date-tme fields are always filled. If no plant is additionally entered, query runs for about 20 minutes. However, when user enters a plant, query runs for ever (Last run took about 16 hours). I tried tweaking the "where clause" a bit with no sign of improved performance. I really don't understand why should plant mess with the index.

Your replies are appreciated.

Thanks

Yogi

SELECT bvbeln bposnr buepos bmatnr bwerks bmeins b~objnr

berdat cwebaz cplifz efabkl e~pipatg

INTO TABLE pt_order

FROM vbak AS a

INNER JOIN vbap AS b

ON avbeln = bvbeln

INNER JOIN marc AS c

ON bmatnr = cmatnr AND

bwerks = cwerks

INNER JOIN vbuk AS d

ON avbeln = dvbeln

INNER JOIN tvst AS e

ON bvstel = evstel

WHERE a~vkorg IN s_vkorg

AND a~auart IN s_auart

AND ( ( ( berdat LT s_erdat-high ) OR ( berdat EQ s_erdat-high

AND b~erzet LE p_totim ) )

AND ( ( berdat GT s_erdat-low ) OR ( berdat EQ s_erdat-low

AND b~erzet GE p_frtim ) ) )

AND b~werks IN s_werks

AND b~abgru IN s_abgru

AND c~mtvfp IN s_mtvfp

AND d~cmgst IN s_cmgst.

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