Using Importing/Exporting Search Help Parameters in Web Dynpro ABAP
Overview
When providing search helps for View fields, developers frequently need to achieve two things,
- Pass into the search help importing parameters to restrict the search help values.
- On return from the search help, populate multiple View fields based on the value selected in the search help.
Both things are possible by defining your context node to have a dictionary structure whose components use the same search help. This article shows the step-by-step procedure both to pass multiple View field values to a search help’s importing parameters and to pass multiple search help exporting parameters to a View’s fields.
Scenario
You require an employee search help that allows the user to restrict search help values based on values the user enters into three View fields: Personnel Number, First Name and Last Name. The View must also populate these three fields, Personnel Number, First Name and Last Name, based on the employee selected in the search help.
Procedure
1.0 Create an Elementary Search Help
Create an elementary search help having the import and export parameters you plan to use in the View. In this example, we use search help Z_EMPLOYEE_SHLP_DEMO, which both imports and exports Personnel Number, First Name and Last Name.
2.0 Create a Dictionary Structure
Create a structure in the data dictionary having the same fields that are imported and exported by the search help. Here, we name the structure ZEMPLOYEE_DEMO_S. On the Entry help/check tab, assign the same search help, Z_EMPLOYEE_SHLP_DEMO, to each component. This creates a mapping between the search help parameters and the structure components.
3.0 Create the Context Node
In the COMPONENTCONTROLLER context, create a node named EMPLOYEE and assign it dictionary structure ZEMPLOYEE_DEMO_S. Use the Add Attribute from Structure button to add each of the components of the structure to the node as attributes.
4.0 Create the View Layout
Map the EMPLOYEE node from the COMPONENTCONTROLLER context to the View context. Using the Form Template wizard, create input fields for the three context attributes, Personnel Number, First Name and Last Name.
5.0 Create and Run the Web Dynpro Application
Create a Web Dynpro Application and run the application.
Result
Values the user enters in the Personnel Number, First Name and Last Name input fields are passed into the search help as importing parameters. After clicking the Start Search button and selecting a record from the search help hit list, each of the search help’s exporting parameters are mapped automatically to the context attributes, populating each of the Personnel Number, First Name and Last Name input fields.
Hi Amy,
is there restriction of node cardinality to 1:1.
regards
jitendra
Hi Jitendra,
The search help actually acts on an element (or an attribute) of a node, so the node itself can have any cardinality.
Cheers,
Amy
I create a node with 0.n cardinality and 3 subnode with cardinality 0.n.
In one of the subnode i need to assgin suggestive search on one attribute and at same time needs to assign value to other attribute.its showing me correct result but result display are not binding with other attribute other then attribute at which suggestive search is assign on selecting.
Hi Jitendra,
Do you mean that upon selecting a value from the InputField's suggested values, you want the other attributes to auto-populate based on the suggested value? I don't believe it is possible to affect the behavior of suggest values like that. The suggest values behavior of an InputField doesn't take into account other attributes that may be exported by the same search help.
Unfortunately you also cannot do this programmatically using a hook method because suggest values doesn't adhere to the phase model. From the documentation on Proposals for InputFields:
Cheers,
Amy
Hi Amy,
i have created a structure which has same import and export parameters as in the search help , created a context node and field binding as you have explained.
what could be wrong , plz help
Hi Amy,
Nice Post. I have a user requirement to hide below highlighted fields of OVS popup.
Kindly suggest if that is possible.
Thanks in Advance.