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