‎2021 Feb 17 11:32 AM
Hi team,
please let me know the new syntax for below code.
LOOP AT IT_BSID ASSIGNING FIELD-SYMBOL(<FS_BSID>).
IF <FS_BSID>-VBELN IS INITIAL.
<FS_BSID>-VBELN = <FS_BSID>-XBLNR.
ENDIF.
ENDLOOP.
‎2021 Feb 17 12:29 PM
What did you expect as "New syntax" ?
LOOP AT IT_BSID
REFENCE INTO DATA(o_bsid_line).
o_bsid_line->vbeln = COND #( WHEN o_bsid_line->vbeln IS INITIAL
THEN o_bsid_line->xblnr
ELSE o_bsid_line->vbleln ).
ENDLOOP.
‎2021 Feb 17 12:34 PM
Hi frdric.girod
am expecting with this new syntax
LT_BSID = VALUE #( FOR WA_BSID IN IT_BSID
* WHERE ( VBELN = WA_BSID-XBLNR ) ).
how to check vbeln is initial
don't want to use loop statement .
‎2021 Feb 17 12:43 PM
Or something like this?
* Return only the data where PROFIT_CENTER has been found
[new_table] = VALUE #( FOR data
IN [old_table]
WHERE ( profit_center IS NOT INITIAL )
( document_date = data-document_date
* ..
)
).
‎2021 Feb 17 12:53 PM
‎2021 Feb 17 1:04 PM
Easiest would be to use COALESCE in the corresponding SQL statement in that case I think.
But I guess you could try something like this (see this blog for details on COND & SWITCH)
[table] = VALUE #( FOR data
IN [table]
( vbeln = COND #( WHEN data-vbeln IS INITIAL THEN data-xblnr
ELSE data-vbeln
)
)
).