Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Converting date field to text field

0 Kudos

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?

5 REPLIES 5

jitendra_it
Active Contributor

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 ).

0 Kudos

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.

DoanManhQuynh
Active Contributor
0 Kudos

use function coalesce you can achive it. take a look at program:

DEMO_SQL_EXPR_COALESCE

raphael_almeida
Active Contributor
0 Kudos

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.

Sandra_Rossi
Active Contributor
0 Kudos

Guys seem to understand your question, but my opinion is that it's much too broad to answer precisely. Please give more details!