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 column creation

Former Member
0 Likes
533

Hai all,

I have declared item no(EBELP) in my internal table(itab). When i give document no(EBELN) as input the

itab may contain 1 or 2 or 3 values.

My requirement is how to increase the column number dynamically as the itab increases?

if itab has 1 row means then output should contain 1 column,

if itab has 2 rows means then output should contain 2 columns....and so on

Regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
505

Hi,

You can do this using Dynamic Internal Tables. Get the Number of rows first. Then use a Do statement and populate the internal table of type field catalog. After this create a dynamic internal table. so if you have 10 records you get 10 columns if you have 100 then you get 100 columns.

Regarding creation of internal table there are lots of threads and blogs available in SDN.

Hope this would have helped you.

Thanks,

Prashanth

3 REPLIES 3
Read only

Former Member
0 Likes
505

Check this program

HTWLINF0

or this link

[https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/dynamic%252binternal%252btable]

Regards

Sathar

Read only

Former Member
0 Likes
505

This message was moderated.

Read only

Former Member
0 Likes
506

Hi,

You can do this using Dynamic Internal Tables. Get the Number of rows first. Then use a Do statement and populate the internal table of type field catalog. After this create a dynamic internal table. so if you have 10 records you get 10 columns if you have 100 then you get 100 columns.

Regarding creation of internal table there are lots of threads and blogs available in SDN.

Hope this would have helped you.

Thanks,

Prashanth