前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ABAP Webdynpro - 如何使用用户自定义的value help

ABAP Webdynpro - 如何使用用户自定义的value help

作者头像
Jerry Wang
发布2020-08-06 20:26:40
6780
发布2020-08-06 20:26:40
举报

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.

代码语言:javascript
复制
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.

代码语言:javascript
复制
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的原创文章,请关注公众号"汪子熙":

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2020-08-05 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档