2023 May 29 10:22 AM
Hello,
I'd like to use this function in infoset (SQ02) but I donesn't worke here is the code :
DATA:
BEGIN OF ls_test,
vbeln TYPE vbap-vbeln ,
posnr TYPE vbap-posnr ,
parvw_EN TYPE vbpa-parvw,
parvw_ZF TYPE vbpa-parvw,
END OF ls_test.
SELECT vbap~*,
COALESCE(( SELECT SINGLE posnr
FROM vbpa AS v
WHERE v~posnr = vbap~posnr
AND v~posnr <> '' ),
( SELECT SINGLE posnr
FROM vbpa AS v
WHERE v~posnr = '' )
) AS tag
INTO TABLE lt_result
FROM vbap.
Error:
This Open SQL statement uses additions that can only be used when the
fixed point arithmetic flag is activated (such as CASE expressions or host variables in
thank you in advance
2023 May 29 11:10 AM
I can only answer from a pure technical view:
COALESCE Returns the first not null value. Please keep. In Kind the difference between null and initial in ABAP (or the absence of null). So I assume that the subqueries are evaluated, Transporte back to the ABAP layer where they become initial values. Therefor it is always the first value that is returned.
Better:
Don't use subqueries but left outer joins. If you give them an alias you can join the same table multiple times. With a left outer join the whole query is executed as one and null values are possible. Then you can use COALESCE as intendend.
Best regards
Michael