Skip to Content

Prerequisite

Basic knowledge of POWL implementation with WDA. Refer to this Article on SCN for info:

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60f1d5ee-84ab-2c10-ce97-97dfd89bc238

The problem

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.

/wp-content/uploads/2011/07/powllink_78958.jpg

The solution

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.

image

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.

image

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!!!

To report this post you need to login first.

10 Comments

You must be Logged on to comment or reply to a post.

  1. Chris Paine
    Hi Ivan,

    you can launch a WDA app directly from a POWL – you don’t need to wrap it in another WDA component – just using the standard POWL application.

    If you’re running inside a portal then this is exceptionally easy just using portal navigation API – but there are other ways too.

    I have some examples where I’ve done this. I’ll dig them out for you. (unfortunately no access where I am today.)

    Cheers,

    Chris

    (0) 
      1. Chris Paine
        Hi – I should be at the site where I coded that tomorrow – promise I’ll dig it out – from memory I also showed Al Templeton how to do something similar when they launched BI-on demand from a POWL during their (his and Matt Harding’s) DemoJam last year – not sure if Al ever posted the code – it might be there.
        (0) 
        1. Chris Paine
          Hello –

          hmm – this code relies on portal nav api. But thought I’d share it nevertheless.

          method if_powl_feeder~handle_action.
            data: ls_selected type rstabix,
                  ls_results type zpd_qual_compliance_emp,
                  ls_parameters type powl_namevalue_sty,
                  l_url type string.

            if i_actionid = c_show_employee_action.

              loop at c_selected into ls_selected.

                read table c_result_tab into ls_results index ls_selected-tabix.

                ls_parameters-key = ‘PERNR’.
                ls_parameters-value = ls_results-pernr.
                append ls_parameters to e_portal_actions-parameters.
                ls_parameters-key = ‘sap-client’.
                ls_parameters-value = sy-mandt.
                append ls_parameters to e_portal_actions-parameters.
                ls_parameters-key = ‘sap-language’.
                ls_parameters-value = sy-langu.
                append ls_parameters to e_portal_actions-parameters.
                e_portal_actions-portal_nav_mode = if_wd_portal_integration=>co_show_external.

                call method cl_wd_utilities=>construct_wd_url
                  exporting
                    application_name = c_employee_quals
                  importing
                    out_absolute_url = l_url.

                e_portal_actions-portal_path = l_url.

                exit. “only take first selection.
              endloop.
            endif.

          endmethod.

          (0) 
      2. Chris Paine
        I’ll have another check – as I know this is possible. Will potentially throw some code together tonight at home. – What a wild and crazy way to spend a Friday evening 😉
        (0) 
  2. Andrew Valentin

    Hi Ivan,

    I’ve followed your steps and implemented a POWL and now I’m trying to trigger the POWL_FOLLOW_UP event handler which I re-implemented in the view of the WebDynpro used for the POWL.

    I’ve added a button to the POWL feeder class and in the HANDLE_ACTION method of the class I’ve set the FIRE_WDEVENT.

    This should now trigger the re-implemented POWL_FOLLOW_UP event in the WD, however the event is not being triggered when I click on the button.

    Am I missing a step somewhere? I would appreciate any help or advise.

    (0) 

Leave a Reply