on 06-18-2010 10:21 AM
Hi,
Can we set a value of an attribute to View context from reference IF_WD_COMPONENT?
WD application calls a class with improting parameter 'IF_WD_COMPONENT' to pass its own reference. The class needs to set value of an attribute to View context from this reference IF_WD_COMPONENT.
Could you please tell me how i can do that? or is it NOT possible?
...Naddy
Hello Naddy,
When we create a view three attributes are being provided to the developer by webdynpro framework.
wd_this, wd_context, wd_comp_controller.
wd_this would be used to access the attributes defined at view level. and you could use this attribute of any controller to access attributes at that controller level.
you could access the attribute by statement wd_this->attribute name.
You would need wd_context of type if_wd_context_node to access the attribute defined at context level.
Regards
Anurag Chopra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Naddy,
My mistake, I misunderstood you.
But you would also need to use the above information.
you have to do this step by step.
1) you need to check if there is multiple component usgae or not. As you have to identify of which component you have that view where you need to change the attribute value.
2) Once you have the info, you would need to access the interface of the component controller.
3) Then you would have to reach to the interface of the view controller.
4) as told earlier.
In se24, you could refer the interface and access the appropriate method.
Regards
Anurag Chopra
Hello,
Please have a look at the following code:
method TEST_METHOD.
DATA context TYPE REF TO IF_WD_CONTEXT.
DATA node TYPE REF TO IF_WD_CONTEXT_NODE.
DATA ele TYPE REF TO IF_WD_CONTEXT_ELEMENT.
context = component->get_context( ).
node = context->root_node->get_child_node( 'NODE_FLIGHT' ).
ele = node->get_element( ).
ele->set_attribute( EXPORTING name = 'CARRID'
value = 'AA' ).
endmethod.
This method takes a parameter component of type IF_WD_COMPONENT. And it sets the attribute CARRID of node NODE_FLIGHT.
THis works! But i am not sure why you want to set the attributes of context node in a class passing the component reference. Instead you can call a method of class to get the value to be set and in the component controller itself you can set the value of the attribute right!
Hope this helps!
Regards,
Srilatha
Hi,
Without mapping the node form component controller to view,We can not set the value for view's context attribute from component controller.However the converse is possible .
Only way is to solve your issue enhance the compnent controller's context and map the same node in view controller.
Regards,
Madhu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
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.