Inbound plug of window receives data : Where to process in the view
I was going through this issue in the production system of a client. I will not use exact names and scenario and would stick to using general/technical terms.
In production system on click of a hyper link , navigation was happening to anther Web UI component.
I noticed that the transaction data from the source component was getting filled into a collection and it was getting passed to the inbound plug of the target component and the target component was getting launched.The code in the inbound plug of the target window was setting the received collection to the context node of the target component.
There was no issue in navigation.
The issue reported was that the target component was getting launched with the details of the previously confirmed transaction in source component.
If user had transaction A in source component, first time when the link was clicked ,the target component was not having any details about transaction A.
User goes back and click on transaction B in source component , this time the target component was getting launched with details of transaction A.
User goes back and click on transaction C in source component , this time the target component was getting launched with details of transaction B.
The root cause of the problem was the place in the target component/view at which the processing was being done from the context node.
Colleagues had redefined the method DO_VIEW_INIT_ON_ACTIVATION in the target component/view to process the data from the context node.
The SAP standard call stack showed that the method DO_VIEW_INIT_ON_ACTIVATION is called first and the IP_Inbound plug is called after wards.
The context was getting read in the view and processing was done and after that the inbound plug was setting the context with the correct received data.
Line 108 explains this in the SAP Standard method CL_CRM_UI_CORE_APPL_CONTROLLER->EXECUTE_NAVIGATION
We moved the processing from DO_VIEW_INIT_ON_ACTIVATION to DO_PREPARE_OUTPUT
which solved the problem.
I think the another way to solve the problem could have been to redefine the WD_USAGE_INITIALIZE in source component and bind the target context node from the source.
Hope this helps.