Skip to Content
0
Oct 24, 2011 at 03:35 PM

convert rows of internal table?

32 Views

Hi,

I was hoping someone could help me out.

I have an internal table with fields EINDT, MENGE, MEINS, STAT.

I have to convert this to an internal table of the kind:

EINDT1

MENGE1

MEINS1

STAT1

EINDT2

MENGE2

MEINS2

STAT2

EINDT3

MENGE3

MEINS3

STAT3

EINDT4

MENGE4

MEINS4

STAT4

EINDT5

MENGE5

MEINS5

STAT5

So, every line of the second internal table exists of 5 of the lines of the original internal table.

So what I was doing is

loop at internal table1.

case sy-tabix.

when 1.

wa_line-eindt1 = tdelivdata-eindt.

wa_line-menge1 = tdelivdata-menge.

wa_line-meins1 = tdelivdata-meins.

wa_line-stat1 = tdelivdata-stat.

when 2.

wa_line-eindt2 = tdelivdata-eindt.

................

And I would do an append at the fifth line.

The problem is, that it is possible that the original internal table only has 3 lines, or maybe 12.

So then appending on every fifth tabix wouldn't work.

So how do I solve this?

THANK YOU!