on 11-17-2012 9:09 AM
Hi,
want to pass username as parameter in Webdynpro URL. how can i do that?
Regards,
Senthil
Hello,
You read the parameters in the "window" inbound plug not the "view" Init method. One way to do this is to set an "empty" view as the default view of the window. You then read the parameters in the default inbound plug and set an attribute that you define in the component controller with the value. After that you trigger an outbound plug that takes you to the actual view. There is a portal integration object defined that you can use to read those parameters.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Senthil,
You can pass username (or any other parameters) as a URL parameter by including name/value pairs in the URL query string, e.g., the following URL has two name/value pairs, p1=ABC and p2=123.
http://host:port/sap/bc/webdynpro/sap/zmyapplication?p1=ABC&p2=123
In the HANDLEDEFAULT method of your window, include the following code to read the URL parameters and save them to a context node for later use.
* (1) Read URL parameters
wdevent->get_data(
exporting
name = if_wd_application=>all_url_parameters
importing
value = lt_parameters ).
* (2) Parse parameter p1 and its value
read table lt_parameters assigning <param>
with key name = 'p1'.
if sy-subrc is initial and <param>-value is not initial.
lo_nd_mynode = wd_context->get_child_node( name = wd_this->wdctx_mynode ).
lo_el_mynode = lo_nd_mynode->get_element( ).
lo_el_mynode->set_attribute(
name = `ATTRIBUTE`
value = <param>-value ).
endif.
* Repeat step (2) to read parameter p2 and its value
Cheers,
Amy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Senthil,
It is in the window's handledefault method that you read the URL parameters. Open your window and take a look at its Methods tab, you'll see the handledefault hook method. Place your code here.
To use the parameter values in a view, create a context node in the component controller and map the node to the window's context. Save the parameter values to that node. Then, in whatever view you want to use the parameter values, also map the component controller node to that view's context.
You cannot get the full URL itself with this approach, but it sounds like you don't need the full URL but only the URL parameters. If you pass if_wd_application=>all_url_parameters to the wdevent->get_data method, you will receive a table of all the custom name/value pairs you have attached to your URL query string.
If you're not getting these parameters with your call to wdevent->get_data, please post the URL that you are using so we can see the parameters you are passing, and also please post your code which reads the parameters.
Cheers,
Amy
User | Count |
---|---|
70 | |
26 | |
9 | |
9 | |
7 | |
6 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.