Application Development and Automation 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: 
Read only

create dynamic table CALL METHOD cl_alv_table_create=>create_dynamic_table

alejandro_romero2
Participant
0 Likes
671

Hi gurus i have a problem i have created a dinamic internal table but the lenght of the internal table fields is 10 i need longer fields

here is my code thanks

data: begin of it_campos OCCURS 0,

campo1(12) type c,

END OF it_campos.

do n times.

clear nocamptmp.

add 1 to incont.

CONDENSE incont NO-GAPS.

cont = incont.

CONCATENATE nocamp cont into nocamptmp.

wa_campos-campo1 = nocamptmp.

append wa_campos to it_campos.

enddo .

loop at it_campos into wa_campos.

t_fieldcat_wa-col_pos = SY-TABIX.

t_fieldcat_wa-fieldname = wa_campos-campo1.

APPEND t_fieldcat_wa TO t_fieldcat.

endloop .

CALL METHOD cl_alv_table_create=>create_dynamic_table

EXPORTING

it_fieldcatalog = t_fieldcat

IMPORTING

ep_table = tabla

EXCEPTIONS

GENERATE_SUBPOOL_DIR_FULL = 1

others = 2.

ASSIGN tabla->* TO <l_table>.

CREATE DATA ep_line LIKE LINE OF <l_table>.

all is fine but the fields of <l_table> are char(10) and my data is longer than 10 how can i increase the lenght of the table fields

any idea thanks

2 REPLIES 2
Read only

alejandro_romero2
Participant
0 Likes
373

Thanks i solved by myself i just modify the outputlenght field in the field catalog before use the cl_alv_table_create=>create_dynamic_table

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
373

Modify the fieldcatalog accordingly for e.g.,

LOOP AT it_campos INTO wa_campos.
  t_fieldcat_wa-col_pos = sy-tabix.
  t_fieldcat_wa-fieldname = wa_campos-campo1.
  t_fieldcat_wa-inttype = 'C'. " Character Type
  t_fieldcat_wa-intlen = '50'. "50 character length
  APPEND t_fieldcat_wa TO t_fieldcat.
ENDLOOP .

BR,

Suhas