SELECT a~bdter AS bdter
a~rsnum AS rsnum
a~rspos AS rspos
a~bdmng AS bdmng
a~enmng AS enmng
a~werks AS werks
a~lgort AS lgort
a~umwrk AS umwrk
a~umlgo AS umlgo
a~wempf AS wempf
INTO CORRESPONDING FIELDS OF TABLE it_resb
FROM resb AS a
WHERE a~bwart = '301'
AND a~bdter < '20071001'
AND a~xloek = ''
AND a~xwaok = 'X'
AND a~kzear = ''
AND a~bdmng > ( SELECT b~enmng
FROM resb AS b
WHERE b~rsnum = a~rsnum
AND b~rspos = a~rspos ).
SELECT SUM( a~cnt ) INTO e_count
FROM ztable1 AS a
WHERE a~hq_cd = i_hq_cd
AND a~matnr = i_matnr
AND a~proc_day IN ( SELECT MAX( b~proc_day )
FROM ztable1 AS b
WHERE b~hq_cd = a~hq_cd
AND b~matnr = a~matnr
AND b~hq_cd = i_hq_cd
AND b~matnr = i_matnr
AND b~yyyymm = i_month ).
SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_bsak
FROM bsak
WHERE bukrs = pa_bukrs
AND umskz = 'W'
AND rebzg = space
AND augdt IN so_valut
AND blart IN pa_blart
AND EXISTS ( SELECT * FROM bkpf
WHERE bukrs = bsak~bukrs
AND belnr = bsak~belnr
AND gjahr = bsak~gjahr
AND stblg = space ).
SELECT COUNT(*) INTO l_value
FROM ztable1 AS a
WHERE a~cver1 = l_cver1
AND a~yyyymm = p_begda(6)
AND a~bcode IN ('0011', '0012')
AND EXISTS ( SELECT order_no
FROM ztable2
WHERE cver1 = l_cver1
AND yyyymm < p_begda(6)
AND order_no = a~order_no
AND sale_id IN ('0001', '0002', '0003', '0004')
AND canc3_yn <> 'Y' )
AND a~pernr IN pr_pernr.
DATA itab LIKE zlet0319 OCCURS 0 WITH HEADER LINE.
SELECT * FROM zlet0319
INTO CORRESPONDING FIELDS OF TABLE itab
WHERE matnr = ( SELECT matnr FROM mara
WHERE matnr = zlet0319~matnr ).
감사합니다