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: 

Dynamic Internal Table

Former Member
0 Kudos

Hi Everyone,

i created dynamic internal table every thing is working fine. the problem is if output is less then 50 entries it is working fine. but if it exceeds 50 i am getting message

""LT_GENTAB-COL01" has already been declared 104 COL01(000070)""

This method i am using to create.

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = t_fldcat

IMPORTING

ep_table = t_newtable.

Please help me...

4 REPLIES 4

kesavadas_thekkillath
Active Contributor
0 Kudos

While building the fieldcatalog in t_fldcat , you are populating COL01 more than once.

Kesav

MarcinPciak
Active Contributor
0 Kudos

As Keshav noticed, if you get error message when using cl_alv_table_create=>create_dynamic_table it always has something to do with the fieldcatalog. In most cases it is created also dynamically so there is big chance you simply overlook some components is wrongly specified. In debug mode ensure you fieldcatalog looks how you want your table look like.

Regards

Marcin

Former Member
0 Kudos

Hi,

See the example of an dynamic Internal table.

It accepts more than 50 entries.

FIELD-SYMBOLS: <it> TYPE STANDARD TABLE,

<line>.

DATA: it_catlog TYPE lvc_t_fcat.

TYPES: BEGIN OF t_sflight,

carrid TYPE sflight-carrid,

connid TYPE sflight-connid,

fldate TYPE sflight-fldate,

END OF t_sflight.

DATA : wa_sflight TYPE t_sflight.

DATA: table TYPE REF TO data,

wa TYPE REF TO data,

wa_catlog TYPE lvc_s_fcat.

wa_catlog-fieldname = 'CARRID'.

wa_catlog-ref_field = 'CARRID'.

wa_catlog-ref_table = 'SFLIGHT'.

APPEND wa_catlog TO it_catlog.

wa_catlog-fieldname = 'CONNID'.

wa_catlog-ref_field = 'CONNID'.

wa_catlog-ref_table = 'SFLIGHT'.

APPEND wa_catlog TO it_catlog.

wa_catlog-fieldname = 'FLDATE'.

wa_catlog-ref_field = 'FLDATE'.

wa_catlog-ref_table = 'SFLIGHT'.

APPEND wa_catlog TO it_catlog.

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

  • i_style_table =

it_fieldcatalog = it_catlog

  • i_length_in_byte =

IMPORTING

ep_table = table

  • e_style_fname =

EXCEPTIONS

generate_subpool_dir_full = 1

OTHERS = 2

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ASSIGN table->* TO <it>.

CREATE DATA wa LIKE LINE OF <it>.

ASSIGN wa->* TO <line>.

SELECT carrid connid fldate

FROM sflight

INTO TABLE <it>.

LOOP AT <it> INTO wa_sflight.

WRITE:/ wa_sflight-carrid,

wa_sflight-connid,

wa_sflight-fldate.

ENDLOOP.

Hope this would be helpful.

Thanks & Regards,

Supriya.

former_member184611
Active Participant
0 Kudos

Hi Rajesh,

check whether you have made any mistakes while passing the type and size of filelds. Other than a mistake with values while creating the fieldcatalogue, I think there wont be any problem. You could use the FM 'DDIF_FIELDINFO_GET' (or try RTTS Classes) to find the attributes like type, length, etc. of fieldnames. See below for sample code.

DATA: t_field TYPE lvc_t_fcat,

t_dfies TYPE TABLE OF dfies,

t_ref_tb TYPE REF TO data,

x_field TYPE lvc_s_fcat,

x_dfies TYPE dfies,

x_wa TYPE REF TO data,

v_count TYPE i.

FIELD-SYMBOLS: <fs_table> TYPE STANDARD TABLE,

<fs_wa> TYPE ANY.

x_field-tabname = 'SPFLI'.

x_field-fieldname = 'CARRID'.

APPEND x_field TO t_field.

x_field-tabname = 'SPFLI'.

x_field-fieldname = 'CONNID'.

APPEND x_field TO t_field.

x_field-tabname = 'SPFLI'.

x_field-fieldname = 'COUNTRYFR'.

APPEND x_field TO t_field.

LOOP AT t_field INTO x_field.

CALL FUNCTION 'DDIF_FIELDINFO_GET'

EXPORTING

tabname = x_field-tabname

fieldname = x_field-fieldname

TABLES

dfies_tab = t_dfies.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

v_count = v_count + 1.

READ TABLE t_dfies INTO x_dfies INDEX 1.

IF sy-subrc EQ 0.

x_field-datatype = x_dfies-datatype.

x_field-intlen = x_dfies-leng.

x_field-decimals = x_dfies-decimals.

x_field-key = x_dfies-keyflag.

MODIFY t_field INDEX v_count FROM x_field .

CLEAR x_field.

ENDIF.

ENDLOOP.

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = t_field

IMPORTING

ep_table = t_ref_tb

EXCEPTIONS

generate_subpool_dir_full = 1

OTHERS = 2.

IF sy-subrc EQ 0.

ASSIGN t_ref_tb->* TO <fs_table>.

CHECK sy-subrc EQ 0.

CREATE DATA x_wa LIKE LINE OF <fs_table>.

ASSIGN x_wa->* TO <fs_wa>.

ENDIF.

Thanks.