Application Development and Automation 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: 
Read only

Create dynmic deep internal table

Former Member
0 Likes
505

Dear all,

is it possible to create a dynamic internal table which has a deep structure. The catch here is that component tables of the main internal table will determined dynamically.

thanks a lot!!!

Navjot

1 REPLY 1
Read only

Former Member
0 Likes
386

Hi Navjot,

Dyanmic internal table with deep structure is specially useful when we have to create an ALV with Colors or Style etc. Since we have CL_ABAP_TABLEDESCR class from RTTS, it is also possible to create a dynamic internal table with the deep structure. To create an internal table with deep structure, we need to first get the object definition of the table type. Than we have to add that as a component of our table definition and that's it.

Try this :


*&---------------------------------------------------------------------*
*& Report ZNP_DYNAMIC_DEEP_TABLE.
*&
*&---------------------------------------------------------------------*
*& Shows how to create dynamic internal table with deep strcuture
*&   which can be used in the ALV to have Sytle table, Color table
*&
*&---------------------------------------------------------------------*
*
*
* 2.1 Creating the Deep strcuture field
  DATA:  lo_tab TYPE REF TO cl_abap_tabledescr.
*
  lo_tab ?= cl_abap_typedescr=>describe_by_name( 'LVC_T_SCOL' ).
  la_comp-name = 'COLOR_TAB'.
  la_comp-type = lo_tab.
  APPEND la_comp TO lt_tot_comp.
  CLEAR: la_comp.

Regards

Abhinab Mishra