tables: spfli.
DATA: ls_spfli TYPE SPFLI.
DATA: LS_LINE(80) OCCURS 0 WITH HEADER LINE.
CONCATENATE 'carrid in (''AA'',' '''AZ'')' INTO LS_LINE.
APPEND LS_LINE.
CONCATENATE ' or carrid in (''LH'',' '''AZ'')' INTO LS_LINE.
APPEND LS_LINE.
clear ls_line.
write:LS_LINE.
select * from spfli into ls_spfli
where (ls_line).
write: / ls_spfli-carrid.
ENDSELECT.
image.png
法2:
DATA:gs_line(100) TYPE c.
CONCATENATE gs_line 'a~werks = p_werks' INTO gs_line.
IF s_lgort IS NOT INITIAL.
CONCATENATE gs_line 'AND a~lgort = s_lgort' INTO gs_line.
ENDIF.
IF s_mblnr IS NOT INITIAL.
CONCATENATE gs_line 'AND a~mblnr = s_mblnr' INTO gs_line.
ENDIF.
IF s_bldat-low IS NOT INITIAL OR s_bldat-high IS NOT INITIAL.
CONCATENATE gs_line 'AND b~bldat in s_bldat' INTO gs_line.
ENDIF.
IF s_umlgo IS NOT INITIAL.
CONCATENATE gs_line 'AND a~lumlgo = s_umlgo' INTO gs_line.
ENDIF.
IF s_kostl IS NOT INITIAL.
CONCATENATE gs_line 'AND a~umlgo = s_kostl' INTO gs_line.
ENDIF.
IF s_aufnr IS NOT INITIAL.
CONCATENATE gs_line 'AND a~umlgo = s_aufnr' INTO gs_line.
ENDIF.
IF s_matnr IS NOT INITIAL.
CONCATENATE gs_line 'AND a~matnr = s_matnr' INTO gs_line.
ENDIF.
IF s_bwart IS NOT INITIAL.
CONCATENATE gs_line 'AND a~bwart = s_bwart' INTO gs_line.
ENDIF.
REFRESH gt_itab.
SELECT a~werks
a~lgort
a~mblnr
b~bldat
a~umlgo
a~kostl
a~aufnr
a~matnr
a~bwart
*zkomm TYPE - ,"领料部门
*TYPE - ,"业务类型
b~budat
a~charg
a~meins
a~menge
a~sgtxt
a~shkzg
FROM mseg AS a
INNER JOIN mkpf AS b
ON a~mblnr = b~mblnr AND a~mjahr = b~mjahr
INTO CORRESPONDING FIELDS OF TABLE gt_itab
WHERE (gs_line) and ( ( a~bwart in ('311','312','301','302') and a~lgort not like '6*' and a~umlgo = '' )
or ( a~bwart in ('201','202','543','544','551','552','Z03','Z04','Z05','Z06','Z11','Z12','Z15','Z16') and a~lgort not like '6*' ) ).
网友评论