cancel
Showing results for 
Search instead for 
Did you mean: 

Create Dynamic Table short dump

shiva_suvarna
Participant
0 Kudos

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.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

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

former_member215188
Participant
0 Kudos

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.

Former Member
0 Kudos

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

shiva_suvarna
Participant
0 Kudos

Hi Ravikumar,

thanks for the reply

I am working on 4.6C ,

I am using this method in my application

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = lt_excel_flds

IMPORTING

ep_table = mt_ref_kf_data

EXCEPTIONS

generate_subpool_dir_full = 1

OTHERS = 2

.

actually there is lot of code in my application that will be too big to post here, i will tell what actually i am doing here is,

first the user has to select what ever the fields he wants from 4,5 tables. so then i have to build the table dynamically then show it in a grid.

Former Member
0 Kudos

Shiva,

As per your logic, you are going to collect fields from 4/5 tables and create ONLY one DYNAMIC INTERNAL table, right? So, where is the case of creating 36 tables.

Make sure you free your table / objects at the end of the program. That might be creating problem as you run your program multiple times.

Yes, there is a limitation of creating 36 dynamic tables in 4.6C.

Regards,

Ravi

Note : Please mark the helpful answers

shiva_suvarna
Participant
0 Kudos

Hi ravikumar,

Here this logic will be execute every time when the user executes one of the function in my application. i have a one button ('SHOW') in my application .when ever user presses this button i will move to other screen and there i show the RESULT GRID, from there user can come back and he can redo the process again, so like this he can do it n number of times, but i was stucked at 37th time.

Former Member
0 Kudos

Shiva,

When you come back to your main application FREE out all the objects you have used. They will get recreated again anyways, that is exactly the problem.

Regards,

Ravi

Note : Please mark the helpful answers and close the thread if the issue is resolved.

athavanraja
Active Contributor
0 Kudos

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.