Hi everyone,
I have a custom quotation search page containing an extra column (quotation-ID) that:
- shows the quotation id
- acts as a link
- points the user to a completely custom screen
In this custom screen I need to access the GUID of the selected quotation. Here's how I solve this:
Event handler -- called when user clicks Quotation ID
Using dynamic navigation, I redirect the user to the page containig my custom UI object type 'ZREA_FOLLOW_BCG', and I pass along the quotation that was selected, the entire entity. (see partly code below)
CALL METHOD cl_crm_ui_descriptor_obj_srv=>create_entity_based
EXPORTING
ir_entity = lr_entity
iv_ui_object_type = 'ZREA_FOLLOW_BCG'
iv_ui_object_action = 'B' "display
RECEIVING
rr_result = lr_desc_object.
Inbound Plug -- fired when navigating
I created an inbound plug 'IP_FROM_SEARCH' in my custom window. In SPRO I made sure this IP is called when navigating dynamically using my UI object type. (see image)
In the body of this inbound plug I can access the quotation in the local variable 'iv_collection'. I pass the GUID of this entity on to a public attribute of the component controller. This way I will be able to access it from everywhere in the component. (see code partly below)
lv_guid = lr_entity->get_property_as_string( 'GUID' ).
lr_coco->current_rea_guid = lv_guid.
DO_VIEW_INIT_ON_ACTIVATION
In DO_VIEW_INIT_ON_ACTIVATION the following code lets me access the GUID from the attribute in the component controller:
lr_coco ?= me
->comp_controller.
CHECK lr_coco IS BOUND.
lv_value = lr_coco->current_rea_guid.
As a result, I now possess the GUID I wanted, and I can load my custom screen using this GUID.
However.....
All of this works fine. The inbound plug is fired, and then comes the DO_VIEW_INIT_ON_ACTIVATION, as it should.
But when I test this in the webui, and I then click the 'Back' button, I'm being redirected to my custom search page. If i then select another quotation, the custom page loads again, but using the quotation that I selected the first time!
I debugged this and I noticed the following: The second time (after I pressed 'back'), the DO_VIEW_INIT_ON_ACTIVATION is loaded BEFORE my inbound plug is. This is why the GUID is not updated yet...
Can anyone tell me how I can make SAP fire the inboud plug first? Maybe I need to clean something up?
Thanks in advance!
Jonathan