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

Dynamic internal table

Former Member
0 Likes
314

Hi everyone.

I have a program with a deep internal table with the following structure:

DATE TIME VALUE_PROF

2/2 15:30

2/2 15:45

3/2 15:00

And VALUE_PROF has the following structure:

PROFILE VALUE

00000150 145.6

00000151 145.6

I need to show this data through an ALV Control. I have been thinking on how to make the catalog, but I couldn't figure it out. So I thought to move this table to another one with the following structure:

DATE TIME 00000150 0000151

2/2 15:30 145.6 145.6

3/2 15:30 145.7 145.7

And so on. How can I do this? I mean, how can I know how many columns will have the table? I can count the deep table's records, but how I translate it into the amount of columns?

1 ACCEPTED SOLUTION
Read only

faisalatsap
Active Contributor
0 Likes
293

Hi,

In the following link you will be able to get the Sample Code by using this you can create Dynamic Internal Table, May it will help you to solve out your problem, Test the Sample Code of Lakshman i have tested it is working fine may it will give you error when copy and past to your editor but you just need to comment out the commented lines.

[Dynamic Internal Table|;

Kind Regards,

Faisal

2 REPLIES 2
Read only

faisalatsap
Active Contributor
0 Likes
294

Hi,

In the following link you will be able to get the Sample Code by using this you can create Dynamic Internal Table, May it will help you to solve out your problem, Test the Sample Code of Lakshman i have tested it is working fine may it will give you error when copy and past to your editor but you just need to comment out the commented lines.

[Dynamic Internal Table|;

Kind Regards,

Faisal

Read only

Former Member
0 Likes
293

Hi,

use this class to create an internal table dynamically

*TRY.
CALL METHOD cl_abap_tabledescr=>create
  EXPORTING
    p_line_type  =
*    p_table_kind = TABLEKIND_STD
*    p_unique     = ABAP_FALSE
*    p_key        =
*    p_key_kind   = KEYDEFKIND_DEFAULT
  receiving
    p_result     =
    .
* CATCH cx_sy_table_creation .
*ENDTRY.

Regards,

Siddarth