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的原创文章,请关注公众号"汪子熙":
相关推荐
SAP ABAP Web dynpro 跟踪调试工具的讲解。
Floor Plan Manager - ABAP Webdynpro
SAP ABAP webdynpro实例
Floorplan Manager for Web Dynpro ABAP-basic FPM 基本概念
本节中主要记录WebDynpro For ABAP的基础操作.如各种UI Elment的使用,Context的使用等.
Web-Dynpro-for-ABAP开发讲解v2.0PPT文档.pptx
ABAP Web Dynpro调用BAPI
webdypro abap test tool
ABAP_WebDynpro开发(中文) 学习webdynpro开发可以看看 很有效果!
SAP ABAP WEBDYNPRO HELLO WORLD
Web_dynpro-关于WEBDYNPRO的编程开发(一) ABAP-FOR ALL ENTRIES IN 注意点 ABAP-根据T-CODE找BADI ABAP-根据T-CODE找BAPI ABAP-UPLOAD文件时常用的数据转换 关于using和changing 程序之间的调用 报表中所用到的...
SAP Web Dynpro for ABAP 图片上传及使用
WebDynpro for ABAP WebDynpro for ABAP WebDynpro for ABAP WebDynpro for ABAP
SAP-ABAP-CRM-Web-Dynpro-UI5-FIORI教程 分步式CRM教程和一些有用的代码段/片段。 请随时使用和分享。
一个web dynpro的简单例子教会你SAP web dynpro的原理和如何使用。。。
web dynpro for abap 的官方学习文档 web dynpro for abap 的官方学习文档 web dynpro for abap 的官方学习文档
本人原创,详细讲述了Webdynpro中上传下载附件控件的使用方法,是很好的Webdynpro入门教程。
SAP WEB Dynpro for ABAP 简单ALV 展示 SAP WEB Dynpro for ABAP 简单ALV 展示SAP WEB Dynpro for ABAP 简单ALV 展示
ABAP - Keyword Documentation This documentation describes the syntax and meaning of the keywords of the ABAP language and its object-oriented part ABAP Objects. Alongside this, language frameworks ...
Webdynpro for abap,描述了webdypro的框架和开发所使用的类等