In this blog I will talk about how to create a search view and search result.
This blog will touch all the topics covered so far starting from the component creation.
Step1: In tr. BSP_WD_CMPWB create a new component and assign the model “ALL” as shown below.
Step2: This step is more for your concept. Look for the BOL model Browser –> The Query result Object is BTQR1Order the root object is BTOrder and the relation is via BTADVS1Ord.
Step3: Create a custom controller, Add the BOL entity BTQR1Order which is the query result and then complete the wizard.
Step4: Now create a context node BTOrder
Here you know the reason why I have used Higher-LvlContextNode = BTQR1ORDER and BOL Relation = BTADVS1Ord. If not then check the step 2 again. After completing the wizard you should see the Newly added context node in the tree as shown below.
Step5: Create a view for search purpose
Skip the attribute section. Create Links to custom controller:
- Pick the result context node from the dropdown created above
- Select the UI component in which you are working(ZVKS)
- Select the Custom Controller QueryCuCo by suing F4
- Select the context node for result created above
Select view type empty and complete the wizard
One thing you must have noticed that the wizard has generated the binding code for you.
Step6: Now create a view for search result
Add 2 Model Nodes as shown below
Skip the attribute section. Create Links to custom controller
Choose view type = table view and complete the wizard
Step7: Create a ViewSet
Give some name e.g. SearchVS , Enter 2 for lines and 1 for column
Define View are one for search view and one for search result view and complete the wizard.
Step8: Put the views and viewset together and make it available at runtime
- Go to runtime repository in edit mode
- Set the window as default.
Enable the display of the ViewSet at runtime by right clicking on the view MainWindow and additing the ViewSet.
Assign the views to the view set and save your changes
Step9: Now in order to get some basic F4 helps without additional coding efforts change the inheritance of search view as shown below
Change the highlighted class with class CL_BSP_WD_ADVSEARCH_CONTROLLER as shown below
Now change the inheritance of the class of search context node with class CL_CRM_UIU_BT_ADVS_CN
Step10: Replace the htm coding of the search view by following coding
Now you can do configuration of the search view. Start the transaction BSP_WD_CMPWB again and the configuration tab should appear for the view
Adjust the search result view
Now you can do configuration of the search result view
Adjust the viewset
The reason why I used ‘Query’ and ‘Result’ in the above code is the view area defined in the view set
Now create an event on the search page to react on the search button
Implement the hyperlink for the attribute OBJECT_ID
You can test your application now
This is what we have achieved so far