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

Internal Table formatting

Former Member
0 Likes
462

Dear Gurus,

I have an internal table with the data as discribed below:

internal Name iteration_value

val0000 abcd 1000

val0000 efgh 2000

val0000 ijkl 3000

val0015 abcd 2500

val0015 efgh 3000

val0015 ijkl 2350

val0030 abcd 2000

val0030 efgh 2500

val0030 ijkl 2000

'

'

'

'

' and so on

i need it in a format :

interval ABCD EFGH IJKL

val0000 1000 2000 3000

val0015 2500 3000 2350

val0030 2000 2500 2000

'

'

'

'and so on.

please help how can i achieve the above functionality.

it is also possible that the names increase in number ie. now i have names as ABCD,EFGH,IJKL,MNOP and QRST the name is defined at runtime.

please advice how to achieve the above logic.

Regards,

Ankit Bajaj

1 ACCEPTED SOLUTION
Read only

dhirendra_pandit
Active Participant
0 Likes
430

Hi Ankit,

Use dynamic internal table for your requirement use call method cl_alv_table_create=>create_dynamic_table to do it.

For this you have to sort your internal table and sort it based on the NAME.

now for each name you have to add a filed in dynamic field catalog table. now pass this catalog table to this method and your table is ready.

After that you should read the value of your internal table value to dynamic internal table based on (put AT LAST on internal field).

Regards

Dhirendra

2 REPLIES 2
Read only

MarcinPciak
Active Contributor
0 Likes
430

This is more or less same approach as for [creating a pivot table|].

Regards

Marcin

Read only

dhirendra_pandit
Active Participant
0 Likes
431

Hi Ankit,

Use dynamic internal table for your requirement use call method cl_alv_table_create=>create_dynamic_table to do it.

For this you have to sort your internal table and sort it based on the NAME.

now for each name you have to add a filed in dynamic field catalog table. now pass this catalog table to this method and your table is ready.

After that you should read the value of your internal table value to dynamic internal table based on (put AT LAST on internal field).

Regards

Dhirendra