以下主要目的是学习如何使用CDS的注释annotate来做一个FIORI APP,同时学习BOPF的一些简单使用,基于学习的目的,其中的一些功能并不是为采购收货所必须的,有些只是为了学习而实现以供参考。在采购收货中我们先汇总采购收货计划EKET的需收货的数量,然后按此数量来进行收货。
以下学习中,CDS使用SAP HANA 创建,FIORI APP使用SAP WEB IDE创建。
在学习以下一些基本内容
- 创建主从表CDS的创建;
- 学习CDS 视图生成BOPF的注释使用;
- 学习BOPF中创建动作Actions,并写入动作实现类的常用代码;
- 学习BOPF数据有效性检查较验方法;
- 学习BOPF中锁使用的方法;
- 学习在BOPF中使用Draft草稿操作的方法;
- 在SAP WEB IDE中使用CDS Elements 注释快速生成APP的运用;
- 在WEB IDE中实现一些CDS注释不能实现的功能,比如动作确认等。
1.实现效果
2.创建需收货明细CDS
由于我们想使用EKET的数量来进行收货,但对一个EKPO行来说ETET会有多个计划行,并且可能会有部份已收货情况,所以我们需先从EKET中取出需收货的相关数据来,由于我刚好有一个已存在的EKET视图,所以我直接使用了此视图来作为需收货的EKET明细,事实使用时,可以进行更多的精减。其实里面只要有ebeln,ebelp,etenr,wemng,obmng字段就行,并且其它的视图注释好多也是可以取消的。@ObjectModel部份是可以去除的。此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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
@AbapCatalog.sqlViewName: 'ZMM_I_POEKETV' @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: 'eket fo gr' @ObjectModel: { compositionRoot: true, modelCategory: #BUSINESS_OBJECT, transactionalProcessingEnabled: true, createEnabled: true, updateEnabled: true, deleteEnabled: true, semanticKey: ['ebeln','ebelp','etenr'], draftEnabled: true, writeDraftPersistence: 'ZMM_POEKET_D' } define view ZMM_I_POEKET as select from eket as _eket association [1..1] to ekpo as _ekpo on $projection.ebeln = _ekpo.ebeln and $projection.ebelp = _ekpo.ebelp association [1..1] to ekko as _ekko on $projection.ebeln = _ekko.ebeln { @ObjectModel.readOnly: true key _eket.ebeln , @ObjectModel.readOnly: true key _eket.ebelp , @ObjectModel.readOnly: true key _eket.etenr , @ObjectModel.readOnly: true _ekpo.matnr , @ObjectModel.readOnly: true _ekpo.txz01 , _ekpo.werks , _ekpo.lgort , _eket.charg , @ObjectModel.readOnly: true _eket.eindt , --atpdate, @ObjectModel.readOnly: true _eket.eldat , @ObjectModel.readOnly: true @Semantics.quantity.unitOfMeasure: 'meins' _eket.menge ,--计划数量 @ObjectModel.readOnly: true @Semantics.quantity.unitOfMeasure: 'meins' _eket.wemng ,--已收货数量 @ObjectModel.readOnly: true @Semantics.quantity.unitOfMeasure: 'meins' cast( ( _eket.menge - _eket.wemng ) as obmng ) as OBMNG,--未收货量 @Semantics.quantity.unitOfMeasure: 'meins' cast( ( _eket.menge - _eket.wemng ) as zshsl ) as zshsl,--收货数量,默认全量收未清数量。 @ObjectModel.readOnly: true _ekpo.meins, @ObjectModel.readOnly: true _ekko.lifnr, _ekpo, _ekko } where ( _ekpo.bstyp = 'F' or _ekpo.bstyp = 'L' ) and( _ekpo.loekz = '' or _ekpo.loekz = 'S' ) and _ekpo.elikz = '' and _ekpo.stapo = '' and( _ekpo.pstyp = '0' or _ekpo.pstyp = '1' or _ekpo.pstyp = '2' or _ekpo.pstyp = '3' or _ekpo.pstyp = '4' or _ekpo.pstyp = '6' or _ekpo.pstyp = '7' or _ekpo.pstyp = '8' or _ekpo.pstyp = '9' ) and( ( _eket.wemng < _eket.menge and _eket.dabmg < _eket.menge // open request lines ) or( _eket.menge = 0 and _eket.mng02 > 0 ) //confirmation lines ) and _eket.nodisp = '' and _ekpo.statu <> 'V' and _ekpo.arsnr = '0000000000' and _eket.eindt <> '00000000' |
说明
- cast( ( _eket.menge – _eket.wemng ) as obmng ) as OBMNG,第一个as obmng,表示数据结果数据元素为obmng,第二个表示生成的视图字段名为obmng
- @Semantics.quantity.unitOfMeasure: ‘meins’ 表示下面的字段数量单位为meins
3.按订单行项目汇总
由于EKET是计划行的需收货数据,所以我们按采购订单行项目汇总生成需收货数据,在这里使用SUM,GROUP BY.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
@AbapCatalog.sqlViewName: 'ZMM_B_GR_EKPOV' @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: 'EKPO FOR GR' define view ZMM_B_GR_EKPO as select from ZMM_I_POEKET as _eket { key _eket.ebeln, key _eket.ebelp, sum(wemng) as wemng, --已收货数量 sum(OBMNG) as obmng --未收货量 } group by _eket.ebeln, _eket.ebelp |
4.创建业务对像BOPF对应EKKO的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 |
@AbapCatalog.sqlViewName: 'ZMM_I_GR_EKKOV' @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: 'EKKO FOR GR' @ObjectModel: { compositionRoot: true, modelCategory: #BUSINESS_OBJECT, transactionalProcessingEnabled: true, createEnabled: true, updateEnabled: true, deleteEnabled: true, semanticKey: ['ebeln'], draftEnabled: true, writeDraftPersistence: 'ZMM_I_GR_EKKO_D' } define view ZMM_I_GR_EKKO as select from ekko as _ekko association [1..*] to ZMM_I_GR_EKPO as _ekpo on $projection.ebeln = _ekpo.ebeln { key _ekko.ebeln, _ekko.lifnr, _ekko.bukrs, _ekko.BSART, _ekko.ZTERM, _ekko.EKORG, _ekko.EKGRP, @ObjectModel: { association: { type: [#TO_COMPOSITION_CHILD] } } _ekpo } where LOEKZ = '' |
说明
- transactionalProcessingEnabled: true, 表示生成BOPF
- draftEnabled: true,表示BOPF使用草稿功能,
- writeDraftPersistence: ‘ZMM_I_GR_EKKO_D’表示草稿数据表为ZMM_I_GR_EKKO_D
- 此CDS使用为采购订单抬头数据,其中使用了明细CDS:ZMM_I_GR_EKPO,所以不能独立激活,需要与后面的一步的CDS一起激活
- @ObjectModel.association.type: [#TO_COMPOSITION_CHILD]表示后面的对像为字node对像。
5.创建业务对像BOPF对应EKPO的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 |
@AbapCatalog.sqlViewName: 'ZMM_I_GR_EKPOV' @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: 'EKPO FOR GR' @ObjectModel: { updateEnabled: true, createEnabled: true, deleteEnabled: true, semanticKey: ['ebeln','ebelp'], writeDraftPersistence: 'ZMM_I_GR_EKPO_D'} define view ZMM_I_GR_EKPO as select from ekpo as _ekpo association [1..1] to ZMM_I_GR_EKKO as _ekko on $projection.ebeln = _ekko.ebeln association [1..1] to ZMM_B_GR_EKPO as _gr_ekpo on $projection.ebeln = _gr_ekpo.ebeln and $projection.ebelp = _gr_ekpo.ebelp { key _ekpo.ebeln, key _ekpo.ebelp, @Semantics.quantity.unitOfMeasure: 'meins' _ekpo.menge, --PO量 @Semantics.quantity.unitOfMeasure: 'meins' cast( _gr_ekpo.wemng as zwemng) as zwemng, --已收货数量 @Semantics.quantity.unitOfMeasure: 'meins' cast( _gr_ekpo.obmng as obmng) as obmng, --未收货量 @Semantics.quantity.unitOfMeasure: 'meins' cast( _gr_ekpo.obmng as zshsl ) as zshsl, --收货数量,默认全量收未清数量。 _ekpo.meins, _ekpo.matnr, _ekpo.txz01, _ekpo.werks, _ekpo.lgort, cast( '' as charg_d ) as charg,--批次 @ObjectModel: { association: { type: [#TO_COMPOSITION_PARENT,#TO_COMPOSITION_ROOT] } } _ekko } |
说明
- cast( ” as charg_d ) as charg,此说明生成一个内容为空字符表的字段,并且字段名为CHARG,字段元素使用charg_d。
- 草稿数据表为ZMM_I_GR_EKPO_D
6.采购订单收货情况统计信息CDS
为了解决在显示采购订单抬头数据时,只显示存在未收货明细的采购订单,所以加了些表,同时后期在明细页时显示一些采购订单完成情况的统计信息也会加在这里,比如显示收货完成进度条等。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
@AbapCatalog.sqlViewName: 'ZMM_C_GR_EKKOV' @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: '按订单统计收货量' define view ZMM_C_GR_EKKO as select from ZMM_I_GR_EKPO { key ZMM_I_GR_EKPO.ebeln, sum(ZMM_I_GR_EKPO.menge) as menge,--订单数量 sum(ZMM_I_GR_EKPO.zwemng) as zwemng,--已收货数量 sum(ZMM_I_GR_EKPO.obmng) as obmng,--未收货数量 sum(ZMM_I_GR_EKPO.zshsl) as zshsl--本次收货数量 } group by ebeln |
7.生成消费抬头表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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
@AbapCatalog.sqlViewName: 'ZMM_C_POHEADERV' @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: '采购收货抬头' @OData.publish: true @Metadata.allowExtensions: true @VDM.viewType: #CONSUMPTION @ObjectModel: { compositionRoot: true, transactionalProcessingDelegated: true, -- createEnabled: true, updateEnabled: true, deleteEnabled: true, semanticKey: ['ebeln'], draftEnabled: true } define view ZMM_C_POHEADER as select from ZMM_I_GR_EKKO association [1..*] to ZMM_C_POITEMS as _ekpo on $projection.ebeln = _ekpo.ebeln association [1..1] to I_Supplier as _Supplier on $projection.lifnr = _Supplier.Supplier ------------------------------------------------------------------------------------------- -- Value-Help Associations -- ------------------------------------------------------------------------------------------- -- association [0..1] to C_PurchasingGroupValueHelp as _PurchasingGroupVH on _PurchasingGroupVH.PurchasingGroup = $projection.PurchasingGroup -- association [0..1] to C_MM_SupplierValueHelp as _SupplierValueHelp on _SupplierValueHelp.Supplier = $projection.lifnr and _SupplierValueHelp.CompanyCode = $projection.bukrs --收货数量情况,用于显示统计信息 association [1..1] to ZMM_C_GR_EKKO as _c_gr_ekko on $projection.ebeln = _c_gr_ekko.ebeln { @ObjectModel.readOnly: true key ZMM_I_GR_EKKO.ebeln, @ObjectModel.readOnly: true --@ObjectModel.foreignKey.association: '_supplier' -- @Consumption: { valueHelp: '_SupplierValueHelp',filter.mandatory: true } --生成一个必输入的查询条件框 -- @ObjectModel.foreignKey.association: '_SupplierValueHelp' ZMM_I_GR_EKKO.lifnr, @ObjectModel.readOnly: true _Supplier.SupplierName as name1, @ObjectModel.readOnly: true ZMM_I_GR_EKKO.bukrs, @ObjectModel.readOnly: true ZMM_I_GR_EKKO.bsart, @ObjectModel.readOnly: true ZMM_I_GR_EKKO.zterm, @ObjectModel.readOnly: true ZMM_I_GR_EKKO.ekorg, @ObjectModel.readOnly: true ZMM_I_GR_EKKO.ekgrp, @ObjectModel.association: { type: [#TO_COMPOSITION_CHILD] } _ekpo, _Supplier, _SupplierValueHelp, _c_gr_ekko } where _c_gr_ekko.obmng > 0 |
8.说明:
- 激活需要与后面明细的视图一起同时才能激活。
- @OData.publish: true,用于生成ODATA服务,但此服务生成后没有激活,如要直接使用此服务的话,可使用事务码/N/IWFND/MAINT_SERVICE在其中添加服务,来添加此服务,或者直接在SEGW中已有的项目中添加此服务。
- updateEnabled: true,设置可以修改,用于修改收货数量,
- deleteEnabled: true,设置可以删除数据,如不做增强的话,默认为删除修改的数据,也就是删除草稿内容。
- deleteEnabled: true,使用草案
- association [0..1] to C_MM_SupplierValueHelp,是连接到供应商的搜索帮助,在后面字段中注释了的LIFNR中,就会使用此CDS
- @Consumption: { valueHelp: ‘_SupplierValueHelp’,filter.mandatory: true }此用于在屏幕中生成一个带必输入的供应商查询条件,可以打开此注释,测试。
- @ObjectModel.association.type: [#TO_COMPOSITION_CHILD]用于指定后面的为字节点
9.生成消费明细表视图
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 45 46 47 48 49 50 51 52 53 54 55 56 |
@AbapCatalog.sqlViewName: 'ZMM_C_POITEMSV' @AbapCatalog.compiler.compareFilter: true @AbapCatalog.preserveKey: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: '采购收货明细' @Metadata.allowExtensions: true @VDM.viewType: #CONSUMPTION @ObjectModel: { updateEnabled: true, createEnabled: true, deleteEnabled: true, semanticKey: ['ebeln', 'ebelp']} define view ZMM_C_POITEMS as select from ZMM_I_GR_EKPO association [1..1] to ZMM_C_POHEADER as _header on $projection.ebeln = _header.ebeln association [0..1] to I_Material as _material on $projection.matnr = _material.Material association [0..1] to I_UnitOfMeasure as _unitOfMeasure on $projection.meins = _unitOfMeasure.UnitOfMeasure { @ObjectModel.readOnly: true key ZMM_I_GR_EKPO.ebeln, @ObjectModel.readOnly: true key ZMM_I_GR_EKPO.ebelp, @ObjectModel.readOnly: true @Semantics.quantity.unitOfMeasure: 'meins' ZMM_I_GR_EKPO.menge,--订单数量 @ObjectModel.readOnly: true @Semantics.quantity.unitOfMeasure: 'meins' ZMM_I_GR_EKPO.zwemng,--已收货数量 @ObjectModel.readOnly: true @Semantics.quantity.unitOfMeasure: 'meins' ZMM_I_GR_EKPO.obmng,--未收货数量 @ObjectModel.mandatory: true--强制输入? @Semantics.quantity.unitOfMeasure: 'meins' ZMM_I_GR_EKPO.zshsl,--本次收货数量 @ObjectModel.readOnly: true @Semantics.unitOfMeasure: true @ObjectModel.foreignKey.association: '_unitOfMeasure' ZMM_I_GR_EKPO.meins, @ObjectModel.readOnly: true @ObjectModel.foreignKey.association: '_material' ZMM_I_GR_EKPO.matnr, @ObjectModel.readOnly: true ZMM_I_GR_EKPO.txz01, ZMM_I_GR_EKPO.werks, ZMM_I_GR_EKPO.lgort, ZMM_I_GR_EKPO.charg, @ObjectModel.association: { type: [#TO_COMPOSITION_PARENT, #TO_COMPOSITION_ROOT] } _header, _material, _unitOfMeasure } |
说明
- @ObjectModel.readOnly: true,指定不能修改字段值,由于我们只是用采购数据进行收货,所以能修改的主要也就是数量,及地点,批次等相关信息。
- @Semantics.quantity.unitOfMeasure: ‘meins’,指定数量的单位。
10.定义CDS annotate
到上面的步骤为止,我们的CDS算是创建完成了,这时我们可以在HANA Studio中显示CDS数据,也能测试BOPF。但我们的目的是要在WEB IDE中生成 Elements APP。所以我们还得定义 Elements相关的一些东西,也就是定义CDS的注释,此注释是影响了WEB IDE创建后的app的显示属性,细节很多,可以查看后面的解说,同时自己修改注释来查看变化影响。一个创建了HEADER,items两个的Metadata Extensions,但现只用到了HEADER的注释,另一个在后面会用到。
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
@Metadata.layer: #CUSTOMER @UI: { headerInfo: { typeName: '采购收货', typeNamePlural: '采购收货1', title: { type: #STANDARD, label: '采购收货2' } } } @Search.searchable: true //主页可以有搜索框, annotate view ZMM_C_POHEADER with { @UI.facet: [ { label: 'Header data', id: 'Header', type: #COLLECTION }, { label: 'Document Information', id : 'HeaderData', parentId : 'Header', type : #FIELDGROUP_REFERENCE, targetQualifier : 'HeaderData' }, { label: 'Organizational Information', id : 'OtherInfo', parentId : 'Header', type : #FIELDGROUP_REFERENCE, targetQualifier : 'OtherInfo' }, { label: 'Items', purpose: #STANDARD, id: 'Items', type: #LINEITEM_REFERENCE, targetElement: '_ekpo' } ] @UI: { lineItem: [ { position: 10, label: '采购订单',importance: #HIGH } ], --selectionField: [ { position: 10 } ],--查询选择框 identification:[ { position: 10 } ], fieldGroup: [{ qualifier: 'HeaderData', position: 10 }] } @Search:{defaultSearchElement: true,ranking:#HIGH} //主页可搜索,最优化 ebeln; @UI: { lineItem: [ { position: 20, importance: #HIGH } ], identification:[ { position: 20} ], fieldGroup: [{ qualifier: 'HeaderData', position: 20 }] } @Search:{defaultSearchElement: true}//主页可搜索框可搜索字段,默认优先中等。 lifnr; @UI: { lineItem: [ { position: 30, importance: #HIGH } ], identification:[ { position: 30} ], fieldGroup: [{ qualifier: 'HeaderData', position: 30 }] } -- @Search:{defaultSearchElement: true ,fuzzinessThreshold: 0.2}//主页可搜索,至少输入20%的字? name1; @UI: { lineItem: [ { position: 40, importance: #LOW } ], identification:[ { position: 40} ], fieldGroup: [{ qualifier: 'OtherInfo', position: 40 }] } bukrs; @UI: { lineItem: [ { position: 50, importance: #LOW } ], identification:[ { position: 50} ], fieldGroup: [{ qualifier: 'OtherInfo', position: 10 }] } bsart; @UI: { lineItem: [ { position: 60, importance: #LOW } ], identification:[ { position: 60} ], fieldGroup: [{ qualifier: 'OtherInfo', position: 20 }] } zterm; @UI: { lineItem: [ { position: 70, importance: #LOW } ], identification:[ { position: 70} ], fieldGroup: [{ qualifier: 'OtherInfo', position: 30 }] } ekorg; @UI: { lineItem: [ { position: 80, importance: #LOW } ], identification:[ { position: 80} ], fieldGroup: [{ qualifier: 'OtherInfo', position: 40 }] } ekgrp; } |
8.说明:
- 在headerInfo中指定很多的抬头信息,具体的内容还在测试中。
- @Search.searchable: true //指定主页可以有搜索框,
- @Search:{defaultSearchElement: true,fuzzinessThreshold: 0.8}//主页可搜索框可搜索字段,在这里指定的0.8是一个模糊搜索的一个度量,最大是1,由于供应商有前导0,所以用此方法来避免输入供应商前导0来查询。
- lineItem,指定在列表中显示的信息,
- fieldGroup指定在对像页(细节页)时抬头显示的信息。
ITEMS的注释
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
@Metadata.layer: #CUSTOMER @UI: { headerInfo: { typeName: '收货明细', typeNamePlural: '收货明细1', title: { type: #STANDARD, label: '收货明细2' } } } annotate view ZMM_C_POITEMS with { @UI.facet: [ { label: 'Item Information', id : 'ItemData', //parentId : 'Header', type : #FIELDGROUP_REFERENCE, targetQualifier : 'ItemData' }, { label: 'Internal Information', id : 'InternalInfo', //parentId : 'Header', type : #FIELDGROUP_REFERENCE, targetQualifier : 'InternalInfo' } ] @UI: { hidden: true, lineItem: [ { position: 10, importance: #HIGH } ], identification:[ { position: 10} ], fieldGroup: [{ qualifier: 'InternalInfo', position: 10 }] } ebeln; @UI: { lineItem: [ { position: 20, importance: #HIGH } ], identification:[ { position: 20} ], fieldGroup: [{ qualifier: 'InternalInfo', position: 20 }] } matnr; @UI: { lineItem: [ { position: 30, importance: #HIGH } ], identification:[ { position: 30} ], fieldGroup: [{ qualifier: 'InternalInfo', position: 30 }] } txz01; @UI: { lineItem: [ { position: 40, importance: #HIGH } ], identification:[ { position: 40} ], fieldGroup: [{ qualifier: 'InternalInfo', position: 40 }] } menge;--订单数量 @UI: { lineItem: [ { position: 50, importance: #HIGH } ], identification:[ { position: 50} ], fieldGroup: [{ qualifier: 'InternalInfo', position: 50 }] } zwemng;--已收货数量 @UI: { lineItem: [ { position: 60, importance: #HIGH } ], identification:[ { position: 60} ], fieldGroup: [{ qualifier: 'ItemData', position: 10 }] } obmng;--未收货数量 @UI: { lineItem: [ { position: 70, importance: #HIGH } ], identification:[ { position: 70} ], fieldGroup: [{ qualifier: 'ItemData', position: 20 }] } zshsl;--本次收货数量 @UI: { lineItem: [ { position: 80, importance: #HIGH } ], identification:[ { position: 80} ], fieldGroup: [{ qualifier: 'ItemData', position: 30 }] } werks; @UI: { lineItem: [ { position: 90, importance: #HIGH } ], identification:[ { position: 90} ], fieldGroup: [{ qualifier: 'ItemData', position: 40 }] } lgort; @UI: { lineItem: [ { position: 100, importance: #HIGH } ], identification:[ { position: 100} ], fieldGroup: [{ qualifier: 'ItemData', position: 50 }] } charg; } |
12.总结
- 当修改了CDS后,特别是BOPF后,如一些功能发现不正常,可以考虑删除BOPF及及相关的所有类,表,重新激活CDS来生成BOPF及相关内容。
- 当修改CDS,及注释后,在前端没反映出修改的内容,可以重新生成ODATA,或者SEGW重生活对应的项目,同时使用事务码:/n/IWFND/CACHE_CLEANUP清除缓存。
- 由于做CDS时,我们一开始经常什么变更字段,表等,或者需求的变化,而CDS会自动生成很多东西,特别是BOPF的相关的东西,很多会自动生成,但由于CDS的变更,特别是字段的这些变更能够自动更新,所以会导致各种错误,这里的解决法办,可能是删除相关自动生成的对像,如你准确知道应该要删除什么对像那可直接删除,但事实中我们总是判断不了要删除那些自动生成的对像,所以我都是删除所有自动生成的对像,为此我们最好把一个业务相关的CDS创建到一个包里,这里可能会更方便删除。
- 在主从视图关联激活时,需要两个视图同时一起激活。
- 在激活时,最好当前显示的只是需要激活的对像,不然,激活时会判断已打开的是否能激活(就算没选中也会去激活),这样报错不一定是你当前对像的报错。