使用SAP C4C自定义BO association创建动态下拉列表
My series of Cloud Application Studio Blogs
- How to detect EditMode in an Embedded Component
- Step by step to enable your custom BO with attachment upload functionality
- Step by step to create an Adobe Print form in Cloud application Studio
- How to render PDF which displays picture from the image attachment of your custom BO
- How to get current logged on business user’s employee information and assigned organization unit via ABSL
- How to implement dynamic access control based on custom BO using OWL
- How to make Code List Restriction work when control field and restricted field are not on the same BO
- How to implement custom number range using custom business object
- Two approaches to create Code List in Cloud Studio
- Create Dynamic Code List via Custom Business Object Association
- Create Dynamic Code List via Custom Business Object Association
In my previous blog Two approaches to create Code List in Cloud Studio I introduce two different approaches to build Code List via Cloud Application Studio. Both solution will finally create dedicated data type under the hood for Code List.
In this blog, I will introduce the third approach to build a kind of dynamic Code List without using dedicated data type. Dynamic Code List means for the same BO, instance A could have drop down list for example 1,2,3 and another instance B has list as A, B, C. In productive scenario this dynamic behavior could be helpful if you would like to achieve that different BO instance has different Code List based on their transaction type for example.
The main idea of this solution is to use a dedicated Business Object serving as the data source of the Code List defined in a Hosting BO. So we have to create these two BOs separately.
(1) Create a Code List BO:
import AP.Common.GDT as apCommonGDT;
businessobject JerryCodeList {
[AlternativeKey] element CodeListBOID: ID;
node CodeList[0,n] {
element Code:NumberValue;
element CodeText: LANGUAGEINDEPENDENT_ENCRYPTED_EXTENDED_Name;
}
}
Activated the BO and create the corresponding UI. In OWL I can list all existing Code List instance:
In Thing Inspector UI, use AdvancedListPane to allow users to maintain Code List entries:
Now for Code List instance JERRY1, I have three entries maintained:
And for JERRY2, I have four entries maintained:
(2) Create a host BO, which should have one field holding the reference to the corresponding Code List BO. Within this BO, define an association to Code List BO.
import AP.Common.GDT as apCommonGDT;
businessobject MainBO {
[AlternativeKey] element MainBOID: ID;
element OrderName: LANGUAGEINDEPENDENT_ENCRYPTED_EXTENDED_Name;
element OrderStatus: NumberValue;
element CodeListBOID: ID;
association ToCodeList [0,1] to JerryCodeList using CodeListBOID;
}
Create AfterModify event and implement the association there:
import ABSL;
if( !this.CodeListBOID.IsInitial() && !this.ToCodeList.IsSet() ){
var codeListQuery = JerryCodeList.QueryByElements;
var para = codeListQuery.CreateSelectionParams();
para.Add( codeListQuery.CodeListBOID, "I", "EQ", this.CodeListBOID);
var result = codeListQuery.Execute(para);
this.ToCodeList = result.GetFirst();
}
(3) In the Thing Inspector UI of the host BO, create a new Data List and bind it to the CodeList node in BO model. Bind data field Code and CodeText accordingly as displayed in the screenshot below.
The OrderStatus field in Data structure should be bound to BO field OrderStatus as well. And the CCTS Information and CodeList properties for the data field should be set as below.
The last step: bind the UI element to the OrderStatus field.
Once done, when you create BO instance A and bind it to Code List instance JERRY1,
it will have Code List from JERRY1:
The same logic works for instance B which displays Code List from JERRY2:
- Mybatis传多个参数(三种解决方案)
- 语义化HTML:i、b、em和strong标签
- JSON入门指南--服务端处理JSON
- 纸上谈兵: 图 (graph)
- 纸上谈兵: 拓扑排序
- MyBatis Generator自动创建代码
- Maven(六)之依赖管理
- 细说log4j
- SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoade
- TCP/IP(一)之开启计算机网络之路
- JSON入门指南--客户端处理JSON
- mysql5.7 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
- TCP/IP中你不得不知的十大秘密
- Java Web开发学习之路2012版
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- Python爬虫基础
- Python算法基础
- pytorch读取一张图像进行分类预测需要注意的问题(opencv、PIL)
- 【LeetCode】旋转数组的最小数字day08
- 【原创】Spring Boot集成Redis的玩法
- 当前页面是否可见
- 【LeetCode】两数之和day09
- 【原创】SpringBoot快速整合Thymeleaf模板引擎
- 【leetCode】打印从1到最大的n位数day10
- 你真的了解Java中的String吗(也太菜了)?
- 【设计模式】变化和不变化的代码进行分离day01
- isObject
- 【leetCode】股票的最大利润day12
- Spring Boot 集成 Druid 监控数据源
- 文本分类实战(八)—— Transformer模型