Skip to Content
avatar image
-1
Former Member

adding new column based on condition in CDS view

I have a requirement to create a column based on the condition as mentioned in the screenshot below.

is it possible to achieve it via CDS view ?

Example:

cds-example.png

cds-example.png (7.3 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • May 21 at 09:05 AM

    Hi Saravanan,

    check out the case statement to create two separate columns in your view, some very simple and quick idea would be:

    case

    when type ='X' then

    date

    else

    blank

    end

    as x_date

    ---------------

    case

    when type ='Y' then

    date

    else

    blank

    end

    as y_column

    See also the SAP Online Help sample:

    https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abencds_f1_searched_case_expr.htm

    Cheers,

    Nora

    Add comment
    10|10000 characters needed characters exceeded