Skip to Content

Create Deep structure in Dyn.Int Table

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Jun 18, 2008 at 02:56 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 18, 2008 at 02:58 PM

    apart from these two field

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

    what else is supplied to fieldcatelog for CELLTAB

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.