Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 845

Insert a table in a dynamic table

$
0
0

I need a dynamic table to display it with an ALV. That works fine with the following code below.

Now I have the requirement to color each cell differently in my ALV.

For that, I need a table with the type LVC_T_SCOL in my dynamic table for my ALV.

 

How could I add a table? (The code below is only for adding a normal data-element.)

 

wa_fieldcat_mr-fieldname = 'FIELDNAME'.

wa_fieldcat_mr-datatype  = 'char'.

wa_fieldcat_mr-intlen    = 10.

wa_fieldcat_mr-coltext    = 'coltext'.

APPEND wa_fieldcat_mr TO it_fieldcat_mr.


     CALL METHOD cl_alv_table_create=>create_dynamic_table

       EXPORTING

         it_fieldcatalog = it_fieldcat_mr

       IMPORTING

         ep_table        = t_newtable.

 

     ASSIGN t_newtable->* TO <t_dyntable>. "now I can use <t_dyntable> as my internal table


"Fill it with data

...


"Display it


* Field that identify cell color in inetrnal table

MOVE 'COLOR_CELL' TO gs_layout_mr-ctab_fname.

 

CALL METHOD alv_grid_mr->set_table_for_first_display

       EXPORTING

 

         is_layout                     = gs_layout_mr

       CHANGING

         it_outtab                     = <t_dyntable>

         it_fieldcatalog               = it_fieldcat_mr.


Viewing all articles
Browse latest Browse all 845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>