cancel
Showing results for 
Search instead for 
Did you mean: 

Pre-populating webdynpro field from URL

former_member498918
Participant
0 Kudos

I've just written my first webdynpro and would like to launch the webdynpro page with one of the fields pre-populated with a parameter passed from the URL. I would then like to continue to load the rest of the page with information based on that parameter, i.e. trigger the PAI.

In the ITS we can do this by passing ?param1=X&param2=X&~okcode=LOAD.

Does anyone know what the equivilent is in a webdynpro URL.

Many thanks

Karen

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hello Karen,

                  I came across the same situation where i need to set the properties of some ui elements in web dynpro view depending on the URL parameters. I performed the following steps

1) In the default inbound plug of window i taken one parameter for the value which coming from the URL

   

    Suppose &i_opt as one parameter you are passing from URL then create  parameter as i_opt in the

default inbound plug of window

2) Then create outbound plug for the same window    with same parameter( example &i_opt)

    For this outbound plug create the navigation link to the view where you want to use the parameter value  and in the inbound plug of respective view create same parameter (example &i_opt).

3)Now you fire the outbound plug of window from the inbound plug handler method(default plug) of same window with parameter (i_opt)

  example  

   WD_THIS->FIRE_MY_OUTBOUND_PLG(

  i_opt  =  i_opt

).

4) Now you will receive the parameter value in the inbound plug handler method of view where you want use the  parameter value to make change to the view.

Former Member
0 Kudos

Hi,

You can go through this article for reference,

http://wiki.sdn.sap.com/wiki/display/WDABAP/How+to+read+URL+parameters+in+Web+Dynpro+for+ABAP

You can also use CL_WD_RUNTIME_SERVICES=>GET_URL_PARAMETER( ) to get parameters.

amy_king
Active Contributor
0 Kudos

Hi Karen,

In the HANDLEDEFAULT method of your window, write the following code.

DATA lt_parameters TYPE tihttpnvp.
FIELD-SYMBOLS <p> TYPE ihttpnvp.

* Read URL parameters
  wdevent->get_data(
    EXPORTING
      name =  if_wd_application=>all_url_parameters
    IMPORTING
      value = lt_parameters  ).

  CHECK lt_parameters[] IS NOT INITIAL.

* Set the URL parameters in the context
  READ TABLE lt_parameters ASSIGNING <p>

                           WITH KEY name = url_parameter_name.   IF sy-subrc IS INITIAL AND <p>-value IS NOT INITIAL. *   set the value in the context

     ...   ENDIF.

Cheers,

Amy

RicardoRomero_1
Active Contributor
0 Kudos

Hi,

Add some parameters to the method HANDLEDEFAULT of your window.

Add also these parameters in your WD application.

Then you can read the parameters passed in the URL within the method HANDLEDEFAULT and you can update some context nodes you want.

Regards,
Ricardo.