on 04-14-2008 1:49 PM
Hi,
How can I populate a table on view with data from an internal table?
Thanks,
Ronita
Hi,
if you have an internal table named xyz.
Then create a structure in se11 for this internal table.
Then create a node with this structure with cardinality 0:n
Navigate into method WDDOMODIFYVIEW of view MAIN_VIEW. Insert coding for:
- Create a new context node for the table
Hint: Use method Create_nodeinfo_from_struct of class Cl_wd_dynamic_tool.
- Remove old dynamic table IE element from view , if one exists. If it exists, it is a child of group GROUP_1 and has the name TESTTAB.
- Create a new UI element for a table named TESTTAB
- Create an internal table, fill it with the data from the database table and bind it to the newly created dynamic context node.
METHOD wddomodifyview .
DATA:
UI Elements
group_1 TYPE REF TO cl_wd_uielement_container,
new_tab TYPE REF TO cl_wd_table,
Context Nodes
dyn_node TYPE REF TO if_wd_context_node,
tabname_node TYPE REF TO if_wd_context_node,
Node Info
rootnode_info TYPE REF TO if_wd_context_node_info,
Data Reference (for internal table)
stru_tab TYPE REF TO data,
String (for table name)
tablename TYPE string.
FIELD-SYMBOLS:
<tab> TYPE table.
create context node ***************************************************************
get node info of context root node
rootnode_info = wd_context->get_node_info( ).
Get the name of the table to be created
tabname_node = wd_context->get_child_node( name = 'TABLE_DATA' ).
tabname_node->get_attribute( EXPORTING name = 'NAME' IMPORTING value = tablename ).
translate tablename to upper case.
create sub node named TEST1 of structure (tablename)
cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
parent_info = rootnode_info
node_name = tablename
structure_name = tablename
is_multiple = abap_true ).
get instance of new node
dyn_node = wd_context->get_child_node( name = tablename ).
remove "old" table UI element from view , if necessary ****************************
group_1 ?= view->get_element( 'GROUP_1' ).
group_1->remove_child( id = 'TESTTAB' ).
create new UI element table *******************************************************
new_tab = cl_wd_dynamic_tool=>create_table_from_node(
ui_parent = group_1
table_id = 'TESTTAB'
node = dyn_node ).
fill context node with data *******************************************************
create internal table of (tabletype)
CREATE DATA stru_tab TYPE TABLE OF (tablename).
ASSIGN stru_tab->* TO <tab>.
Get table content
SELECT * FROM (tablename) INTO CORRESPONDING FIELDS OF TABLE <tab>.
Bind internal table to context node.
dyn_node->bind_table( <tab> ).
ENDMETHOD.
Edited by: Sridevi D on Apr 19, 2008 10:30 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi ronita......
create a node of cardinality 0...n.
bind that node to the table.
then you fill the nodes with values so that it is reflected in that table.
you can use the method bind_table in the interface if_wd_context_node.
---regards,
alex b justin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.