Application Development 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: 

Add Structure Fields to Dynamic table

Former Member
0 Kudos

Hi !

I want to print dynamic table in ALV GRID with color and style (some editable)

So I need to insert fields CELLCOLORS AND CELLSTYLES

which are declared regulary as

cellcolors TYPE lvc_t_scol

cellstyles TYPE lvc_t_styl

how do I do that dynamicly ?

thank you

Adi

2 REPLIES 2

FredericGirod
Active Contributor
0 Kudos

Hi

How do you create your dynamic table ? with fieldcatalog ... so just had this two fields in your fieldcatalog.

Frédéric

Former Member
0 Kudos

for example:

MOVE 'MATNR' TO wa_fieldcat_dyn-fieldname.

MOVE 'MARA' TO wa_fieldcat_dyn-ref_table.

MOVE 'MATNR' TO wa_fieldcat_dyn-ref_field.

APPEND wa_fieldcat_dyn TO gt_fieldcat_dyn.

MOVE 'CRLTAB' TO wa_fieldcat_dyn-fieldname.

MOVE 'RESC_DEFAULT_ALV_FIELDS' TO wa_fieldcat_dyn-ref_table.

MOVE 'COLORTAB' TO wa_fieldcat_dyn-ref_field.

APPEND wa_fieldcat_dyn TO gt_fieldcat_dyn.

ASSIGN st_struc_printout TO <fs_data>.

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = gt_fieldcat_dyn

IMPORTING

ep_table = <fs_data>

EXCEPTIONS

generate_subpool_dir_full = 1

OTHERS = 2.

ASSIGN <fs_data>->* TO <gt_printout>.

CREATE DATA new_line LIKE LINE OF <gt_printout>.

ASSIGN new_line->* TO <wa_printout>.