In this tutorial i demonstrated the necessity of "freely programmed input help" and how to develop the same.
Generally most of the fields in the SAP system will have input help available,but in certain cases the available input help will not suite our requirement or the selection criteria in that will be a complicated one,so to match our requirements the availabe option in webdynpro ABAP is the "freely programmed input help"
In this tutorial i will explain how to use this "freely programmed input help" for the costcenter field,I referred shruti's blog for the purpose of explanation..
kindly refer to my code tutorial https://wiki.sdn.sap.com/wiki/display/WDABAP/Organization+Hierarchy+in+TREE+structure+as+F4+help developing the component which displays the costcenter in a tree structure
On clicking the Freely programmed input help for the costcenter we will get the following selection screen
By selecting any one of the costcenter will trigger an event which leads to displaying the selected value in the input field
Steps to be followed:
1.Declare the component ZWDT_TREE (https://wiki.sdn.sap.com/wiki/display/WDABAP/Organization+Hierarchy+in+TREE+structure+as+F4+help)in the used component list in your webdynpro component
2.In the Properties tab of your view in which the "freely programmed input help" has to be implemented, declare the usage of the ZWDT_TREE interface controller in the "used Web Dynpro Controller" list.
3.In the View controller's context, in the attribute to which "freely programmed input help" has to be provided, select "Freely programmed" as Input Help Mode and select the "freely programmed input help" Component decalred in the "freely programmed input help" Component usage through the help given to the right.
4.Declare the event handler method in the Method tab of the view that subscribe to "freely programmed input help" event.
5. Implement the following code in the event handler method declared above.
method DATA_SELECT .
data: l_node type ref to if_wd_context_node,
l_data_selected type if_v_main=>element_vh_data_selected.
l_node = wd_context->get_child_node( 'VH_DATA_SELECTED' ).
static_attributes = l_data_selected ).
l_node = wd_context->get_child_node( 'COSTCENTER_NODE' ).
l_node->set_attribute( name = 'OBJID'
value = l_data_selected-OBJID ).