cancel
Showing results for 
Search instead for 
Did you mean: 

SAP RAP: Quantity Full Description

andre_katz_88
Explorer
0 Kudos

Hello Gurus,

I have a RAP-based Fiori app. On the Object Page a I have a table with a "Quantity" field.
I want to display a full text description of the UoM next to the quantity value.
I can display the UoM abbreviation, but not the full text (code below).
Would be grateful for any hints/advice to help me solve my issue.

Thank You!

Basic View

define view Z_I_Items
  as select from database_table

  association [0..1] to I_UnitOfMeasure as _QuantityUnitOfMeasure on $projection.QuantityUnit = _QuantityUnitOfMeasure.UnitOfMeasure

{
  @Semantics.quantity.unitOfMeasure: 'QuantityUnit'
  order_qty        as Quantity,
  @ObjectModel.foreignKey.association: '_QuantityUnitOfMeasure'
  @Semantics.unitOfMeasure: true
  process_qty_unit as QuantityUnit,


  /* Associations */
  _QuantityUnitOfMeasure
}

Transactional View

define view entity Z_I_ItemsTP
  as select from Z_I_Items as _Item
{
  @Semantics.quantity.unitOfMeasure: 'QuantityUnit'
  _Item.Quantity,
  @ObjectModel.foreignKey.association: '_QuantityUnitOfMeasure'
  _Item.QuantityUnit,
      
  /* Associations */
  _Item._QuantityUnitOfMeasure,
}

Consumption View

define view entity Z_C_Items
  as projection on Z_I_ItemsTP
{
  @Semantics.quantity.unitOfMeasure: 'QuantityUnit'
  Quantity,
  @ObjectModel.text.element: ['UnitOfMeasureName']
  QuantityUnit,
  @Semantics.text: true
  _QuantityUnitOfMeasure._Text.UnitOfMeasureName : localized
}

Metadata Extension

annotate view Z_C_Items with
{
  @UI: { lineItem: [{ position: 50, label: 'Quantity' }] }
  @Consumption.semanticObject: 'QuantityUnit'
  Quantity;
  
  @Consumption.semanticObject: 'UnitOfMeasureName'
  @UI.textArrangement: #TEXT_FIRST
  QuantityUnit;
  
  @UI.hidden: true
  UnitOfMeasureName;
}

Result
I have 1, but want 2 next to the quantity value (in the screenshot).

andre_katz_88_1-1710502463539.png

SachinArtani
Participant
0 Kudos
I don't think that makes any sense and wonder if it's even possible. Technically, only UNIT and CUKY can be shown beside the value upon specifying the semantics that you have already done.

Accepted Solutions (0)

Answers (0)