Skip to Content
avatar image
Former Member

Currency reference in ABAP CDS

Hi Experts,

There is an existing table in ABAP DDIC . The table has a amount field for which the reference table is a structure and the field is from that structure.

Currently i'm creating a CDS view which this custom table and I need the amount field. In this case how can i give the currency key reference using semantics in the ABAP CDS.

Because the table doesnt have currency key field and reference table and refernce currency key field is from structure in ABAP DDIC.

Please advice

Regards Anand

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Mar 02, 2017 at 07:58 AM

    You use the @Semantics.currencyCode annotation for that.

    Add comment
    10|10000 characters needed characters exceeded

    • I was searching SCN for the same issue and this is how I have managed to handle a table which doesn't have a currency field.

      We created a default currency column in the view as follows:

            @Semantics.currencyCode
            cast ('USD' as abap.cuky) as CurrencyCode,
            @Semantics.amount.currencyCode: 'CurrencyCode'     
            zsflight.price as price,
      

      This will work if your organization is using single currency, the ideal fix would be to add currency code field to your Z table.

      Thanks,

      Kabir