Skip to Content
Former Member
Oct 05, 2010 at 03:51 PM

Editable & Dynamic ALV



I have the situation where I want to create an editable ALV whose column fields will be known during run time. So, here I'm using Dynamic Internal table concept.

Let me give a picture how my present program works,

Inside the fieldcatalog, ifc I have passed the deep structure of type lvc_s_styl, by pointing to the reference table and reference field.

Then I'm using the below code,

CALL METHOD cl_alv_table_create=>create_dynamic_table
      it_fieldcatalog           = ifc
      i_length_in_byte          = 'X'
      ep_table                  = dy_table
      generate_subpool_dir_full = 1
      OTHERS                    = 2.

  ASSIGN dy_table->* TO <dyn_table>.
  CREATE DATA dy_line LIKE LINE OF <dyn_table>.
  ASSIGN dy_line->* TO <dyn_wa>.

And I got the dynamic Internal table having one field (let it be the first column of that internal table) corresponding to the deep structure where we need to pass the fieldname and style = cl_gui_alv_grid=>mc_style_enabled.

Suppose, I have an internal table containing all the fieldnames (consider there are 5 fields) to be in editable mode, lets say, itab.


DATA ls_stylerow TYPE lvc_s_styl .
DATA lt_styletab TYPE lvc_t_styl .

    LOOP AT itab INTO wa.
      ASSIGN COMPONENT 1 OF STRUCTURE <dyn_wa> TO <t_celltab>.
      CLEAR ls_stylerow.
      ls_stylerow-fieldname = wa-fildname.
      ls_stylerow-style     = cl_gui_alv_grid=>mc_style_enabled.
      INSERT ls_stylerow INTO TABLE lt_styletab.
      INSERT LINES OF lt_styletab INTO TABLE <t_celltab>.

And the last bit of code is not working.

My question is simple, How can i assign an internal table (type lvc_s_styl) containing values, to that deep structure field of that dynamic internal table?

Thanks in advance!

Edited by: kishan P on Oct 5, 2010 9:22 PM