Ansicht
Dokumentation

ABENCDS_QUANTITY_FIELD - CDS QUANTITY FIELD

ABENCDS_QUANTITY_FIELD - CDS QUANTITY FIELD

rdisp/max_wprun_time - Maximum work process run time   General Data in Customer Master  
This documentation is copyright by SAP AG.
SAP E-Book

- Quantity Fields

An ABAP CDS quantity field is a component of a CDS entity in ABAP CDS used to store a quantity in a specific unit.

Possible built-in ABAP Dictionary data types are QUAN, DECFLOAT16, DECFLOAT34, DEC, FLTP, INT1, INT2, or INT4. In case of data type QUAN, the field is automatically interpreted as quantity field and a reference to a unit of measurement key using the annotation @Semantics.quantity.unitOfMeasure is mandatory. In case of the other data types, this reference is not mandatory but if used, it turns the field into a quantity field.

A quantity field must be linked with a unit key that defines the unit and the number of decimal places. A unit key is a component of a structure, DDIC database table, DDIC view or of another CDS entity of type UNIT and it can contain a unit ID from the DDIC database table T006.

For handling of CDS quantity 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 - Quantity Fields.

Handling of CDS Quantity Fields in Expressions in CDS View Entities

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

When used in expressions, UNION views, or INTERSECT views, the reference annotation of a CDS quantity field to a unit 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 quantities. Only the target type QUAN requires a reference to a unit key.

The following conversion function is available for quantities in CDS view entities:

  • GET_NUMERIC_VALUE: removes the reference to a unit key and returns the numeric value of a field.

Notes

  • Reference annotations that assign a unit 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 quantity fields in expressions is only available in CDS view entities and not in any other CDS entity.
  • Quantities and units are handled as specified by the data saved in the DDIC database tables T006... in the package SZME. This data can be maintained using the transaction CUNI.





ROGBILLS - Synchronize billing plans   ABAP Short Reference  
This documentation is copyright by SAP AG.

Length: 5431 Date: 20240512 Time: 081002     sap01-206 ( 68 ms )