Skip to Content
0
Former Member
Oct 23, 2006 at 06:05 PM

Help with INNER JOIN

245 Views

Hi All,

The following statement takes quite a long time to run. Any suggestions how it can be fine tuned.

SELECT MSEGWERKS MSEGBWART MKPFBUDAT MKPFBLDAT

MKPFBKTXT MKPFMBLNR MSEGGRUND MSEGLGORT

MSEGMATNR MSEGMENGE MSEGUMLGO MSEGSGTXT

MSEGCHARG T156TBTEXT T001WSPRAS MSEGCHARG

MSEGSHKZG MKPFCPUTM

INTO TABLE T_OUTPUT

FROM MKPF

INNER JOIN MSEG

ON MKPFMBLNR = MSEGMBLNR

AND MKPFMJAHR = MSEGMJAHR

INNER JOIN T001W

ON MSEGWERKS = T001WWERKS

INNER JOIN T156T

ON MSEGBWART = T156TBWART

AND MSEGSOBKZ = T156TSOBKZ

AND MSEGKZBEW = T156TKZBEW

AND MSEGKZZUG = T156TKZZUG

AND MSEGKZVBR = T156TKZVBR

WHERE MKPF~BUDAT IN S_BUDAT

AND MSEG~WERKS EQ P_WERKS

AND MSEG~XAUTO NE 'X'

AND MSEG~BWART IN S_BWART

AND MSEG~MATNR IN S_MATNR

AND T156T~SPRAS EQ SY-LANGU.

Regards

Brain