cancel
Showing results for 
Search instead for 
Did you mean: 

Getting URL-Parameters in Init-Methods

Former Member
0 Kudos

Hallo ABAP-Developers,

I need to get the URL calling-parameters for my WDC before the HANDLEDEFAULT-Method of the Main-Window is called.

I need it in the WDDOINIT-Method.

Following Code in my WDOINIT-Method to read the param 'IM_WDC_NAME':

METHOD wddoinit.

  DATA:
    lr_http_request TYPE REF TO cl_http_request,
    l_comp TYPE string.

  CREATE OBJECT lr_http_request.
  l_comp = lr_http_request->if_http_request~get_uri_parameter( name = 'IM_WDC_NAME' ).

ENDMETHOD.

This is not working (var 'L_COMP' is empty).

Does anyone know a solution?

Thanks in advanced!

Regards,

V0id

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

If you are using FPM( Floor Plan Manager ) to create Application Configuration for your webdynpro component , then you can fetch URL parameters in DOINIT of component controller...

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You should not create the object for method cl_http_request. We should get it from wdr_task class. But that is not rite solution. To get the values in the wddoinit method of the first view. Follow these steps.

1. Embed the empty view to the window.

2. Make the empty view as the default view.

3. Get the values of the URL Parameters in the window wddefaulthandle method to the attributes of the Comp controller.

4. Fire a outbound plug which has a connection to the inbound plug of the first view(not the empty view).

5. Values will be available in the wddoinit of the first view.

Ranganathan.

Former Member
0 Kudos

>>>Hi,

>>>

>>>You should not create the object for method cl_http_request. We should get it from wdr_task class. But that is not rite solution. To get the values in the wddoinit method of the first view. Follow these steps.

>>>

>>>1. Embed the empty view to the window.

>>>2. Make the empty view as the default view.

>>>3. Get the values of the URL Parameters in the window wddefaulthandle method to the attributes of the Comp controller.

>>>4. Fire a outbound plug which has a connection to the inbound plug of the first view(not the empty view).

>>>5. Values will be available in the wddoinit of the first view.

>>>

>>>Ranganathan.

Hello Ranganathan,

Both answers are not satisfying, but I will stick to your solution.

For my use-case it works fine.

Thanks, my question is anwered!

Regards, V0id.

Former Member
0 Kudos

Dear All,

I am trying with URL parameters 'sap-language=EN&sap-client=XXX' in WDA. but, I don't see these in WDEVENT object in HANDLEDEFAULT method of the window.

...Naddy

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Why would you need to read sap-language and sap-client via URL parameters. They have already been processed by the runtime and have set the correct environement. You can check the current language via SY-LANGU and the current client via SY-MANDT.

Former Member
0 Kudos

Hi Thomas,

sap-language and sap-client are just example.

Pls. see the thread

...Naddy

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

If what you actually want to ask is in another thread, why did you attach your question to this thread. You are violating the rules of engagement of the forums.