Skip to Content
-2

Converting date field to text field

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?

Add comment
10|10000 characters needed characters exceeded

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

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

  • Get RSS Feed

2 Answers

  • 6 days ago

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

    Add comment
    10|10000 characters needed characters exceeded

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

  • 6 days ago

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

    DEMO_SQL_EXPR_COALESCE

    Add comment
    10|10000 characters needed characters exceeded