取表日期数据时应加上,否则取不到数据
L_DATE NE '00000000' and L_DATE NE ''
如下SQL:
SELECT TVKO~BUKRS
LIKP~WADAT_IST
LIKP~LFART
VBAK~AUART
VBFA~VBELV AS VBELN_VA " 10*
LIPS~VGBEL AS VBELN_CA " 41*
LIKP~VBELN AS VBELN_VL " 42*
LIKP~VKORG
LIPS~VTWEG
LIPS~SPART
LIKP~VKBUR
LIPS~VKGRP
LIKP~KUNAG AS KUNNR
LIPS~WERKS
LIPS~LGORT
LIPS~MATNR
LIPS~LFIMG
LIPS~VRKME AS VRKME_VL
VBAP~KWMENG AS KWMENG_CA
VBAP~VRKME AS VRKME_CA
INTO TABLE LT_VL02_1
FROM LIKP INNER JOIN LIPS ON LIKP~VBELN = LIPS~VBELN
INNER JOIN VBAK ON LIPS~VGBEL = VBAK~VBELN
INNER JOIN VBAP ON VBAK~VBELN = VBAP~VBELN
INNER JOIN VBFA ON VBAK~VBELN = VBFA~VBELN
INNER JOIN TVKO ON VBAK~VKORG = TVKO~VKORG
WHERE LIKP~MANDT = SY-MANDT
AND ( LIKP~WADAT_IST NE '00000000' AND LIKP~WADAT_IST NE '' )
AND TVKO~BUKRS IN LR_BUKRS
AND LIKP~VKORG IN IT_VKORG
AND LIKP~VKBUR IN IT_VKBUR
AND VBFA~VBTYP_N = 'C' AND VBFA~POSNV NE '000000' .