当前位置:首页>开发知识>Fiori开发>CDS VIEW>cds view一些常见的annotation解释

cds view一些常见的annotation解释

当定义 CDS View 时,可以使用以下注解来指定视图和实体属性、行为和 UI 元数据等方面的信息。这里列举一些常见的注解及其作用,持续更新记录一下:

cds view一些常见的annotation解释

全局级别的属性

  • @AbapCatalog.sqlViewName: 指定此 CDS View 对应的 SQL 数据库视图名称。
  • @AccessControl.authorizationCheck: 指定此 CDS View 是否需要进行授权检查。
  • @ClientDependent: 指定此实体是否是客户端相关的。如果为 true,则表示该实体中的数据在不同客户端之间是独立的;否则,在不同客户端之间共享相同的数据。
  • @OData.publish: 指定此 CDS View 是否发布为 OData 服务。
  • @ObjectModel: 定义对象模型相关的信息,包括组合树、关系等。
    • @OData.publish:true : 自动暴露CDSVIEW作为odata服务

    字段级别的属性

  • @EndUserText.label: 指定此实体或属性的文本标签。这个标签可以在 UI 中使用,以提供更好的用户体验。
  • @UI.facet: 定义 UI 上的分面,用于组织和显示实体属性。
  • @UI.fieldGroup: 定义实体属性在 UI 上的分组。
  • @UI.lineItem: 指定实体属性在 UI 表格中显示的位置和重要性。
  • @UI.selectionField: 指定实体属性是否可用于筛选。
  • @UI.hidden:true :隐藏

    @ObjectModel.readOnly: ‘EXTERNAL_CALCULATION’ :内部计算,涉及到后台计算来决定的,需要加上这个

    具体解释

    • @UI.headerInfo.typeNamePlural : determines text displayed for the list report

    • @UI.lineItem is used to set default columns for the list report. The mandatory property is position, which determines the sequence of columns. The label for each field comes from field label of data element for a field.

    • @UI.lineItem.label is used to assign a label if field label of data element is not available.

    • @semantics.currencyCode/@semantics.unitofMeasure : to annotate for currency/unit field.

    • @semantics.amount.currencyCode/@semantics.quantity.unitofMeasure : to annotate amount/quantity field and tell them which field has the information of currencyCode/ unitofMeasure

    • @UI.lineItem.importance to determine in which clients the field should display:

      • HIGH: default value, display in all clients
      • MEDIUM: Only display in desktop browser or tablet
      • LOW: Only display in browser
    • @UI.hidden to hide fields that need not be exposed to end user

    以上注解只是一部分,还有很多其他的注解可以用于 CDS View 的定义,具体取决于您的需求。如果您需要详细了解 CDS 注解,请参考 SAP 官方文档或者其他相关资源。

    给TA打赏
    共{{data.count}}人
    人已打赏
    ABAP开发

    sap官方网站

    2023-3-24 12:35:27

    CDS VIEWFiori开发

    做cdsview得记住一些eclipse的快捷键

    2023-7-25 9:03:36

    0 条回复 A文章作者 M管理员
      暂无讨论,说说你的看法吧
    个人中心
    购物车
    优惠劵
    今日签到
    有新私信 私信列表
    搜索