cancel
Showing results for 
Search instead for 
Did you mean: 

OData service for retrieving units of measure in SAP S/4HANA CLOUD

tudor_teoteoi
Explorer
0 Kudos
366

Dear Experts,

I have a BTP Node.js based application, that is reading measurement documents from S4H ABAP on Cloud via the OData interface documented here: Overview | Measurement Document | SAP Business Accelerator Hub.

I would also need the numerator/denominator for conversion to SI Unit of the UoM inside each measurement document.

Any such (ideally OData) service existing for S4H ABAP on Cloud?

I could find one beta service https://api.sap.com/api/SIA_UnitOfMeasure/overview, but it seems to be suitable for BTP ABAP.

Kind Regards,

Tudor

View Entire Topic
tudor_teoteoi
Explorer
0 Kudos

Some time ago I found that currency and unit-of-measure information is offered by all OData V4 services, which are provided as a "service group", which includes a "common" node for the above and the main node with actual information.

Let's consider this V4 service for retrieval of measurement documents.


To retrieve units-of-measure (optionally in a language of choice):
/sap/opu/odata4/sap/API_MEASUREMENTDOCUMENT/default/iwbep/common/0001/UnitsOfMeasure?sap-language=DE

To retrieve actual service data (measurement documents):
/sap/opu/odata4/sap/API_MEASUREMENTDOCUMENT/srvd_a2x/sap/measurementdocument/0001/MeasurementDocument

tudor_teoteoi
Explorer
0 Kudos

Also, another point is the availability of ISO fields, as the standard SAP codes are language-dependent.

This is "feature", apparently introduced in S4H 2023 with most services, for instance OData API: Sales Contract (A2X) | SAP Help Portal mentions 
Additional unit properties on document header and item level
Besides the language-dependent code, you can now use the SAP code or the ISO code for units of measurement.

Coding of one CDS entity A_SalesContractItem reveals dedicated annotations for one quantity field:

@Semantics.quantity.unitOfMeasure: 'RequestedQuantityUnit'

@Semantics.quantity.unitOfMeasureSapCode: 'RequestedQuantitySAPUnit'

     @Semantics.quantity.unitOfMeasureIsoCode: 'RequestedQuantityISOUnit'

RequestedQuantity,

 

@Semantics.unitOfMeasure: true

RequestedQuantityUnit,

cast(_RequestedQuantityUnit.UnitOfMeasureSAPCode as sd_reqd_qty_sapunit preserving type) as RequestedQuantitySAPUnit,

cast(_RequestedQuantityUnit.UnitOfMeasureISOCode as sd_reqd_qty_isounit preserving type) as RequestedQuantityISOUnit,