이것도 매번 들어가서 일일이 보려면 혈압오름
SELECT A.MATNR,
A.WERKS,
A.PLNNR,
A.PLNAL,
C.IDNRK,
C.POSNR,
C.SORTF,
B.RGEKZ
FROM MAPL as A
JOIN PLMZ as B
ON A.PLNTY = B.PLNTY
AND A.PLNNR = B.PLNNR
AND A.PLNAL = B.PLNAL
JOIN STAS AS D
on B.STLTY = D.STLTY
AND B.STLNR = D.STLNR
AND B.STLAL = D.STLAL
AND B.STLKN = D.STLKN
JOIN STPO AS C
ON D.STLTY = C.STLTY
AND D.STLNR = C.STLNR
AND D.STLKN = C.STLKN
WHERE A.LOEKZ = ' '
AND B.LOEKZ = ' '
AND C.LKENZ = ' '
AND D.LKENZ = ' '
AND A.MATNR = 'MATNR'
AND A.WERKS = 'XXXX'
AND A.PLNAL = ALNAL
AND B.STLAL = '05'