on 10-27-2008 3:38 PM
Dear experts,
the situation is as follows:
i have a context node with attributes from different tables.
i need a structure from this node to generate an itab out of it.
Can you explain to me how to do this ?
best regards
René
Hi Rene,
For each node <node> of a controller context, a structure type element_<node> is implicitly generated in the interface IF_<ctrl>. So if you want to define a structure in your webdynpro component with the same structure as an context node by name NODE1 then you can write as below:
data : wa_node1 type if_main=>element_node1. " If the context is created at view level
data : wa_node1 type ig_componentcontroller=>element_node1. " If the context is created at component controller level
In addition, for each node <node> of a controller context, a standard table type elements_<node> is implicitly generated in the interface IF_<ctrl>. The line type of this table is element_<node>. So if you want to define an internal table in your webdynpro component with the same structure as an context node by name NODE1 then you can write as below:
data : wa_node1 type if_main=>elements_node1. " If the context is created at view level
data : wa_node1 type ig_componentcontroller=>elements_node1. " If the context is created at component controller level
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is suggested that you avoid the usage of the IF_<name> interface declarations directly. If you were to rename your object, the interface name would change as well. It is better to reference the types via WD_THIS object (which will inherit from yoru IF_<NAME> interface) to avoid any code problems after renaming.
>i need a structure from this node to generate an itab out of it.
The WD Framework generates a local data type structure to match what was modelled in the Context. That way as the context changes you don't have to adjust any data declarations in your coding. The generated data type will be part of the WD_THIS object. It will be named element_<context element name>. There will also be a tab;e type declaration for any x:n nodes. They will be named elements_<context_node_name>. You can click on the Display Controller Interface button from within the methods editor to view these generated types.
Here is an example of how you might code against them.
****Load WDCTX_SALES_HEADER_TEXT
data lo_nd_sales_header_text type ref to if_wd_context_node.
data lt_sales_header_text type wd_this->elements_sales_header_text.
lo_nd_sales_header_text = wd_context->path_get_node( path = `SALES_ORDER.SALES_HEADER_TEXT` ).
field-symbols <s_text> type sdemo_text.
field-symbols <d_text> like line of lt_sales_header_text.
loop at <wa_so>-t_text assigning <s_text>.
append initial line to lt_sales_header_text assigning <d_text>.
move-corresponding <s_text> to <d_text>.
endloop.
lo_nd_sales_header_text->bind_table( new_items = lt_sales_header_text set_initial_elements = abap_true ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
First populate the internal table based upon ur requirements and then bind the internal table to this context node.
node->bind_table('internal_table').
You can create a structure in data dictionary for ur required fields and then create the node with dictionary structure.
In the method, create the itab as the dictionary structure, populate the itab and then the end use bind_table method,to bind it to the context node.
Thanks,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.