Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

I intend to show how easy it is to implement value lookup scenarios (F4 helps) in WebDynpro for ABAP (WDA). Using Search Helps attachments helps to implement various value lookup scenarios, eliminating the need to code for the same.

Before we begin with the scenarios, for your information, a search help can be attached at various levels:

1)       Directly attached to the component that intends to use the search help

2)       Attached to the table/structure being referenced or used in the component

3)       Attached to the data element of the component

Here I would like to demonstrate the use of search help attachments with dictionary structures, that are used in WDA component. 

Let us consider two scenarios:

Scenario 1

You have a category id in one database table say ZEP_RCA_CATE_TXT and sub-category id in a different database table say ZEP_RCA_SUBC_TXT with foreign key relationship with ZEP_RCA_CATE_TXT. Now you want to have F4 helps in WDA for category id and subcategory id such that the hit list for subcategory id must be filtered or narrowed based on the value selected for category id.

 

F4 help values for Category ID

 

 F4 help values for Sub-Category ID (displays all sub-categories as no value selected for category yet)




RCA2 selected for Category ID using F4 help. Now check the values for sub-category ID, only those are displayed that belong to the category ID RCA2.

Change the Category ID to RCA6, the list for sub categories is narrowed to those having RCA6 as the category ID.


 

Scenario 2:

Another very common requirement is to display description next to the input box with search help, for the code selected in the input box. See the example below, where based on the org unit selected, the corresponding org unit description must be displayed next to the input box. 

 


 

Solution

Let us see how simple it is to implement the above mentioned scenarios with Search Help attachments!

Scenario 1:

Step1: Since we have two different tables for category and sub-category, we would create two search helps. Note the import/export parameters of the search helps. 


The first search help provides the list of category IDs.

The second search helps takes the category ID as the input (import parameter). The WDA component would receive the categroy ID value selected using the first search help and would pass it to this importing parameter of the second search help.

 

Step 2: The WebDynpro component uses structure ZEP_STRUCT_LPO_RCA_CHITS, to create view context RCA.


The context node RCA is bound to the view UI elements.

Next, attach the search helps created in Step 1 to this structure in the following way:
 


Okay so the search helps have been attached to the structure.

Note that the fields RCA_CATID and RCA_CATID_TMP refer to the same entity i.e. category id. We need to use a temporary field in this case to keep a copy of the value selected in RCA_CATID. This temporary field as shown above is a part of the second search help attachment. This is done because category id is required in the second search help too as the importing parameter, to restrict sub categories based on it. Here, two search helps have been used for simplicity; the same can be achieved by using one search help and implementing the seach help exit.

Step 3: Since the OnChangeof event is not yet available for the input field UI element,  we need to write code in the wddomodifyview method of the view, to assign value of the context attribte RCA_CATID to RCA_CATID_TMP .

METHOD wddomodifyview .
DATA lo_nd_rca TYPE REF TO if_wd_context_node.
DATA lo_el_rca TYPE REF TO if_wd_context_element.
DATA ls_rca TYPE wd_this->element_rca.
DATA lv_rca_catid_tmp LIKE ls_rca-rca_catid_tmp.
DATA lv_rca_catid LIKE ls_rca-rca_catid.
*navigate from <CONTEXT> to <RCA> via lead selection
lo_nd_rca = wd_context->get_child_node( name = wd_this->wdctx_rca ).
*get element via lead selection
lo_el_rca = lo_nd_rca->get_element( ).
*get single attribute
lo_el_rca->get_attribute(
EXPORTING
name = `RCA_CATID`
IMPORTING
value = lv_rca_catid ).
MOVE lv_rca_catid TO lv_rca_catid_tmp.
*get single attribute
lo_el_rca->set_attribute(
EXPORTING
name = `RCA_CATID_TMP`
value = lv_rca_catid_tmp ).
ENDMETHOD.

Step 4: You are all set to use the context on the view layout and test the output!


Scenario 2:

Step 1: Similar to scenario 1, we would need a search help. In this case we have a standard SAP search help H_T527X that can be attached to the structure ZEP_STRUCT_T527X being used in WDA.

 

Step 2: Now its just the matter of using this structure in WDA view context, and placing the required UI elements like input box and text view on the view layout and binding them to the view context!

 

Simple! Isn't it? (smile)

5 Comments

  1. Guest

    Hi Chitrali,

    This is very useful blog. It help me to complete my work quickly and easily.

    Keep writing such useful blogs. (smile)

    Regards,

    Vikram

  2. Former Member

    Hey It was good to implement.............. 

  3. Guest

    Hi Chitrali,

    I am learning Web Dynpro for ABAP & this is very useful.

    It is good to implement for the custom, how about the standard like sales organization (VKORG)  & distribution channel  (VTWEG).

    Regards,

    Sangeetha K

  4. Former Member

    Hi Chitrali,

    This is very useful post. It helped me in learning the input field search help filtering.

    Actaually if I need 4 search help filtering similar to the above post then the process will be same or different please suggest.. actually I tried something but till now no luck.. can you please share your idea on this doubt...

    Thanks ,

    Sekhar

  5. Former Member

    Hi Chitrali,

    we are unable to see your screen shots can U attech them properly?