on 08-16-2013 2:56 PM
Hi, in ECC6.0 I have an application parameter, received via the URL, which I am receiving into my window context via the handledefault method.
I would like this value though to be input into the the component context so that I can reuse it for many other views.
I have read the latest WDA book by James Wood & Shaun Parvaze but I can't see any easy way to do this.
I'm sure there must be an easy way to load the component context with values passed as application parameters during init.
Please advise.
Thanks,
Kevin
Hi Kevin,
Create a context node with appropriate attributes in your component controller then map the node to your window's context.
In the window's HANDLEDEFAULT method, you can fetch the URL parameters into a table then save the parameter values to the context node attributes.
wdevent->get_data(
exporting
name = if_wd_application=>all_url_parameters
importing
value = lt_parameters ).
read table lt_parameters assigning <parameter>
with key name = url_parameter_name.
if sy-subrc is initial.
lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).
lo_el_node = lo_nd_node->get_element( ).
lo_el_node->set_attribute(
name = `ATTRIBUTE`
value = url_parameter_value ).
endif.
Cheers,
Amy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
try following code.
DATA lv_app_name TYPE string.
DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
lo_cmp_usage = wd_this->wd_cpuse_lma_comp1( ).
IF lo_cmp_usage->has_active_component( ) IS INITIAL.
lo_cmp_usage->create_component( ).
ENDIF.
DATA lo_interfacecontroller TYPE REF TO ziwci_lma_comp_1 .
lo_interfacecontroller = wd_this->wd_cpifc_lma_comp1( ).
lv_app_name = wdr_task=>client_window->get_parameter( ).
You can call upper code anywhere(In comp_controller or view) to get the value of parameter passed with application name.
for more..
BR
Chandra..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Chandra, but I'm still a bit confused. The value(application parameter) that I want in my component context is sitting in my window context. Surely there must be an easier way to transfer the value from the window context to the component context given the exactness of the node and attributes?
Also, if I were to try that code, would I put in the init method of the componentcontroller?
Thanks,
Kevin
Yes Kevin, Just do a try in init method of the component-controller. Hope it will help you.
and try to give some time on following link also same concept is used here you are looking for.
and for copying data form Window context to Comp Context.
1.Make a global attribute in comp_controller and access that Attribute in handledefault method of window and pass the value into that.
2.make same type of node in comp_controller and read the value of window context and set the same value in comp_context in handledefault method of window.
BR
Chandra..
Hi Chandra, so I tried your first advice, reading the application parameter via the init method of the component controller, however as it executues prior to the main window it was always blank.
Looking at point number 1 in this reply, I still have the problem of loading values into the component context, when would I do this? The init method comes before the main window HANDLEDEFAULT method so it won't work.
Looking at point 2 is exactly what I want to do, I just don't know how to do it. How do I move the values of the main window context to the component controller context. That is exactly what I want to do but I just don't know how. If you could explain it would be greatly appreciated.
Because I cannot seem to find an easy way to load the component controller context with values from application parameter, I'm instead loading attributes in my assistance class and then getting those in each view and then setting them to the context of each view. This seems silly as I should be able to do this once at the component context level and then simply access them in each subsequent view via normal mapping.
Hello,
have you seen the following link.?
try it.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.