"calling the outbound plug of the view to start the navigation.
op_tooverviewpage( ).
ENDMETHOD.
复制代码
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.
Logic:
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.