Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

MeasurementFieldProperties/Measurement Unit value for a measurement field?

Hi Friends,

I am trying to get the field value of type measurement. I am able to get the value but unable to get the actual unit of measurement. To use the Dimensions object i need to know the Dimensiond Id, which i think can be possible by using the object of MeasurementFieldProperties.

Can anyone of you please let me know if there is way to get this?



Former Member

Here is the sample code to get the Unit value for measurement field:

MeasurementFieldProperties meaProps =(MeasurementFieldProperties)getRepositorySchema().getField(TABLE_ID, FIELD_ID);

DimensionId dimensionId = meaProps.getDimensionId();

Dimensions dimensions = new Dimensions();

measurementValue = ((MeasurementValue) mdmValue).getMagnitude();

UnitId unitId = ((MeasurementValue) mdmValue).getUnitId();

UnitProperties unitProps = dimensions.getUnit(dimensionId, unitId);

String unitName = unitProps.getName(Locale.US);

Hope that helps!

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question