on 06-02-2008 6:47 AM
hi all,
Is it possible to initiate the attribute of context node in any of the method by using simple statement as like below.
attribute_name = value.
or is there a way to write a value into the attribute as we read using the read attribute option in the wizard..
i need to initialize a attribute. please help me in doing the same.
thanks,
selvakumar M.
Hi,
Yes you can initialize the attribute. Use the WDP wizard to generate code for reading the attribute. Then instead of the get_attribute method, use the set_attribute method of the IF_WD_CONTEXT_ELEMENT class. The code will be something similar to:
DATA lo_nd_node1 TYPE REF TO if_wd_context_node.
DATA lo_el_node1 TYPE REF TO if_wd_context_element.
DATA ls_node1 TYPE wd_this->element_node1.
DATA lv_data TYPE wd_this->element_node1-data.
* navigate from <CONTEXT> to <NODE1> via lead selection
lo_nd_node1 = wd_context->get_child_node( name = wd_this->wdctx_node1 ).
* get element via lead selection
if lo_nd_node1 IS NOT INITIAL.
lo_el_node1 = lo_nd_node1->get_element( ).
endif.
* @TODO handle not set lead selection
IF lo_el_node1 IS NOT INITIAL.
* @TODO fill attribute
* lv_data = 1.
* set single attribute
lo_el_node1->set_attribute(
name = `DATA`
value = lv_data ).
endif.
If you want to initialize the attribute first time, you can also do it by setting a default value for the attribute. This can be done in the view/component controller definition area.. There is a property called default value for the attribute.
Regards
Wenonah
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can initialise the value of the attribute by using the method bind_element or set_static_attributes /bind_table( fo tables).
ex:
NODE-RESULTS-ATTRIBUTE = 'test'.
node_results->set_static_attributes(
exporting
static_attributes = NODE_results ).
Shruthi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
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.