cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic table with column groups

Former Member
0 Kudos

Hello,

I’m trying to implement a WD table dynamically depending on the contents of an internal table.

In my method I have the following steps :

-> I create my object table :

         CALL METHOD cl_wd_table=>new_table
     
EXPORTING
           bind_data_source
= 'TAB'
          
id                                = 'CPT_TAB'
           view            
= wd_this->gd_view
      RECEIVING
          
control                          =
lo_table
.
-> I set the layout data

lo_table->set_layout_data( lo_layout_data ).

-> I add columns and colum groups depending on the contents of my internal table using add_column & add_grouped_column

-> In same time I build the structdescr object using object cl_abap_structdescr=>component_table.

-> I create and assign structdescr and tabledescr to field symbol.

-> I loop in my internal table in order to fill data in field symbol table <tab>

-> I add a new child node using :

      lo_node_info = wd_context->get_node_info( ).  

CALL METHOD lo_node_info->add_new_child_node
          
EXPORTING
                name                        
= 'TAB'
                static_element_rtti         
= lo_structdescr
                is_multiple_selection       
= abap_false
                is_initialize_lead_selection
= abap_false
                is_static                   
= abap_false
           RECEIVING
                child_node_info             
= lo_node_info.

-> I bind my table

  lo_dyn_node = wd_context->get_child_node( name = 'TAB' ).
  lo_dyn_node
->bind_table( <tab> ).

-> I add the new child

  lo_root ?= wd_this->gd_view->get_element( 'TC_TAB' ).

    CALL METHOD lo_root->add_child
     
EXPORTING
           the_child =
lo_table

My table is displayed with the correct column groups but it is empty !!

Can you see what I’m missing ?

Thanks

David

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Resolved by changing sequence:

- Create dynamic structure

- Create node

- Append data to

node

- Create table using node

- Bind table

- Loop at table in order to create column groups.

David