与其他注释的交互

ABAP RESTful 应用程序编程模型 › 开发 › 开发 UI 特定 › 定义元数据驱动的 UI 的 CDS 注释 › 元数据驱动 UI 的更多选项 › 字段操作 › 与其他注释的交互

获取有关如何在注释之间提供交互的信息。

除 UI 注释外,您还可以使用影响所需客户端行为的模型特定注释。例如,您可以实施单位-货币映射或标识-文本映射。这些模型特定的注释可由客户端评估,不需要附加 UI 注释。

示例

在以下示例中,字段 CurrencyCode 用 @Semantics.currencyCode 标记并由字段 GrossAmount 引用。这意味着字段 GrossAmount 始终以相应的货币显示。不需要显式公开字段 CurrencyCode。

示例代码

...
define view ZExample_SalesOrder as select from sepm_cds_sales_order as so
{
  @UI.identification: [ { position: 10 } ]
  key so.sales_order_id as SalesOrder,

  @Semantics.currencyCode: true
  so.currency_code as CurrencyCode,

  @Semantics.amount.currencyCode: 'CurrencyCode'
  @UI.identification: [ { position: '20' } ]
  so.gross_amount as GrossAmount,