在创建CDS里,我们可能需要使用ECC中元素定义的DODAIN values(域值)来在自己的CDS中使用,在这里可以看到更多的信息,还可以直接在这里生成用于域的CDS,
域的固定值和与语言有关,相应文本通常存储在表DD07L和DD07T中。可以把给定域的这些值需要合并到CDS视图中,然后才能自己的CDS中使用
下面是一个使用需求的例子
这些值和相应的文本来自CDS视图I_SDDocumentCategory和 I_SDDocumentCategoryText。CDS视图I_SDDocumentCategory从表DD07L中获取域VBTYPL的值。在CDS视图I_SDDocumentCategoryText中检索与语言相关的文本。这两个CDS使用关联相互关联
可以在这里使用CDS代码生成器,来生成域值所需的两个CDS,
下面是使用默认域值KOART生成的CDS的例子,
1.拷贝到HANA Studio
把默认生成的两个CDS拷贝到HANA Studio,创建CDS,CDS视图ZI_AccounType和ZI_AccountTypeText(复制粘贴生成的代码),不要单独激活它们,因为它们具有循环依赖性
2.激活的两个CDS视图
单击全部激活按钮,选择要立即激活的两个CDS视图。
3.使用视图ZI_AccountType
下面的CDS:ZI_BPTaxCode中使用前面定义KOART的CDS。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
@AbapCatalog.sqlViewName: 'ZITAXCODE' @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #NOT_REQUIRED @EndUserText.label: 'Tax code grouping' @ObjectModel.usageType: {serviceQuality: #A, sizeCategory: #S, dataClass: #ORGANIZATIONAL} @OData.publish: true define view ZI_BPTaxCode as select from t007c association [1..*] to C_BPTaxCodeTextValueHelp as _Text on $projection.TaxGroupingCode = _Text.TaxGroupingCode and $projection.AccountType = _Text.AccountType association [1..1] to ZI_AccountType as _AccountType on $projection.AccountType = _AccountType.AccountType { @UI.facet: [ { id:'idGeneralInformation' , type: #COLLECTION , label: 'General Information' , position: 10 } , { type: #IDENTIFICATION_REFERENCE , label : 'General Information', parentId: 'idGeneralInformation' , id: 'idIdentification' } ] @UI.selectionField: [{ position: 10 }] @UI.lineItem: [{ position: 10 }] @ObjectModel.text.association: '_Text' key taxgr as TaxGroupingCode, @UI.selectionField: [{ position: 20 }] @UI.lineItem: [{ position: 10 }] @ObjectModel.foreignKey.association: '_AccountType' key koart as AccountType, @UI.selectionField: [{ position: 30 }] @UI.lineItem: [{ position: 30 }] wrnex as ExceptionPossible, _Text, _AccountType } |
4.在SEGW中引用此ODATA
引入此ODATA记得勾选_ACCOUNTTYPE后面的选择框,图中2标记。
这就引入有关帐户类型的文本,并为过滤器提供价值帮助,相当于此时在ECC中可以使用F4功能了。