SAP Fiori Elements如何基于domain fixed value创建下拉菜单

简介: SAP Fiori Elements如何基于domain fixed value创建下拉菜单

Several days ago I wrote a blog How to build a drop down list using Smart template + CDS view which introduces how to create a drop down list based on values from a backend table.


image.png


For example, the status list in above screenshot comes from the three entries in database table ZSTATUS_FIXEDVAL.


image.png


And now a new requirement is to use the fixed value defined in an ABAP domain instead.


image.png


Here below are steps to achieve it.


(1) Create an ABAP domain named ZORDER_STATUS_DOMAIN containing status list as displayed in previous screenshot.

Then create an ABAP data element based on this domain.

Create one header database table as root,


image.png


and another database table as item.


(2) create two CDS views based on the two database tables accordingly:

image.png

Then the consumption CDS view:image.png

Now all are done except remaining work in ABAP side.


(3) Create a new project via tcode SEGW and include the activated consumption CDS view created in step2. If you don’t know how to do it, refer to this blog Enable CRM Service Order application with edit functionality.


Generate runtime artifacts. Now both DPC and MPC classes are generated.


3.1 Redefine DEFINE method of your MPC_EXT class:


image.png

image.png

The code above will generate the highlighted annotations which could be found in metadata:


image.png


3.2 Since in 3.1, the entity set OrderStatusEntitySet and entity type OrderStatus do not exist in SEGW project yet, so now we have to create them manually.

Just create them from context menu by clicking Entity Types and Entity Sets in SEGW:


image.png


Create properties for entity type:


image.png


And assign entity type to newly created entity set. After that regenerate runtime artifacts.


image.png


3.3 Since now framework knows it should display the value of order_status_text to render the drop down list, so we are responsible to provide framework with correct content.

Redefine method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_ENTITYSET of your DPC_EXT:

image.png

The method fill_status_text is responsible for filling the field order_status_text.


Note: if you comment out the line 40 and 46,


image.png


The annotation for order_status_text will become “standard”, instead of previous “fixed-values”.


image.png


In this case, this field will be rendered as F4 value help instead:


image.png


相关文章
|
1月前
SAP UI5 Link 控件的使用方法介绍 - 后续学习 Fiori Elements Smart Link 的基础试读版
SAP UI5 Link 控件的使用方法介绍 - 后续学习 Fiori Elements Smart Link 的基础试读版
15 0
|
1月前
|
UED
什么是 SAP Fiori 的 Technical Catalog 和 Business Catalog
什么是 SAP Fiori 的 Technical Catalog 和 Business Catalog
36 0
|
1月前
|
前端开发 UED
SAP Fiori 到底指什么
SAP Fiori 到底指什么
38 0
|
1月前
|
XML 前端开发 JavaScript
SAP Fiori Launchpad Custom Fields tile 里的 ABAP 语法高亮显示
SAP Fiori Launchpad Custom Fields tile 里的 ABAP 语法高亮显示
14 0
|
1月前
|
前端开发 搜索推荐 开发者
SAP UI5 sap.m.Column 控件的 minScreenWidth 属性介绍
SAP UI5 sap.m.Column 控件的 minScreenWidth 属性介绍
27 0
|
1月前
|
JavaScript 前端开发 开发者
SAP UI5 控件 sap.m.ListBase 的 inset 属性的作用介绍
SAP UI5 控件 sap.m.ListBase 的 inset 属性的作用介绍
15 0
|
1月前
|
Web App开发 数据采集 前端开发
纯技术讨论:如何让 SAP UI5 应用无法被别人在浏览器里调试 - 这种做法不推荐试读版
纯技术讨论:如何让 SAP UI5 应用无法被别人在浏览器里调试 - 这种做法不推荐试读版
15 0
|
1月前
|
XML 存储 数据格式
SAP UI5 控件 customData 属性的应用介绍
SAP UI5 控件 customData 属性的应用介绍
33 0
|
1月前
|
前端开发 JavaScript API
SAP UI5 sap.ui.require.toUrl 的作用介绍
SAP UI5 sap.ui.require.toUrl 的作用介绍
28 0
|
1月前
|
搜索推荐
如何让 SAP UI5 Smart Table 支持多项选择(Multiple-Selection)试读版
如何让 SAP UI5 Smart Table 支持多项选择(Multiple-Selection)试读版
18 0