CDS(Core Data Service)Annotation 常用属性

##1. 设置fiori报表抬头信息

1. 抬头信息

CDS(Core Data Service)Annotation 常用属性_第1张图片

@UI: {
  headerInfo: {
    typeName: 'クロスプラントメンテナンス',
    typeNamePlural: 'クロスプラントメンテナンス',
    description: { value: 'Product' },
    title: {										//抬头信息文本
      type: #STANDARD,
      value: 'Location',
      label: 'クロスプラントメンテナンス'
    }
  },
  presentationVariant: [ { sortOrder: [{ by: 'Product',direction: #ASC },		//抬头搜索排序条件
                                       { by: 'Location',direction: #ASC },
                                       { by: 'LocationType',direction: #ASC } ] } ]
}

2. 行信息(分组、颜色信息、隐藏显示信息)

CDS(Core Data Service)Annotation 常用属性_第2张图片
3

  @UI.facet: [
  {
    id: 'bp_Tab1',
    purpose: #STANDARD,
    type: #FIELDGROUP_REFERENCE,
    label: '一般情報',
    targetQualifier:'bp_Info1',
    position: 10
  },
   {
      id: 'bp_inc2',									//include页签 association对象
      purpose: #STANDARD,
      type: #LINEITEM_REFERENCE,
      hidden: #(CUSGENERALHID),				//指派到隐藏属性
      label: '得意先会社コード',   //Customer Master (Company Code)
      targetElement:   '_CustomerCompanyData',		//with association
      position: 90
    },]
 
  @UI: {
    fieldGroup:[{ qualifier:'bp_Info1', position:1 }]		//字段指派到分组
  }
  Type;

// with action		
  @UI: {
    lineItem: [
        { position: 20, importance: #HIGH, criticality: 'StatusCrt', criticalityRepresentation:#WITHOUT_ICON }	//定义按钮
       ,{ type: #FOR_ACTION, dataAction: 'applyWorkFlow', label: '申請', position: 1 }
       ,{ type: #FOR_ACTION, dataAction: 'withdrawWorkFlow', label: '申請取消' ,position: 2 }
       ,{ type: #FOR_ACTION, dataAction: 'aproWorkFlow', label: '承認' ,position: 3}
       ,{ type: #FOR_ACTION, dataAction: 'rejtWorkFlow', label: '却下' ,position: 4}
       ,{ type: #FOR_ACTION, dataAction: 'simulation', label: '同期テスト' ,position: 5}
     ],
    identification: [
       { importance: #HIGH, label: '申請',  dataAction: 'applyWorkFlow',type: #FOR_ACTION,  position: 1 }
       ,{ importance: #HIGH, label: '申請取消', dataAction: 'withdrawWorkFlow',  type: #FOR_ACTION, position: 2 }
       ,{ importance: #HIGH, label: '承認' , dataAction: 'aproWorkFlow', type: #FOR_ACTION,  position: 3}
       ,{ importance: #HIGH, label: '却下' ,  dataAction: 'rejtWorkFlow', type: #FOR_ACTION,  position: 4}
       ,{ importance: #HIGH, label: '同期テスト' ,  dataAction: 'simulation', type: #FOR_ACTION,  position: 5}  ],
    fieldGroup:[ { qualifier:'headerGroup1', position:20} ],
    selectionField: [ { position: 50 } ],
    textArrangement: #TEXT_ONLY
  }
  Status;
   @UI: { fieldGroup:[{ qualifier:'headerGroup7', position:102, type: #WITH_URL, url: 'Url' }]  } //URL字段
  Url;
  
  @UI: {
     fieldGroup:[{ qualifier:'bp_Info2', position:7  , criticality: 'NameOrg1Crt', criticalityRepresentation:#WITHOUT_ICON}]		//应用颜色字段
  }
  NameOrg1;
  virtual NameOrg1Crt        : abap.char( 10 ),
          @ObjectModel.virtualElementCalculatedBy: 'ABAP:ZCL_MDE0017' //Interface View定义虚拟颜色属性字段并绑定到UI字段上&定义颜色处理类

          @ObjectModel.virtualElementCalculatedBy: 'ABAP:ZCL_MDE0016'
  virtual cusGeneralHid      : abap_boolean, //隐藏属性

3. Search Help 多选

CDS(Core Data Service)Annotation 常用属性_第3张图片

      @Consumption:{valueHelpDefinition:[{ entity: { name: 'ZI_MD_WORKFLOWUSER_VH',element: 'Bname' } }],
                    filter: { multipleSelections: true, selectionType: #SINGLE }
       }

4. Search Help Binding Field(字段关联搜索)

CDS(Core Data Service)Annotation 常用属性_第4张图片

  @Consumption.valueHelpDefinition: [{ entity: { name: 'I_GLAccountStdVH', element: 'GLAccount' },
               additionalBinding:   [{ element: 'CompanyCode',localElement: 'COMPANYCODE' }],useForValidation:true }]

5. List box

CDS(Core Data Service)Annotation 常用属性_第5张图片

  • 定义搜索帮助视图
  • 注释文本视图:@ObjectModel.dataCategory: #TEXT
  • 设置结果集类型:@ObjectModel.resultSet.sizeCategory: #XS
  • 注释语言字段:@Semantics.language: true
  • 注释依赖于语言的文本字段:@Semantics.text: true
    CDS(Core Data Service)Annotation 常用属性_第6张图片
  • 绑定List搜索帮助到字段
    6
          @ObjectModel.text.element: ['OperationName']
          @Consumption.valueHelpDefinition: [{ entity: {name: 'ZI_MD_WORKFLOWOPERATION_VH', element: 'Operation' },useForValidation:true }]

6. Muti Line Text(长文本输入)

CDS(Core Data Service)Annotation 常用属性_第7张图片

  @UI.multiLineText: true
  ApplyReason;

7. Date Time

  • 绑定日期时间属性
    CDS(Core Data Service)Annotation 常用属性_第8张图片
      @Semantics.systemDateTime.createdAt: true
      @Semantics.user.createdBy: true
      @Semantics.systemDateTime.lastChangedAt: true
      @Semantics.user.lastChangedBy: true

8. Text Label(覆盖UI显示文本,不建议使用)

@EndUserText.label: 'XX'

9. UI隐藏字段

  @UI.hidden: true
  definitionId;

10. 绑定ID字段和Text

CDS(Core Data Service)Annotation 常用属性_第9张图片

  • 创建ID文本表值视图
    CDS(Core Data Service)Annotation 常用属性_第10张图片
  • 关联字段描述的字段名@ObjectModel.text.element: [‘ApproveStepText’]:
  • 注释系统该字段将用作描述:@Semantic.text: true
  • 带语言引用:_ApproveStep[Language = $session.system_language ].ApproveStepText as ApproveStepText
    CDS(Core Data Service)Annotation 常用属性_第11张图片
  • 设置ID值和文本值显示类型
  • @UI.textArrangement: #TEXT_ONLY
    • 文本在前:TEXT_FIRST
    • 文本在后: TEXT_LAST
    • 仅显示文本:#TEXT_ONLY
    • 分离模式:TEXT_SEPARATE
      9
      CDS(Core Data Service)Annotation 常用属性_第12张图片

11. 搜索帮助界面字段控制

  • 隐藏搜索帮助字段
    • @Consumption.valueHelpDefault.display:false
  • 隐藏搜索帮助搜索框
    • @Consumption.filter.hidden:true

12. 聚合搜索帮助

CDS(Core Data Service)Annotation 常用属性_第13张图片

          @Consumption.valueHelpDefinition: [ {entity: { name: 'ZI_MAINTAINEDPLANTVIEW_NONE_VH', element: 'Werks'},
                                                        label: 'Plant Value Help',
                                                        qualifier : 'PlantValueHelp'},
                                               { entity: { name: 'ZI_MAINTAINEDPLANTVIEW_VH', element: 'Werks'},
                                                        label: 'Plant Value Help Ref Material',
                                                        additionalBinding: [{ element: 'Matnr',localElement: 'Matnr' }]}]
          Werks,

你可能感兴趣的:(Fiori,UI5,Core,Data,Service(CDS,View),CDS)