on 11-07-2007 6:12 AM
METHOD onactionshow .
DATA:
Node Info
rootnode_info TYPE REF TO if_wd_context_node_info,
Context Nodes
dyn_node TYPE REF TO if_wd_context_node,
tabname_node TYPE REF TO if_wd_context_node,
String (for table name)
tablename TYPE string.
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 = 'INPUT' ).
tabname_node->get_attribute( EXPORTING name = 'TABLENAME'
IMPORTING value = tablename ).
TRANSLATE tablename TO UPPER CASE.
create sub node named TEST1 of structure (tablename)
<b>cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
parent_info = rootnode_info
node_name = tablename
structure_name = tablename
is_multiple = abap_true ).</b>
<b>DATA: stru_tab TYPE REF TO data.
FIELD-SYMBOLS:
<tab> TYPE table.</b>
create internal table
<b>CREATE DATA stru_tab TYPE TABLE OF (tablename).</b>
<b>ASSIGN stru_tab->* TO <tab>.</b>
Get table content
<b>SELECT * FROM (tablename) INTO CORRESPONDING FIELDS OF TABLE <tab>.</b>
get instance of new node
dyn_node = wd_context->get_child_node( name = tablename ).
Bind internal table to context node.
dyn_node->bind_table( <tab> ).
Please explain me the above statements which are in bold.
if u feel anything more to explain please tell me.
I am facing a lot of problem in undrestsnding those.
points will be rewarded immediately
with Regards,
lokesh@EDS
hi ,
if u r chosing a single database table ,u will create a node name and its attribute in component controller or in view controller.example mara as node name and its attribute as matnr ersda and ernam.then right clicking on the UI element click create binding and select ur mode of display by selecting text view or dropdownbyindex.but in dynamic case, at runtime user will give any table name and any filter condition of selecting its field .so it is impossible to create 88000 table as node and select all fields. so now give child node name as 'tablename' with type string .
in component controller it has one parent node by default.if we create a new node it comes as child of patent node 'context'.
class cl_wd_dynamic_tool contain 4 methods in that method create_nodeinfo_from_struct has all importing parameter
1. give the reference parent node name which is stored in a varible rootnode_info.
(rootnode_info = wd_context->get_node_info( ). if u go to attribute column, u can found 3 interfaces with respective data refernces like wd_this,wd_context. if u dblclick if_wd_context_node u can find all info regarding the name of context, and any other newly created parameters.)
2.give structure name or table name which is is given at runtime.
3. for accepting many fields or with only one field.
in abap oops dynamic condition is attained by 2 ways 1. data reference and 2.field symbols.
data reference alias name is "address of".
field symbol alias name is "value at".(place holder)
DATA: stru_tab TYPE REF TO data.
this means u r creating a variable stru_tab which is having a properties of data.
assume "data" is a type or class , .here only u declare only variable ,it has no content till the statement create data.(memory space will allocate only after the execution of create data.)
FIELD-SYMBOLS:
<tab> TYPE table.
u can declare a field symbol with generic type "any " keyword or "table" keyword.
dynamic means u should mention within parenthesis (table name).
conventiontional way of declaring internal table is
data: <internal table name > type table of <table name>.
here u dont know the type table u r going to pass.
but definetly ,it contain data, so declare stru_tab as data .
DATA: stru_tab TYPE REF TO data.
in this step only variable name name is create not space.
CREATE DATA stru_tab TYPE TABLE OF (tablename).
in this step space is create for variable but only internal table name is declared.but no space
ASSIGN stru_tab->* TO <tab>.
internal table is of table format .so u declared field symbol as table.
stru_tab is address of data
<tab> is value at table.
then select query
thanx
zenthil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Zenthil for Ur Detailed Explaination It Helped Me a Lot
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.