Friday, 24 May 2013


Go to the event handler of result view EH_ONOBJECTID and do the following modifications to set the data in the custom controller context node. 


1.            We need to find out on which record user has clicked in the result view and we will read that record.
2.            Get the instance of custom controller.
3.            Add the found record in the first step to the context node of custom controller. 

go to the event handler and do the following changes in the code. 

Getting correct type record needs understanding the MODEL. In our case, lr_clickedrecord is of type Query Result Object BTQRSrvCon. But in the header view in the over view page and header context node of custom controller, we used BTAdminh entity. So we cannot add BTQRSrvCon directly.

We need to find out the BTAdminh from BTQRSrvCon. In these situations, we will use relationships between entities. We need to take a look at the MODEL. Based on the model, we will have to know what are the relationships that we have to use to fetch the required entities.

If we observe carefully, from the Query Result Object BTQRSrvCon, there is a relation ‘Association BTADVSSrvCon Child Cardinality 1’ to the Root Object BTOrder.

Again from Root Object BTOrder, there is relation ‘Composition BTOrderHeader Child Cardinality 1’ to the Access Object BTAdminH, which we required.

This is what exactly we have done in the coding. First we fetched the Border and then from the BTOrder, we fetched BTAdminH.

Don’t worry if you scared after reading this. Understanding model and writing code in BOL will require patience and time. The more practice you do , the more you gain.

What we need to remember is, get_related_entity will fetch the required entity from source entity based on the relation name.

We have completed the coding part as well. Go and test the application. Now we can see the data in the header view.

If we observe, the title of the page does not suit to the page as we are not searching for any contracts on this screen.

Back button at top right corner is disabled. Once we move from the search to overview page, there is no way to go back. Let us solve this first as it will take less time.

1 comment:

  1. hello sir,
    thanks for this great article.
    But first two images are not visible please post code that images contains.