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: 

fill dinamic internal table from internal table

alejandro_romero2
Participant
0 Kudos

Hi gurus i need to know how can i fill a dinamic interna table from another internal table

example i have the table called it_info with the followin information

field1 field2 field3

Alex Ross 1

Rita Campos 1

because i have the same value in field 3 i have to agroup register 1 and 2 in the same line so the data should be in the next way

Field1 field2 field3 field4 field5

Alex Ross 1 Rita Campos

I have made a dinamic interna table so my table has the 5 fields but i dont know how to trasfer the data to my dinamic internal table, any idea? my source code:

it_campos-campo = 'Field1'. APPEND it_campos.

it_campos-campo = 'Field2'. APPEND it_campos.

it_campos-campo = 'Field3'. APPEND it_campos.

it_campos-campo = 'Field4'. APPEND it_campos

loop at it_campos .

t_fieldcat_wa-col_pos = SY-TABIX.

t_fieldcat_wa-fieldname = it_campos-campo.

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>.

ASSIGN ep_line->* TO <l_line>.

Now my dinamic internal table <l_table> is ready but how should i trasnfer the it_info data to this other table?

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor
0 Kudos

This method (cl_alv_table_create=>create_dynamic_table) is really old-fashioned and counter-performant and limited as it uses GENERATE SUBROUTINE POOL statement.

Instead you should now use RTTC to create data, search forum for more information (sometimes referred as RTTS or RTTI, though this last one doesn't correspond to creation; you'll have to use CREATE DATA statement).

That said, your question has been asked many times in the forum: http://www.sdn.sap.com/irj/scn/advancedsearch?query=filldynamicinternal+table.

To help you a little bit, you need to use ASSIGN and FIELD-SYMBOLS statements (ASSIGN COMPONENT field_name OF STRUCTURE <fs_line> TO <fs_field>)

2 REPLIES 2

Sandra_Rossi
Active Contributor
0 Kudos

This method (cl_alv_table_create=>create_dynamic_table) is really old-fashioned and counter-performant and limited as it uses GENERATE SUBROUTINE POOL statement.

Instead you should now use RTTC to create data, search forum for more information (sometimes referred as RTTS or RTTI, though this last one doesn't correspond to creation; you'll have to use CREATE DATA statement).

That said, your question has been asked many times in the forum: http://www.sdn.sap.com/irj/scn/advancedsearch?query=filldynamicinternal+table.

To help you a little bit, you need to use ASSIGN and FIELD-SYMBOLS statements (ASSIGN COMPONENT field_name OF STRUCTURE <fs_line> TO <fs_field>)

alejandro_romero2
Participant
0 Kudos

Thanks a lot i solved by myself