• The addition FOR ALL ENTRIES cannot be combined with SQL expressions.
• The addition FOR ALL ENTRIES should not be used with the addition GROUP BY.
From <https://help.sap.com/doc/abapdocu_752_index_htm/7.52/en-US/abenwhere_logexp_itab.htm>
"With ABAP 7.50, you can also define GTTs in the ABAP Dictionary by setting the Table Category to Global Temporary Table."
From <https://blogs.sap.com/2015/11/18/abap-news-for-release-750-insert-from-subquery-and-gtts/>
TYPES:
BEGIN OF ty_s_mdua_fae,
matnr TYPE matnr,
reswk TYPE werks_d,
werks TYPE werks_d,
END OF ty_s_mdua_fae,
ty_t_mdua_fae TYPE SORTED TABLE OF ty_s_mdua_fae
WITH NON-UNIQUE KEY matnr reswk werks.
DATA(tl_mdua_fae) = VALUE ty_t_mdua_fae(
FOR <fs_z06503801> IN t_z06503801
( matnr = <fs_z06503801>-matnr_new
reswk = <fs_z06503801>-werksup_new
werks = <fs_z06503801>-werks_new ) ).
IF tl_mdua_fae[] IS NOT INITIAL.
DELETE ADJACENT DUPLICATES FROM tl_mdua_fae COMPARING matnr reswk werks.
INSERT z06503802_mdua FROM TABLE @tl_mdua_fae.
SELECT DISTINCT
m~matnr, m~reswk, m~banfn, m~bnfpo,
m~menge, m~bsmng, m~meins, m~lfdat,
coalesce( y~werks, m~reswk ) AS werks,
coalesce( y~spwoc, @week ) AS spwoc,
coalesce( y~statu, @c_producao ) AS statu,
coalesce( y~recpc, @space ) AS recpc,
coalesce( y~dtrpc, @l_dtrpc ) AS dtrpc,
CASE WHEN y~recpc IS NULL THEN @abap_true
ELSE @abap_false
END AS flag,
menge - bsmng AS saldo
FROM z06503802_mdua AS z
JOIN mdua AS m ON m~matnr EQ z~matnr
AND m~reswk EQ z~reswk
AND m~werks EQ z~werks
LEFT JOIN zsd0254 AS y ON y~banfn EQ m~banfn
AND y~bnfpo EQ m~bnfpo
AND y~matnr EQ m~matnr
WHERE m~pstyp EQ @c_transf_estoque
AND m~knttp EQ @space
GROUP BY m~matnr, m~reswk, m~banfn, m~bnfpo,
m~menge, m~bsmng, m~meins, m~lfdat, y~werks,
y~spwoc, y~statu, y~recpc, y~dtrpc
HAVING m~menge > m~bsmng
INTO TABLE @t_mdua.
DELETE FROM z06503802_mdua.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |