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: 

Create Deep structure in Dyn.Int Table

former_member194669
Active Contributor
0 Kudos

Hi,

I am creating a deep structure inside a dynamic internal table, but it is not working.

Following is the code


  ls_fcat-fieldname = 'CELLTAB'.
  ls_fcat-no_out    = c_x.
  append ls_fcat to pt_fieldcat.

  call method cl_alv_table_create=>create_dynamic_table
    exporting
      it_fieldcatalog = pt_fieldcat
    importing
      ep_table        = g_hts.
  assign g_hts->* to <i_status>.
  ...
  ...

  field-symbols: <fs9> type LVC_T_STYL.

  loop at <i_status> assigning <wa_status>.
      assign component 'CELLTAB' of structure <wa_status> to <fs9>.
      " Here i am getting error 'Type conflict with ASSIGN in program'
  ...
  ...
 endloop.

But it is working fine with the following Uwe's example

https://wiki.sdn.sap.com/wiki/display/Snippets/CreatingFlatandComplexInternalTablesDynamicallyusingRTTI


  gs_comp-type ?= cl_abap_typedescr=>describe_by_data( celltab ).
  gs_comp-name  = 'CELLTAB'.
  append gs_comp to gt_components.

  go_sdescr  = cl_abap_structdescr=>create( gt_components ).
  go_tdescr  = cl_abap_tabledescr=>create( go_sdescr ).
  create data gdo_handle type handle go_tdescr.
  assign gdo_handle->* to <gt_itab>.
  ...

 loop at <gt_itab> assigning <gs_struc>.
    assign component 'CELLTAB' of structure <gs_struc> to <lt_celltab>.
 endloop.

3 REPLIES 3

naimesh_patel
Active Contributor

Pass the I_STYLE_TABLE flag to create a style table in dynamic table.


 call method cl_alv_table_create=>create_dynamic_table
    exporting
      it_fieldcatalog = pt_fieldcat
      I_STYLE_TABLE = 'X'      "<< To create a style table type LVC_T_STYL
    importing
      ep_table        = g_hts.
  assign g_hts->* to <i_status>.

Regards,

Naimesh Patel

0 Kudos

Thanks Naimesh,

I made a mistake while passing values while creating field catalog for style.


  ls_fcat-fieldname = 'CELLTAB'.
  ls_fcat-ref_field = 'STYL'.
  ls_fcat-ref_table = 'WTY_PNV_DYNPRO_ALV'.
  ls_fcat-no_out    = c_x.
  append ls_fcat to pt_fieldcat.

After giving this it is working fine.

Thanks All,

Pawan_Kesari
Active Contributor
0 Kudos

apart from these two field


  ls_fcat-fieldname = 'CELLTAB'.
  ls_fcat-no_out    = c_x.

what else is supplied to fieldcatelog for CELLTAB