on 2009 Jan 28 11:14 AM
Hi All,
I am new to webdynpro abap and have a query regarding:
How to loop through the context node elements, so that i can modify each element attributes during runtime.
Please send some link or sample code which shows how to do this.
Thanks & regards,
Sujit
Dear Sujit,
Consider a node Advances having any number of context attributes.Below is the code sinippet to access the node.
data lo_nd_advances type ref to if_wd_context_node. <declaration for the node>
data lo_el_advances type ref to if_wd_context_element.<declaration for the elements in the node>
data lt_advances type wd_this->elements_advances. <internal table declaration - for internal table put elements>
data ls_advances type wd_this->element_advances. <work area declaration - for work area put element>
<Assign the context node Advances to lo_nd_advances>
lo_nd_advances = wd_context->get_child_node( name = wd_this->wdctx_advances ).
Assign context attributes of context node advances to lo_el_advances
lo_el_advances = lo_nd_advances->get_element( ).
import the Advance node values to the internal table lt_advances
call method lo_nd_advances->get_static_attributes_table(
importing
table = lt_advances ).
loop the internal table
loop at lt_advances into ls_advances.
<statements>
endloop.
Note: i have bolded the difference between internal table and work area in the declaration.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
toread the element attributes,you should read the node and this can be done through code wizard.
Regards,
anand
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi...the below code snippet should help me
DATA : l_node TYPE REF TO if_wd_context_node,
lt_flight type if_view1=>elements_flights_node,
L_NODE = wd_context->get_child_node( 'FLIGHTS_NODE' ).
l_node->get_static_attributes_table( IMPORTING TABLE = LT_FLIGHT ).
now you can loop through lt_flight as u normally do.
good luck !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sujit,
You can read any node with the help of code wizard. It will give you all the values in an internal table. You can use them accordingly. To get code wizard: just press CTRL+F7 in any of your method, a pop up window will appear, just check the radio button which says read node, press f4, and select the node and press enter, the code will be automatically generated and you'll get all the values.
I hope it helps.
Regards
Arjun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
there is no difference from ABAP as such ..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
8 | |
8 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.