DESIGNING LAYOUT:When we created the search view, framework automatically creates one .htm page for us. We will use this page to show the output to the user.
BSP technology supports HTML. But in SAP has developed new tags which will make developer work very easy.
For all advance search pages, we use <thtmlb: advanced Search> tag to display the input fields. User will enter the selection criteria using these search fields.
Just double click on SEARCHPAGE.htm and add the following tag in that page.
SearchPage.htm:
When you do syntax check, it will throw some errors.
Why?
Obviously, this tag has certain properties for which we need to use some methods. These methods do not exist in our class.
What to do?
Here we need to know one important thing that every normal view controller in the WEB UI is inheriting one class I.E CL_BSP_WD_VIEW_CONTROLLER.
Double click on view implementation class, go to properties, you can see ‘ZL_ZTUTCOMP_SEARCHPAGE’ as super class. Double click on it again and in the properties tab you can find CL_BSP_WD_VIEW_CONTROLLER as super class.
For normal view, this class is enough. For search view, SAP has provided another special controller that we need to use to give correct input to the ADVANCEDSEARCH tag.
All we need to do is , change the super class of ZL_ZTUTCOMP_SEARCHPAGE from CL_BSP_WD_VIEW_CONTROLLER to ‘CL_CRM_BP_ADVSEARCH_CONTROLLER’. This class provides the methods GET DQUERY DEFINITIONS and GET POSSIBLE FIELDS.
Go to the class and change to edit mode. Go to the properties tab. Change the description and click on CHANGE INHERITANCE button. Give the class as above mentioned. Choose yes in the next popup.
We are not finished yet, again go to the .htm page and repeat the syntax check. It will throw one more error. This time error related to the context node SEARCH.
System will add the context nodes to the .htm page as properties. So that we can use the methods or attributes of context node class.
Here also our context node is not a normal context node. It is a search context node.
All general context nodes classes have ‘CL_BSP_WD_CONTEXT_NODE’ as super class. If they are table type context nodes, then they have ‘CL_BSP_WD_CONTEXT_NODE_TV’ as super class.
However search type context nodes need to have ‘CL_BSP_WD_CONTEXT_NODE_ASP’ as a super class. This class will provide necessary methods for doing advanced search.
Change the super class of the context node class ZL_ZTUTCOMP_SEARCHPAGE_CN00.
Save and activate the class.
Now go to the .htm page, we won’t any syntax errors. Activate the page. Now we almost finished the search view.
We can test it now. Come back the component and press on test application button. It will invoke new browser session. Give user id and password to complete the authentication.
OOPS. I could not see any output. It’s a blank page.
BSP technology supports HTML. But in SAP has developed new tags which will make developer work very easy.
For all advance search pages, we use <thtmlb: advanced Search> tag to display the input fields. User will enter the selection criteria using these search fields.
Just double click on SEARCHPAGE.htm and add the following tag in that page.
SearchPage.htm:
Why?
Obviously, this tag has certain properties for which we need to use some methods. These methods do not exist in our class.
What to do?
Here we need to know one important thing that every normal view controller in the WEB UI is inheriting one class I.E CL_BSP_WD_VIEW_CONTROLLER.
Double click on view implementation class, go to properties, you can see ‘ZL_ZTUTCOMP_SEARCHPAGE’ as super class. Double click on it again and in the properties tab you can find CL_BSP_WD_VIEW_CONTROLLER as super class.
For normal view, this class is enough. For search view, SAP has provided another special controller that we need to use to give correct input to the ADVANCEDSEARCH tag.
All we need to do is , change the super class of ZL_ZTUTCOMP_SEARCHPAGE from CL_BSP_WD_VIEW_CONTROLLER to ‘CL_CRM_BP_ADVSEARCH_CONTROLLER’. This class provides the methods GET DQUERY DEFINITIONS and GET POSSIBLE FIELDS.
Go to the class and change to edit mode. Go to the properties tab. Change the description and click on CHANGE INHERITANCE button. Give the class as above mentioned. Choose yes in the next popup.
We are not finished yet, again go to the .htm page and repeat the syntax check. It will throw one more error. This time error related to the context node SEARCH.
System will add the context nodes to the .htm page as properties. So that we can use the methods or attributes of context node class.
Here also our context node is not a normal context node. It is a search context node.
All general context nodes classes have ‘CL_BSP_WD_CONTEXT_NODE’ as super class. If they are table type context nodes, then they have ‘CL_BSP_WD_CONTEXT_NODE_TV’ as super class.
However search type context nodes need to have ‘CL_BSP_WD_CONTEXT_NODE_ASP’ as a super class. This class will provide necessary methods for doing advanced search.
Change the super class of the context node class ZL_ZTUTCOMP_SEARCHPAGE_CN00.
Save and activate the class.
Now go to the .htm page, we won’t any syntax errors. Activate the page. Now we almost finished the search view.
We can test it now. Come back the component and press on test application button. It will invoke new browser session. Give user id and password to complete the authentication.
OOPS. I could not see any output. It’s a blank page.
Why?
Let us discuss it in the next chapter.