Ansicht
Dokumentation

ABENCDS_AMOUNT_FIELD - CDS AMOUNT FIELD

ABENCDS_AMOUNT_FIELD - CDS AMOUNT FIELD

SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up   CL_GUI_FRONTEND_SERVICES - Frontend Services  
This documentation is copyright by SAP AG.
SAP E-Book

- Amount Fields

An ABAP CDS amount field is a component of a CDS entity in ABAP CDS used to store an amount in a specific currency. An amount is an integer in the smallest unit of the currency. The integer is constructed from all figures in an amount field while ignoring the position of the decimal separator.

Possible built-in DDIC data types are CURR, DECFLOAT34, DEC, and FLTP. In case of data type CURR, a field is automatically interpreted as amount field and a reference to a currency key using the annotation @Semantics.amount.currencyCode is mandatory. In case of the other data types, this reference is not mandatory but if used, it turns the field into an amount field.

A CDS amount field must be linked with a currency key that specifies the currency and the number of decimal places. A currency key is a component of a DDIC structure, DDIC database table, DDIC view, or of a CDS entity which has the type CUKY, and can contain a currency ID from the DDIC database table TCURC.

By default, the number of decimal places for an amount is always two. Currencies with a different number of decimal places must also be entered in the table TCURX, where the number of decimal places can be defined explicitly.

For handling of CDS amount fields in ABAP Dictionary, handling in dynpros, and handling in ABAP programs, the same rules apply as for currency fields in DDIC, see topic ABAP DDIC - Currency Fields.

Handling of CDS Amount Fields in Expressions in CDS View Entities

In CDS view entities, special handling for CDS amount fields is implemented:

When used in expressions, UNION views, or INTERSECT views, the reference annotation of a CDS amount field to a currency key is considered. Special rules apply concerning how amounts and quantities can be combined in calculations, compatibility of data types, and result types. A new result type is available: the CDS calculated quantity. The rules are documented in the respective sections:

Cast expressions do not handle amounts. Only the target type CURR requires a reference to a currency key.

The following two conversion functions are available for amounts in CDS view entities:

  • GET_NUMERIC_VALUE: removes the reference to a currency key and returns the numeric value of a field.
  • The function DECIMAL_SHIFT is not available in CDS view entities.

Notes

  • Reference annotations that assign a currency key to a field are propagated in CDS entities selecting from DDIC database tables or other CDS entities. It is possible, but not mandatory, to redefine them. This is true for all CDS entities except for CDS DDIC-based views.
  • Currently, the handling of CDS amount fields in expressions is only available in CDS view entities and not in any other CDS entity.
  • Currencies are handled as specified by the data saved in the database tables TCUR... of the package SFIB. The exchange rates and other settings can be maintained in transaction OB08.





Vendor Master (General Section)   General Data in Customer Master  
This documentation is copyright by SAP AG.

Length: 6469 Date: 20240512 Time: 004900     sap01-206 ( 84 ms )