01-11-2019 5:11 AM
i have a query where in date field is populated from a table. and if the condition is failed. i.e if there is no entry for the date. it should display as 'N/A'.
how can i achieve this?
01-11-2019 8:10 AM
you can easily achieve this using new ABAP syntax. Check below sample code.
SPAN { font-family: "Courier New"; font-size: 10pt; color: #000000; background: #FFFFFF; } .L0S32 { color: #3399FF; } .L0S33 { color: #4DA619; } .L0S52 { color: #0000FF; } .L0S55 { color: #800080; } .L0S70 { color: #808080; }
SELECT matnr,
CASE
WHEN ersda = @space
THEN 'N/A'
WHEN ersda <> @space
THEN ersda
END as date
INTO @data(li_mara)
UP TO 10 ROWS
FROM mara.
ENDSELECT.
cl_demo_output=>display( li_mara ).
01-11-2019 8:29 AM
Okay, it’s helpful, but you know how version he is using? Your statements a only can be use in SAP_ABA >= 7.4 SP 5.
01-11-2019 8:15 AM
use function coalesce you can achive it. take a look at program:
DEMO_SQL_EXPR_COALESCE
01-11-2019 8:26 AM
First to all, always remember to put your SAP_ABA kernel version, it’s helps to others to give to you the better solutions, okay? 😉
Br,
Pacheco.
01-11-2019 4:53 PM
Guys seem to understand your question, but my opinion is that it's much too broad to answer precisely. Please give more details!