Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
JerryWang
Advisor
Advisor
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.

http://farm6.staticflickr.com/5492/11335713166_6e345e0939_o.png

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.

http://farm8.staticflickr.com/7369/11335713086_6a508d0bef_o.png

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.

http://farm8.staticflickr.com/7428/11335780363_2e56ff9e0a_o.png

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.

http://farm6.staticflickr.com/5503/11335642695_ba0efd36b4_o.png

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.

http://farm3.staticflickr.com/2856/11335738714_8032846b54_o.png

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".

http://farm6.staticflickr.com/5493/11335642515_1852cde887_o.png

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.

http://farm8.staticflickr.com/7434/11335780243_5af7ea660a_o.png

And once close button is clicked, the description field of consumer component will be filled.

http://farm3.staticflickr.com/2858/11335738604_3bde2f0b4d_o.png