Friday, 24 May 2013

21.CREATING A SEARCH VIEW


SEARCH VIEW:

Visiting any transaction information first requires a search. We need to search the required business object, and then we can view its information.

Let us build a search view, which will give us an ability to search service contracts.

VIEW


A block that is used to display the certain information on the WEB UI.  In the entire component hierarchy view comes at the bottom place.

Every view has one controller class. Generally we call it as view implementation class. The class name generally ends with *IMPL suffix.

In order to display any view on web ui, it must be assigned to either window or to VIEW SET ( here again VIEW SET must be assigned to the WINDOW).

Open the component and click on component structure browser and right click on VIEWS and select the view. We can see another option ‘CREATE SEARCH PAGE’. This is a new feature available EHP 1. As we want to know the concepts, choose just ‘CREATE’ option. 



Enter view name and choose continue. 


In the next step, we need to add the model node.

MODEL NODE:
Any context node that is based on any BOL entity, is called Model node.

VALUE NODE:
Any context node that is not based on any BOL entity is called VALUE NODE.

Here we will add model node because we have bol entity. Here we are going to create search page. So we will select a BOL entity that will help us to search the contracts. We will look for objects that belong to dynamic search objects category in the one order MODEL.

Enter the context node name and choose the BOL entity as shown below.  Once you entered the details choose continue. 


BTQSrvCon is a dynamic search object used to find service contracts.  We can check it in the GENIL MODEL BROWSER transaction in the ONEORDER component set , under the DYNAMIC QUERY OBJECT node. 

In the next step, we need to enter the value node. However we are not dealing with any value node here, just press continue until you reach the last step ‘SELECT VIEW TYPE’ as shown in the below screenshot. Select the view type as EMPTY and complete the wizard. In the last complete step, it will summarize the all details , that we have entered so far. 

Then we will be asked to save the view. If we observe carefully, we can see the framework will create certain classes.

Context node class.
ZL_ZTUTCOMP_SEARCHPAGE_CN00
Just double click the newly created view, all the classes that were created will be presented in the tree hierarchy. At bottom , we have context node class. This class will hold the data for our view. We can see all attributes of BOL entity that we added under this class. This class will have most important attributes and methods to manipulate the data. 







Context class.

ZL_ZTUTCOMP_SEARCHPAGE_CTXT

Every view will have one context class controller, ends with *CTXT suffix.  If there is any context node exists, then it will be an attribute of this context class. Here we have one context node SEARCH; we can see this node as property of above class. Just double click on the context class. 



View implementation class

ZL_ZTUTCOMP_SEARCHPAGE_IMPL.

This is main view controller and will be responsible for handling all events raised in the view. The context class will be an attribute of view controller.  We can in the below screen shot the context class became an attribute with the name TYPED_CONTEXT. 



So in order to access any context node from a method in the view controller, generally we see the below syntax.

ME->TYPED_CONTEXT->SEARCH (here ME refers instance of view controller class).  You can find this syntax in almost all UI components.

So far we have designed just controllers. We did not design anything that user can see on the screen that is layout. We will design the layout  in the next chapter.

7 comments:

  1. I am not able to double click on the view IMPLEMENTATION CLASS. It is saying object type doesnot exist. Please help me so that i can see it.

    ReplyDelete
    Replies
    1. Go out and come back by typing transaction BSP_WD_CMPWB and enter component name. Sometimes we have issue while loading component.

      Delete
  2. Hello,
    In View Implementation class i can't find attribute TYPED_CONTEXT. I have restarted transaction BSP_WD_CMPWB but still I could not find. Please help me

    ReplyDelete
    Replies
    1. Hello Sampath,

      Check if you have unchecked filter option.

      Delete
  3. If you are getting an error "BOL entity does not exist" on the Add Model Node section, make sure you have exited and gone back in after adding and saving your Model Node from the previous tutorial/page.

    ReplyDelete
  4. can u explain search empty view configaration in advanced search

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete