Dynamic Internal Table with Deep structure

By | October 15, 2008 | Dynamic ITAB | 14,048 | 3

We have seen how we can use Run Time Type Services (RTTS) to create a dynamic internal table in the post: Dynamic Internal Table Creation. On the other day, after publishing the post SALV Table 9 – Apply Colors, I was thinking how I can apply these color settings when I have a Dynamic Internal Table. As we have seen into that post, we require an internal table for Color in our Output table means a dynamic internal table with deep structure.

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.

This code snippet is in the continuation with the code given in the post Dynamic Internal Table Creation. You can put this code just after the DO..ENDO and before 3. Create a New Type.

Code Snippet to add the deep component in Dynamic Itab

*& 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.

Like It? Share!!

Don't miss an Update

Get notified of the new post, right into your inbox

Naimesh Patel{271 articles}

I'm SAP ABAP Consultant for more than a decade. I like to experiment with ABAP especially OO. I have been SDN Top Contributor.
Follow :

Explore all of his 271 articles.

Load comments


  • I’ve given ur link to a lot of the techies i know

  • Nice Tips Naimesh
    I sent you 1 query on ur gmail ID .


  • ravi

    Hi Naimesh
    This is Ravi here.How are you.I saw your blog and I am very much impressed by the wealth of knowledge avilable here.Hats off to you !!
    I had a small question.I am creating a dynamic excel file in which i need to change the font,color and write cell by cell to excel.Since this excel file has to created via webdynpro abap,I cannot use OLE as webdynpro in our version does not support it.Is there any other way to do that without using OLE.

    Thanks.You can reply me back at ravisrajan.sap@gmail.com

Comments on this Post are now closed. If you have something important to share, you can always contact me.

You seem to be new here. Subscribe to stay connected.