Skip to Content

Create Dynamic Table short dump

Hi friends,

I have a problem while creating dynamic table by using

<b>CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE</b>.

this method is only executing for 36 times, i saw some threads which were on similar topic but none was answered fully.

i have to execute this method more times not exactly like 36 times it will not be senseful in my application if i execute it only 36 times.

how to solve this problem?

I will be thankful for your replies.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • avatar image
    Former Member
    Apr 25, 2006 at 05:43 AM

    Shiva,

    1. I think we can avoid the logic of creating more than 36 dynamic tables. If you can post your code here we can look into the same.

    2. Not sure which version you are on, but from WAS 6.2, you create a table using

    CREATE DATA variable TYPE (TABLE_TYPE).

    See if this fits your requirement.

    Regards,

    Ravi

    Note : Please mark the helpful answers

    Add comment
    10|10000 characters needed characters exceeded

    • Unfortunately CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE will throw exception GENERATE_SUBPOOL_DIR_FULL after 36 times.

      this can be handled by a different approach in WAS6.40 system. but in 4.6C i guess you have to live with that

      Regards

      Raja

      If you are intersted in the WAS6.40 approach do let me know.

  • Apr 25, 2006 at 06:19 AM

    hi.. i have succesfully used both cl_alv_table_create and the new rtts in creating dynamic internal tables. However, I am not aware of the issue of only being able to run METHOD create_dynamic_table n times. Can anyone enlighten me? Thanks.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 29, 2007 at 02:11 PM

    Hi,

    You can use the following code also to create dynamic Internal table

    <u><b>Creating Dynamic internal table </b></u>

    PARAMETERS : p_table(10) TYPE C.

    DATA: w_tabname TYPE w_tabname,

    w_dref TYPE REF TO data,

    w_grid TYPE REF TO cl_gui_alv_grid.

    FIELD-SYMBOLS: <t_itab> TYPE ANY TABLE.

    w_tabname = p_table.

    CREATE DATA w_dref TYPE TABLE OF (w_tabname).

    ASSIGN w_dref->* TO <t_itab>.

    <u><b> Populating Dynamic internal table </b></u>

    SELECT * FROM (w_tabname) UP TO 20 ROWS INTO TABLE <t_itab>.

    <u><b>Create a dynamic internal table with the specified number of columns.</b></u>

    <u><b> Creating Dynamic internal table</b></u>

    TYPE-POOLS: slis.

    FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE, “ Dynamic internal table name

    <fs_dyntable>, “ Field symbol to create work area

    <fs_fldval> type any. “ Field symbol to assign values

    PARAMETERS: p_cols(5) TYPE c. “ Input number of columns

    DATA: t_newtable TYPE REF TO data,

    t_newline TYPE REF TO data,

    t_fldcat TYPE slis_t_fldcat_alv,

    t_fldcat TYPE lvc_t_fcat,

    wa_it_fldcat TYPE lvc_s_fcat,

    wa_colno(2) TYPE n,

    wa_flname(5) TYPE c.

    • Create fields .

    DO p_cols TIMES.

    CLEAR wa_it_fldcat.

    move sy-index to wa_colno.

    concatenate 'COL'

    wa_colno

    into wa_flname.

    wa_it_fldcat-fieldname = wa_flname.

    wa_it_fldcat-datatype = 'CHAR'.

    wa_it_fldcat-intlen = 10.

    APPEND wa_it_fldcat TO t_fldcat.

    ENDDO.

    • Create dynamic internal table and assign to FS

    CALL METHOD cl_alv_table_create=>create_dynamic_table

    EXPORTING

    it_fieldcatalog = t_fldcat

    IMPORTING

    ep_table = t_newtable.

    ASSIGN t_newtable->* TO <t_dyntable>.

    • Create dynamic work area and assign to FS

    CREATE DATA t_newline LIKE LINE OF <t_dyntable>.

    ASSIGN t_newline->* TO <fs_dyntable>.

    <u><b>Populating Dynamic internal table </b></u>

    DATA: fieldname(20) TYPE c.

    DATA: fieldvalue(10) TYPE c.

    DATA: index(3) TYPE c.

    DO p_cols TIMES.

    index = sy-index.

    MOVE sy-index TO wa_colno.

    CONCATENATE 'COL'

    wa_colno

    INTO wa_flname.

    • Set up fieldvalue

    CONCATENATE 'VALUE' index INTO

    fieldvalue.

    CONDENSE fieldvalue NO-GAPS.

    ASSIGN COMPONENT wa_flname

    OF STRUCTURE <fs_dyntable> TO <fs_fldval>.

    <fs_fldval> = fieldvalue.

    ENDDO.

    • Append to the dynamic internal table

    APPEND <fs_dyntable> TO <t_dyntable>.

    Hope this may help.....

    Thanks

    Jitendra

    Add comment
    10|10000 characters needed characters exceeded