公共amdp 接口声明
PUBLIC SECTION.
INTERFACES if_amdp_marker_hdb.
METHOD get_039_data BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT
OPTIONS READ-ONLY USING zmm1000t039 marc t024 makt lfa1 eina MSEG mkpf zasnitem .
lt_039 = SELECT DISTINCT a.*,CAST( A.menge AS CHAR( 20 ) ) AS menge01,CAST( A.menge1 AS CHAR( 20 ) ) AS menge02, CAST( A.zzhgx AS CHAR( 20 ) ) AS menge03,--CAST( A.zxtylzd3 AS NUMBER( 12 ) ) AS zsrmnoh,
c.name1,b.maktx,d.ekgrp,g.eknam,e.idnlf ,CASE WHEN I.werks <> ' ' THEN I.werks ELSE f.werks END AS werks
FROM zmm1000t039 AS a
INNER JOIN marc AS d ON d.MANDT = A.MANDT AND a.matnr = d.matnr AND d.werks = '1000'
LEFT JOIN t024 AS g ON d.MANDT = g.MANDT AND d.ekgrp = g.ekgrp
LEFT JOIN makt AS b ON b.MANDT = a.MANDT AND a.matnr = b.matnr
LEFT JOIN lfa1 AS c ON c.MANDT = a.MANDT AND a.lifnr = c.lifnr
LEFT JOIN eina AS e ON e.MANDT = a.MANDT AND a.lifnr = e.lifnr AND a.matnr = e.matnr
LEFT JOIN mkpf AS H ON H.MANDT = A.MANDT AND A.zsrmno1 = H.FRBNR
LEFT JOIN MSEG AS I ON I.MANDT = A.MANDT AND I.MBLNR = H.MBLNR AND I.MJAHR = H.MBLNR
LEFT JOIN zasnitem AS f ON F.MANDT = A.MANDT AND a.zsrmno1 = f.stno
WHERE A.MANDT = SESSION_CONTEXT('CLIENT')
AND a.zsrmno1 LIKE 'ASN%'
UNION ALL
SELECT DISTINCT a.*,CAST( A.menge AS CHAR( 20 ) ) AS menge01,CAST( A.menge1 AS CHAR( 20 ) ) AS menge02, CAST( A.zzhgx AS CHAR( 20 ) ) AS menge03,--CAST( A.zxtylzd3 AS NUMBER( 12 ) ) AS zsrmnoh,
c.name1,b.maktx,d.ekgrp,g.eknam,e.idnlf ,h.werks
FROM zmm1000t039 AS a
INNER JOIN marc AS d ON d.MANDT = A.MANDT AND a.matnr = d.matnr AND d.werks = '1000'
LEFT JOIN t024 AS g ON d.MANDT = g.MANDT AND d.ekgrp = g.ekgrp
LEFT JOIN makt AS b ON b.MANDT = a.MANDT AND a.matnr = b.matnr
LEFT JOIN lfa1 AS c ON c.MANDT = a.MANDT AND a.lifnr = c.lifnr
LEFT JOIN eina AS e ON e.MANDT = a.MANDT AND a.lifnr = e.lifnr AND a.matnr = e.matnr
LEFT JOIN MSEG AS h ON h.MANDT = A.MANDT AND SUBSTRING( A.ZSRMNO1,1,10 ) = h.MBLNR AND SUBSTRING( A.ZSRMNO1,12,4 ) = h.MJAHR
WHERE A.MANDT = SESSION_CONTEXT('CLIENT')
AND a.zsrmno1 NOT LIKE 'ASN%'
AND a.zsrmno1 IS NOT NULL;
et_039 = APPLY_FILTER(:lt_039, :IV_COND );
ENDMETHOD.