Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding ooabap statements

lokesh_kamana
Active Contributor
0 Kudos

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).

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

1 ACCEPTED SOLUTION

uwe_schieferstein
Active Contributor
0 Kudos

Hello Lokesh

<b>(1) Static method call:</b>

cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
parent_info = rootnode_info
node_name = tablename
structure_name = tablename
is_multiple = abap_true ).

Here a static method is called with all the parameter on the right imported into the method. Apparently nothing is exported or received from this method.

<b>

(2) Create itab dynamically and select data dynamcally:</b>

DATA: stru_tab TYPE REF TO data.
FIELD-SYMBOLS:
<tab> TYPE table.
* create internal table
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>.

First a data reference to a table type (having the structure of the table named in TABLENAME) is created.

This data reference is de-referenced to a field-symbol (of TYPE TABLE). Thus, after the ASSIGN statement the field-symbols points to an internal table with the line type of TABLENAME (.e.g. if tablename = 'KNB1' then the field-symbol corresponds to the following itab: lt_itab TYPE TABLE OF knb1).

Finally, the data from the table in TABLENAME are dynamically selected.

Regards

Uwe

2 REPLIES 2

uwe_schieferstein
Active Contributor
0 Kudos

Hello Lokesh

<b>(1) Static method call:</b>

cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
parent_info = rootnode_info
node_name = tablename
structure_name = tablename
is_multiple = abap_true ).

Here a static method is called with all the parameter on the right imported into the method. Apparently nothing is exported or received from this method.

<b>

(2) Create itab dynamically and select data dynamcally:</b>

DATA: stru_tab TYPE REF TO data.
FIELD-SYMBOLS:
<tab> TYPE table.
* create internal table
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>.

First a data reference to a table type (having the structure of the table named in TABLENAME) is created.

This data reference is de-referenced to a field-symbol (of TYPE TABLE). Thus, after the ASSIGN statement the field-symbols points to an internal table with the line type of TABLENAME (.e.g. if tablename = 'KNB1' then the field-symbol corresponds to the following itab: lt_itab TYPE TABLE OF knb1).

Finally, the data from the table in TABLENAME are dynamically selected.

Regards

Uwe

lokesh_kamana
Active Contributor
0 Kudos

thanks for answering my question. My problem is solved.

can I know Ur mail Id.

I work For EDS as SAP Programmer.

Please Give Me Ur Mail Id.

so That over Relation Continues Further.

Ur answer Is Very HelpFull To Me.