Navigation from POWL to WDA without Object Based Navigation
Basic knowledge of POWL implementation with WDA. Refer to this Article on SCN for info:
In my last project I had to face a technical requirement, use POWL and activate navigation without portal and OBN.
If you want to achieve this objective using OBN, it is really simple and well documented.
What if I do not use OBN and SAP portal? Are POWLs strictly correlated to OBN?
In my example I have a POWL on SFLIGHT and I want to open the Flight Data Sheet in a new Page when I click on Airline code.
I tried to search a solution on SCN and on Google Search without success; the entire guide available refers to OBN. No way? I don’t think so. Having a look into the POWL engine and I found an interesting way out:
Event POWL_FOLLOW_UP => fired if requested by ‘HANDLE_ACTION’ method of feeder.
Wow I have the key my WDA is listening for event and handle the request 🙂
Create a WebDynpro Component with two view: POWL_V and FLIGHT_V. The first one displays the POWL Component and the second one the Flight detail.
Into POWL_V view create a new method GOTO_FLIGHT associated to the POWL_FOLLOW_UP event.
By default POWL Component does not throw the event POWL_FOLLOW_UP you have to specify in your feeder class that on handle action the event should be thrown.
Method IF_POWL_FEEDER~HANDLE_ACTION in your feeder class is the key. The returning structure E_PORTAL_ACTIONS has a field fire_wdevent if it is true (abap_true) the event is thrown.
Implement method as shown below:
METHOD if_powl_feeder~handle_action. IF i_actionid = 'CARRID_ID'. * important: this triggers the event e_portal_actions-fire_wdevent = abap_true. ENDIF. ENDMETHOD.
The event is thrown and the WDA receive it and it can manage the request, one problem is still existing: which row was selected? Which flight we have to display?
The event received by the WDA has no information about the row that the user clicked. The solution is again in method F_POWL_FEEDER~HANDLE_ACTION and in the returning structure E_PORTAL_ACTIONS.
The structure has another field PARAMETERS, that is an internal table of key/value; so we need to fill up this itab with the parameters we require to handle the request in the WDA.
The code below shows an example of implementation:
METHOD if_powl_feeder~handle_action. DATA: ls_parameter TYPE powl_namevalue_sty. DATA: lt_flights TYPE TABLE OF zflight_powl. DATA: ls_flight TYPE zflight_powl. DATA: ls_selected TYPE rstabix. FIELD-SYMBOLS: <lt_flights> TYPE STANDARD TABLE. IF i_actionid = 'FLIGHT_ID'. * important: this triggers the event e_portal_actions-fire_wdevent = abap_true. * Pass parameters to event ASSIGN c_result_tab TO <lt_flights>. lt_flights = <lt_flights>. * Determine the selected row ** Read selected POWL data READ TABLE lt_flights INDEX i_action_index INTO ls_flight. CHECK sy-subrc = 0. * Pass parameters ls_parameter-key = 'CARRID'. ls_parameter-value = ls_flight-carrid. APPEND ls_parameter TO e_portal_actions-parameters. ls_parameter-key = 'CONNID'. ls_parameter-value = ls_project-connid. APPEND ls_parameter TO e_portal_actions-parameters. ENDIF. ENDMETHOD.
Only one step to the goal, read parameters into WDA POWL_V method
METHOD goto_flight. DATA: lv_carrid TYPE s_carrid, lv_connid TYPE s_connid, lt_parameter TYPE powl_namevalue_tty, ls_parameter TYPE powl_namevalue_sty. FIELD-SYMBOLS: <value> TYPE data. wdevent->get_data( EXPORTING name = 'EVENT_PARAMETERS' IMPORTING value = lt_parameter ). READ TABLE lt_parameter INTO ls_parameter WITH KEY key = 'CARRID'. lv_carrid = ls_parameter-value. CLEAR ls_parameter. READ TABLE lt_parameter INTO ls_parameter WITH KEY key = 'CONNID'. lv_connid = ls_parameter-value. CLEAR ls_parameter. ** Complete the code on WDA as you need (e.g. context binding) ** Fire plug to the detail view FLIGHT_V ENDMETHOD.
That’s it! Hope this could be useful for your future implementation.
Long life to POWL!!!