SELECT A~WERKS
B~AUFNR "오더번호
B~MATNR "제품코드
SUM( B~MENGE ) AS MENGE "생산수량
SUM( B~ERFMG ) AS ERFMG "생산수량
B~MEINS "단위
B~ERFME "생산단위
B~BWART "이동유형
INTO CORRESPONDING FIELDS OF TABLE GT_PRODRESULT
FROM MARC AS A
INNER JOIN AUFM AS B
ON A~MATNR = B~MATNR
AND A~WERKS = B~WERKS
WHERE B~WERKS = P_WERKS
AND A~DISPO = P_DISPO
AND B~BUDAT IN S_BUDAT1
AND B~MATNR IN S_MATNR1
AND B~AUFNR IN S_AUFNR1
AND B~BWART IN (101, 102)
GROUP BY B~AUFNR B~MATNR B~MEINS B~ERFME B~BWART A~WERKS.
이 부분중 GT_PRODRESULT가
MAKTX 와 NAME1 데이터를 가지고 있어서
합치려고 하는데 어떻게 해야할지 모르겠습니다,. ㅠㅠ
SELECT SINGLE MAKTX
INTO GT_pqty-MAKTX
FROM MAKT
WHERE MATNR = GT_PRODRESULT-MATNR.
SELECT SINGLE NAME1
INTO GT_pqty-NAME1
FROM T001W
WHERE WERKS = GT_PRODRESULT-WERKS.
어떻게 합치면 되나요
부탁드립니다. single 부분을 위의 select문으로 합치고 싶습니다.
보니까 자재 내역과 플랜트 이름을 알고자 함이겠는데..
그렇다면 처음 Select 문에서 Join으로 하시면 되겠네요..
아래 두 Select 문을 처음의 Select문과 Join하면되겠습니다.
B~AUFNR "오더번호
B~MATNR "제품코드
SUM( B~MENGE ) AS MENGE "생산수량
SUM( B~ERFMG ) AS ERFMG "생산수량
B~MEINS "단위
B~ERFME "생산단위
B~BWART "이동유형
INTO CORRESPONDING FIELDS OF TABLE GT_PRODRESULT
FROM MARC AS A
INNER JOIN AUFM AS B
ON A~MATNR = B~MATNR
AND A~WERKS = B~WERKS
inner join makt as c
on a~matnr = c~matnr
and c~spras = sy-langu
inner join t001w as d
on d~werks = a~werks
and d~spras = sy-langu
WHERE B~WERKS = P_WERKS
AND A~DISPO = P_DISPO
AND B~BUDAT IN S_BUDAT1
AND B~MATNR IN S_MATNR1
AND B~AUFNR IN S_AUFNR1
AND B~BWART IN (101, 102)
GROUP BY B~AUFNR B~MATNR B~MEINS B~ERFME B~BWART A~WERKS.