ABAP Webdynpro - 如何使用用户自定义的value help
For input attribute totally five input help mode could be selected. In most of time we would always like to leverage the existing dictionary search help defined in DDIC. However if existing one could not fulfill our requirement, we have to develop our own value help by ourselves.
I have used a simple example to demonstrate how to use “Freely Programmed” input help mode.
I have one consumer component ZCONSUMER, and one component ZUSER_HELP. ZCONSUMER just have one input field for post ID and post description. When click value help of Post ID, the view of ZUSER_HELP will be opened and there is a SQL select to fetch the description according to post ID from database table.
(1) in ZUSER_HELP, create the context node with attribute ID for post id, and description for post description. Since I use external mapping for data transfer from consumer component to value help provider component, so I mark the flag “Input Element(Ext.)”. Define the node as interface node.
(2) Implement the standard component interface IWD_VALUE_HELP. Redefine the method SET_VALUE_HELP_LISTENER. Also include your own value help view into the interface view WD_VALUE_HELP.
In the method SET_VALUE_HELP_LISTENER, I select the post description from database table and store it to attribute DESCRIPTION. The listener reference is also stored into member variable of component controller for later usage.
method SET_VALUE_HELP_LISTENER .
data: lv_id type socialdata-internal_id,
lv_text type socialdata-socialposttext.
wd_this->mr_listener = listener.
data(lo_node) = wd_context->get_child_node( IF_COMPONENTCONTROLLER=>wdctx_post ).
CHECK lo_node IS NOT INITIAL.
lo_node->get_attribute( EXPORTING name = 'ID' IMPORTING value = lv_id ).
SELECT SINGLE socialposttext INTO lv_text from socialdata where internal_id = lv_id.
CHECK sy-subrc = 0.
lo_node->set_attribute( name = 'DESCRIPTION' value = lv_text ).
endmethod.
(3) Draw a button in value help view to close the value help popup window once clicked. Just use the reference stored in step2 to close window.
method ONACTIONCLOSE .
wd_comp_controller->mr_listener->close_window( ).
endmethod.
(4) in consumer component ZCONSUMER, create component usage to ZUSER_HELP, and create context node POST. Choose Input help mode Freely Programmed and choose component usage ZUSER_DEFINE_HELP from value help.
Create an interface controller usage on component usage ZUSER_DEFINE_HELP and finish the context node mapping, or else you will meet with runtime error “External mapping of Node ZUSER_HELP#COMPONENTCONTROLLER.CONTEXT.POST is Not Completed yet”.
Now once clicked the value help icon of input field Post ID, the value help window provided by component ZUSER_HELP will pop up automatically.
And once close button is clicked, the description field of consumer component will be filled.
要获取更多Jerry的原创文章,请关注公众号"汪子熙":
- JDK8 stream toMap() java.lang.IllegalStateException: Duplicate key异常解决(key重复)
- 如约而至,Java 10 正式发布!
- Intellij IDEA查看所有断点
- Spring Boot国际化支持
- 有记忆会推理的可微分神经计算机,DeepMind现在开源了代码
- Spring Boot整合Thymeleaf模板引擎
- Spring Boot实现热部署
- Java中的宏变量,宏替换详解。
- 类、变量、块、构造器、继承初始化顺序,终极解答。
- Spring Boot Debug调试
- Maven精选系列--classifier元素妙用
- PostgreSQL里面的一些命令小结
- Java中创建String的两道面试题及详解
- PostgreSQL主备环境搭建
- 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 数组属性和方法
- Redis入坟(二)高级特性,发布订阅、事务、Lua脚本
- 使用OpenCV对运动员的姿势进行检测
- Redis入坟(三)Redis为什么这么快?
- Redis入坟(番外篇)配置文件redis.conf,解析每个参数的含义
- 使用OpenCV自动去除背景色
- Redis入坟(四)Redis内存回收知多少
- Redis入坟(五)持久化
- Python爬取杜赛博客教程内容,应用pdfkit打印pdf文件
- Java程序员必须知道的常用序列化技术及选型,Protobuf 原理详解
- Python异步编程之 协程 & asyncio & 异步
- Redis入坟(八)内存管理与优化,面试必考
- 逐行阅读Spring5.X源码(十二)AOP源码分析,难!面试官都不一定懂!
- 逐行阅读Spring5.X源码(十三)spring事务源码分析
- 线程池ThreadPoolExecutor 源码分析,面试官也就那么回事,他怎么敢!
- Spug - 轻量级自动化运维平台