cancel
Showing results for 
Search instead for 
Did you mean: 

Application Parameter and Window Context

former_member214498
Contributor
0 Kudos

Hi Folks

I have an application parameter User_name and I have declared a parameter UNAME in inbound plug DEFAULT of the WINDOW.

I want to use this UNAME value in my VIEW for manipulation in one of the events ON_SUBMIT. How can I make this application parameter value visible to event ON_SUBMIT in the view.

Regards

Waz

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Use following code to get the value of application parameter. Declare the context node in componentcontroller and map that node in window context and view context.

After getting the value of application parameter set the contex attribute, as soon as you set the context attribute it will statr reflecting in view also.

Eventhandler = HANDLEDEFAULT

Controller = WindowController

Window is the default window of another webdynpro application.

All parameters will be importing parameters and will have same name and type as application parameters.

data l_params type tihttpnvp.

data l_param type ihttpnvp.

FIELD-SYMBOLS: <fs_parameter> LIKE LINE OF wdevent->parameters.

FIELD-SYMBOLS <val> type any.

FIELD-SYMBOLS: <ft_httpparam> TYPE tihttpnvp.

data all_url_parameters type string.

LOOP AT wdevent->parameters ASSIGNING <fs_parameter>.

IF <fs_parameter>-name = if_wd_application=>all_url_parameters.

ASSIGN <fs_parameter>-value->* TO <ft_httpparam>.

IF <ft_httpparam> IS ASSIGNED.

append LINES OF <ft_httpparam> to l_params.

ENDIF.

ELSE.

l_param-name = <fs_parameter>-name.

assign <fs_parameter>-value->* to <val>.

l_param-value = <val>.

append l_param to l_params.

ENDIF.

ENDLOOP.

Thanks,

Rahul

former_member214498
Contributor
0 Kudos

Hi Rahul

Thanx for ur response. Where do I need to write this code? I have the name of application parameter do I still need to use all_url_parameters .

How can I set the value to Compnonent Controller which has a node user and attribute user id.

Regards

Waz

Edited by: Waz on May 30, 2009 7:31 AM

Former Member
0 Kudos

Hi,

Copy the node context of the component controller to the window controler's context.

Now read the node and set the user and atribute id in the HandleDefalut method of the Winodw.

ALL_URL_PARAMETERS piece pf code can be written in the WDDOINIT method of teh view.

Regards,

Lekha.

Former Member
0 Kudos

Hi,

You dont have to use all_url_parameters. If you have inserted the importing parameter to the defaulthandler of window. If you have not inserted the importing parameters to the window defaulthandler then use can use wdevent->parameters to get the parameters.

Second query:

How can I set the value to Compnonent Controller which has a node user and attribute user id.

You have to do the context mapping between componentcontroller_context and window_context. You have to also do the same context mapping between componentcontroller_context and view_context.

Since same node is mapped through componentcontroller_context, window_context and view_context, this value of attributes under this node will start reflecting as soon as it will be changed in any controller.

In you case you can get the application parameter in defaulthandler of window and set the shared nodes attribtes.

Thanks,

Rahul

Answers (2)

Answers (2)

former_member214498
Contributor
0 Kudos

Hi

Thank you all specially Rahul. The prob is solved.

Regards

Waz

Former Member
0 Kudos

Hi Waz ,

You can set this parameter in the context in the handledefault method of the window and then read in the event handler for action ON_SUBMIT.

Regards,

Tushar