Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Annotation for Quantity field in CDS table

vikash_pathak
Participant
21,612

Hello,

I am creating CDS table which is having one field type of MENGE for quantity,

but it is throwing error for annotaions

I tried with Semantics.quantiy,unitofmeasue: 'Base UOM' but didn't work.

If anyone has solution please share.

error : Annotation with reference to unit code for field HOT_WEIGHT is uncomplete

Thanks

@EndUserText.label : 'xxxxx Item Table'
@AbapCatalog.enhancementCategory : #NOT_EXTENSIBLE
@AbapCatalog.tableCategory : #TRANSPARENT
@AbapCatalog.deliveryClass : #A
@AbapCatalog.dataMaintenance : #RESTRICTED
define table /lsp/xxxxxxxxx {
  key client     : abap.clnt not null;
  key carcass_nr : /lsp/e_carcass_nr not null;
  key side_nr    : /lsp/e_side_nr not null;
  harvest_date   : /lsp/e_harvest_date;
  hot_date_time  : /lsp/e_hot_date_time;
  hot_shift      : /lsp/e_hot_shift;
 @Semantics.quantity.unitOfMeasure: 'BaseUnitOfMeasure'
  hot_weight     : /lsp/e_hot_weight;
  hot_weight_uom : /lsp/e_hot_weight_uom;


}
1 ACCEPTED SOLUTION
Read only

pfefferf
Active Contributor
0 Likes
17,255

Should be:

...
@Semantics.quantity.unitOfMeasure: 'hot_weight_uom'
hot_weight    : /lsp/e_hot_weight;
@Semantics.unitOfMeasure
hot_weight_uom: /lsp/e_hot_weight_uom;
...

@Semantics.quanity.unitOfMeasure must be a reference to a Unit of Measure field; in your case hot_weight_uom. The Unit of Measure field must be annotated with @Semantics.unitOfMeasure

7 REPLIES 7
Read only

pfefferf
Active Contributor
0 Likes
17,256

Should be:

...
@Semantics.quantity.unitOfMeasure: 'hot_weight_uom'
hot_weight    : /lsp/e_hot_weight;
@Semantics.unitOfMeasure
hot_weight_uom: /lsp/e_hot_weight_uom;
...

@Semantics.quanity.unitOfMeasure must be a reference to a Unit of Measure field; in your case hot_weight_uom. The Unit of Measure field must be annotated with @Semantics.unitOfMeasure

Read only

0 Likes
17,255

Hi Florian,

Still getting the same error .

Read only

pfefferf
Active Contributor
0 Likes
17,255

vikash.pathak What is the warning message for the @Semantics.unitOfMeasure annotation?

Maybe you have to add "true" as value (which is the default in new version):

@Semantics.unitOfMeasure: true
Read only

0 Likes
17,255

unitof measure is not valid

Read only

pfefferf
Active Contributor
0 Likes
17,255

vikash.pathak What is the type behind data element /lsp/e_hot_weight_uom?

Read only

0 Likes
17,255

Hi

It is MEINS,

This issue is resolved now.

with semantics annotation table name has to be added

@Semantics.quantity.unitOfMeasure:'/xx/xx.hot_weight_uom'

Read only

0 Likes
4,833

Thanks @Semantics.quantity.unitOfMeasure : 'TABLENAME.REFERENCEUNIT'