Skip to Content

Reading URL parameters, populating UI Fields and automatic Event triggering in Web Dynpro ABAP

Applies to

SAP ECC 6.0 Onwards. For more information, visit the Web Dynpro ABAP homepage.


Sometime user wants functionality such as, on clicking the URL; it should open the required Web Dynpro ABAP application iView along with values passed to the URL should be populated in the input field of the UI and also it should trigger the event automatically so that business user will directly see the desired output. In this paper, I explained how to achieve this result.

Business Scenario

User can pass parameters into the Enterprise Portal URL to be able to go to a specific iView of Web Dynpro ABAP application.  This should automatically populate a parameter values in UI field/s.

And also trigger automatically an event (E.g. Button Click event).

This will be helpful for quick launch of application with automatic event triggering and displaying the end result to users.

iView Related Changes

  • Setting quick link in Web Dynpro ABAP iView

Open the role in question, and navigate to the properties for the iView which is the destination. It will have a property called “Quick Link.” Assign a unique string value to this field (such as “testQuickLink” in the example below). Now you can directly call a specific iView using a URL like:


Figure 1.JPG

  • URL Parameter passing to Web Dynpro

There is a property of iView called “Parameters Forwarded to Web Dynpro.” Here, you can list out which parameters get passed from EP into the destination Web Dynpro (“pin” in the example below). So users would then (theoretically) be able to pass in a unique ID on the end of the URL as a parameter, such as:


Figure 2.JPG

This technique is detailed in this paper under “Parameter forwarding for NW04 Web Dynpro iViews”:

Web Dynpro ABAP Component Changes

It is assumed that reader knows basic Web Dynpro ABAP coding and knows how to create Web Dynpro component, reading attributes and triggering button event etc.

In this example, we have WD application with PIN as input field and button called Process. On click of button, additional information will be displayed.                

  • Map component controller context node/attribute to the Window context.

As shown below, node NODE_INPUT is mapped.

Context Mapping

  • Define attribute in Component controller

Declare attribute in Component controller which will be available globally in Web Dynpro Component.

As shown below, attribute G_FLAG_CALL_FROM_URL is defined on component controller.

Global Attribute

  • Declare parameter/s in event handler method HANDLEDEFAULT of WINDOW

Please note that the name should be similar to parameter name/s used in URL and should be optional parameter. Check flag Optional. For e.g. here PIN is passed to URL. It is declared in parameter of method with flag optional. ( https://<host>:<port>/irj/portal/testQuickLink?pin=1234 )

Figure 5.JPG

Put below code in the method HANDLEDEFAULT. In method, set the value to the context so that values will be automatically populate in UI element of the VIEW. Also set the value of flag which will be read in method WDDOMODIFYVIEW of View controller.

METHOD handledefault.

  DATA lo_nd_node_input TYPE REF TO if_wd_context_node.

  DATA lo_el_node_input TYPE REF TO if_wd_context_element.

  DATA ls_node_input TYPE wd_this->element_node_input.

  DATA lv_pin LIKE ls_node_input-pin.

*   navigate from <CONTEXT> to <NODE_INPUT> via lead selection

  lo_nd_node_input = wd_context->get_child_node( name = wd_this->wdctx_node_input ).

*   get element via lead selection

  lo_el_node_input = lo_nd_node_input->get_element(  ).

  lv_pin = pin. “Value from URL Parameter

**Set the Value to the Context

  lo_el_node_input->set_attribute( EXPORTING

                                  name =  `PIN`

                                  value = lv_pin ).


**Set value of Flag which is declared in Component Controller and will be accessible globally in all WD Views methods etc…

    wd_comp_controller->g_flag_call_from_url = ‘X’.





In method WDDOMODIFYVIEW, read the flag value. Here we need to trigger the dummy event WDEVENT automatically and hence create object of Custom event and call the ON_ACTION event method. Also as we need to execute the code only for 1st time, use flag FIRST_TIME given by the WD framework with our flag.

METHOD wddomodifyview .

  DATA: l_wdevent TYPE REF TO cl_wd_custom_event,

        name      TYPE  string.

*We need to call the action first time only !!

  IF wd_comp_controller->g_flag_call_from_url = ‘X’ AND first_time = ‘X’.

    name = ‘ON_ACTION’. “This will be always “ON_ACTION”

*Create object of Custom Event

    CREATE OBJECT l_wdevent


        name = name.

*Call On action method. This is potentially simulating User Action!!

    wd_this->onactionshow_data( wdevent =  l_wdevent ). 

                                     ” ref to cl_wd_custom_event

  ENDIF.  ”  IF wd_comp_controller->g_flag_call_from_url = ‘X’.



As shown below, PIN information is passed via URL and the application populated the PIN in the input field. Along with this, button event triggering is done automatically and the PIN related additional information is displayed.

Figure 6.JPG

Related Content

Reference 1

Reference 2

Reference 3

Be the first to leave a comment
You must be Logged on to comment or reply to a post.