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的原创文章,请关注公众号"汪子熙":
- mybatis 针对SQL Server 的 主键id生成策略
- 算法 | 排序算法图形化比较:快速排序、插入排序、选择排序、冒泡排序
- WCF 添加 RESTful 支持,适用于 IIS、Winform、cmd 宿主
- 在CentOS 7上安装Nginx服务器
- 卷积神经网络 | 深度学习笔记1
- 【直播】我的基因组65:看看哪些基因的突变较多,哪些较少
- angular之interceptors拦截器
- js list数据 转 树状 层级 JSON,递归生成树状 层级 JSON
- jquery 图片文件转base64 显示
- AngularJS 用 $http.jsonp 跨域SyntaxError问题
- 简单的java socket 示例
- Hadoop二次开发环境构建
- Android EditText 获得输入焦点 以及requestfocus()失效的问题
- 【直播】我的基因组68:看看哪些基因的突变较多,哪些较少
- 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 数组属性和方法
- Linux中的iostat命令使用教程
- 深入解读Linux进程函数fork(),vfork(),execX()
- Linux centos下设置定时备份任务的方法步骤
- Linux 中如何切换相同程序的不同版本
- Linux中查看指定文件夹内各个子文件夹内的文件数量
- Linux系统中 /etc/fstab 文件的深入解读
- bash命令使用详解
- 实例详解Linux 中的命令链接操作符
- Python 为什么不支持 switch 语句?
- centos安装jdk1.8时出现没有/lib/ld-linux.so.2:这个文件的原因分析
- Linux多线程编程快速入门
- Linux添加swap分区的方法
- linux下vsftpd的安装及配置使用详细步骤(推荐)
- Linux分区格式化的命令
- Linux调试工具GDB使用简易教程