on 03-19-2010 10:22 AM
Hi experts,
I created a attibute under the tab of 'Context' in COMPONENTCONTROLLER, then in the view I want to use the value of this attribute, how could I access to it?
or should I created attibute under the tab of 'Attribute' in the COMPONENTCONTROLLER? if I did this way ,How could I access to it ?
Many thanks for your help!
Anna
For attribute created in the context tab in compcontroller, create a node first and then create an attribute under it, Then map the node to your view context.
For general attribute created under attributes tab in comp controller, no need to mark it as interface ( option not available also ) just mark the attr as public and access it in your view as
wd_comp_controller-><attr_name>.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anna
If you have created the attribute in the component controller you can mark it as interface (check box) so that you can access from the underlying objects like(view/windows) directly with wd_comp_controller ref. as follows.
wd_comp_controller->attribute_marked_as_interface .
Regards
Kartik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1) Go to the view where you want to access the attribute
2) Click on the context tab
3) Map the attribute created in COMPONENTCONTROLLER with view context using drag and drop
4) Use following code in the method of view to access value of attribute
You can also generate this code using wizard.
i) Click on wizard
ii) Select 'Read Context' radio button
iii) Select the attribute name created in step 1 (that you want to read) and enter
DATA lo_nd_node TYPE REF TO if_wd_context_node.
DATA lo_el_node TYPE REF TO if_wd_context_element.
DATA ls_node TYPE wd_this->element_node. " Replace with your node name
DATA lv_name LIKE ls_node-name. " replace with your node and attribute name
* navigate from <CONTEXT> to <NODE> via lead selection
lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ). " Replace with your node name
* get element via lead selection
lo_el_node = lo_nd_node->get_element( ).
* get single attribute
lo_el_node->get_attribute(
EXPORTING
name = `NAME` " Replace with your attribute name
IMPORTING
value = lv_name ).
Regards,
Saket.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If you have directly created attribute under context of componentcontroller, I think that can also be mapped with the context of the view. That attribute can be accessed in the view using wizard as told in earlier post.
Better you create node in the context of componenrcontroller, create attribute under it and then map that node with the context of view.
Regards,
Saket.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.