Skip to Content
0

Dynamic table with with different number of columns in each row ( as data)

Dec 08, 2016 at 12:21 PM

49

avatar image
Former Member

Hi Experts.

I have a requirement to create a internal table with dynamic number of columns in the each row being filled into the internal table. Let me explain more on the requirement.

There are some static columns needed in a internal table like static1 static2 static3 ..static4 followed by some dynamic columns dynamic1 dynamic2...etc.

The number of dynamic columns can vary each time like data can be as follows like below final table

Data in rows of a final internal table required.

Row1 : static1 static2 static3 static4 static5 dynamic1 dynamic2 dynamic3 dynamic4

Row2 :static1 static2 static3 static4 static5 dynamic1 dynamic2

Row3:static1 static2 static3 static4 static5 dynamic1 dynamic2 dynamic3

Row4 :static1 static2 static3 static4 static5 dynamic1

The number of dynamic columns in each row can vary according to the data like...if there are 4 items for a header- 4 dynamic columns are required adjacent to the header data which is static, if 2 items for a header - 2 dynamic columns, 6 items - 6 dynamic columns and so on,

Please let me know your thoughts on how to achieve this or is this possible,

Thanks in advance.

Gowthami SK

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Mangesh Parihar Apr 19, 2017 at 04:59 AM
0

Hi Gowthami,

I am not sure if you could do that. Instead you can create a field catalog which will contain max number of columns possible.

And fill only the cells which are required and other cells will be blank.

Example.

data : lv_num type i value 1.
while lv_num <= max_num_of_col.
     *make fieldcat
endwhile.

Hope it helps.

Regards,

Mangesh

Share
10 |10000 characters needed characters left characters exceeded