on 02-11-2009 10:33 AM
Hi,
I need to do a loop in an internal table but I dont know how many fields there are in it.
I want to do a loop in whatever table that I receive as a parameter, recovering all its columns and lines.
I am trying to do this with the class CL_ABAP_TABLEDESCR, but I didn't manage to do it.
Could anyone help me pls?
Thanks a lot.
Regards,
Jorge Luiz
Hello Jorge,
Please see this [article|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b332e090-0201-0010-bdbd-b735e96fe0ae], in this [wiki|https://wiki.sdn.sap.com/wiki/x/QwCMAw] and in this [wiki|https://wiki.sdn.sap.com/wiki/x/9IRWAw].
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jorge,
Please go thru the code given below, that might help you in solving the problem.
Call this code when u trigger an action.
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)
cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
parent_info = rootnode_info
node_name = tablename
structure_name = tablename
is_multiple = abap_true ).
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>.
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> ).
Instantiate ALV component
DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
l_ref_cmp_usage = wd_this->wd_cpuse_alv( ).
IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
l_ref_cmp_usage->create_component( ).
ENDIF.
Pass context node to ALV
DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .
l_ref_interfacecontroller = wd_this->wd_cpifc_alv( ).
l_ref_interfacecontroller->set_data( dyn_node ).
Regards
Manoj Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.