Friday, 24 May 2013

25.FETCHING THE DATA IN EVENT HANDLER



Here we are going to fetch the data based on the selection criteria. One important point to keep in mind is, we never use any select queries at the UI level (some exceptional cases may be there). 

We use BOL programming to search, retrieve, update, and delete the data. 

We will discuss BOL programming in detail in later chapters. There are some predefine steps to search any data from the UI using BOL programming. 


Open the event handler search and paste the following code. 





An instance of any dynamic search object can be represented as using the class 

CL_CRM_BOL_DQUERY_SERVICE.  If we remember, we used dynamic search object BTQSrvcon to create the context node.  So we declared one reference variable lr_selcriteria. 

Generally user will enter some selection criteria and then press SEARCH button. So these selection criteria we need to read from the context node SEARCH. 

  LR_SELCRITERIA?= ME->TYPED_CONTEXT->SEARCH->COLLECTION_WRAPPER->GET_CURRENT ( ).


Above line does exactly same thing. It will give the selection criteria details in the form of instance of class CL_CRM_BOL_DQUERY_SERVICE and that instance we are taking into variable lr_selcriteria.

Next we will fire the method GET_QUERY_RESULT to retrieve the records that match with the selection criteria.  This method returns the records in the form of collection (just understand collection as container that holds the records) and we are taking that collection into LR_RESULT of type IF_BOL_BO_COL.

Now we have the data. 

Oops, where to display this data. Yes we forgot to create one more view to display this results. Let us create result view in our UI component.
 

1 comment:

  1. Good.
    how to set some value to a field in oppurtunity page if save is clicked. If cancel is clicked some other value to that field.

    ReplyDelete