Skip to Content

Unit of Measure (UOM) truncated in Core Data Service (CDS) based OData Service

Hello CDS / SAP Gateway Experts,

I have an interesting issue with a CDS View that should show the ProductBaseUnit. The issue occurred in a SAP ERP 6.0 EhP8 (NetWeaver 7.50 SP5) System, but I’m able to repeat the issue also in the NetWeaver Developer Edition system (7.50 SP2) using the EPM Demo Data Model. If I create a CDS View with the following source:

@AbapCatalog.sqlViewName: 'ZGWEPMPROD'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: 'EPM Product'
@OData.publish: true
define view ZGW_C_EPM_Product as select from SEPMRA_C_PD_Product {

when I then maintain a Product using the also provided Fiori App to maintain Products with a Base Unit of Pallets (PAL) and the Weight Unit of US Tons (TON):

then this is correctly shown when I use the ABAP in Eclipse Data Preview:

But when I call the same Material using the generated OData Service I get back:


I've dug a little bit deeper now and when setting a breakpoint in the /iwbep/if_mgw_appl_srv_runtime~get_entityset or /iwbep/if_mgw_appl_srv_runtime~get_entity methods of class cl_sadl_gw_generic_dpc I see the data is still intact. So I guess this has something to do with a conversion exit.

Is that a bug or a error on my side?

Best regards

odata.png (82.3 kB)
preview.png (21.9 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Apr 18, 2017 at 08:52 AM

    Hello Gregor,

    this is not a truncation but still a strange behavior. The base unit in the product table of the EPM model uses domain MEINS which refers to a conversion exit CUNIT. Hence, the direct exposure of the CDS View should make use of this conversion. But CUNIT just maps the language-specific UoMs (technically, MSEHI to MSEH3 in table T006A). Your OData service should return PAL as well. I tried to reproduce it and got PAL.

    PF is the ISO-Code of PAL - please refer to table T006. So it seems that an ISO conversion is happening which is the default handling for currency codes and units of measure. So somehow the conversion exit is not taken into account in your specific case.

    Finding the root cause would require some debugging...

    So far, I did not publish the third blog post of the conversion series. It would deal with the specialties of currency and measure conversions.


    Add comment
    10|10000 characters needed characters exceeded

    • Hi Thomas,

      I did a trace and found out that this Methods/Functions Modules are called:

      Load Report SAPLSCV0
      Call Function UNIT_OF_MEASURE_SAP_TO_ISO
      Select Single T006

      So you're right the ISO Code is returned in the OData Service.

      Best regards