Application Development 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: 

how make like this

Former Member
0 Kudos

hi

my internal table is like this

sale oder kunnr name1 city

1321564 1188 najhgd city1

1324154 1199 hgfgdhf city2

but i want to change like this

1321564 1188 najhgd

1321564 1188 city1

1324154 1199 hgfgdhf

1324154 1199 city2

how to do this .....

thanks in advance

kumar

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi rajini,

if you want it in a new internal table, than

append 1 time with name1 = name1 and 1 time with name1 = city

(2 appends!!).

If you want it only at an output:

loop at itab.

write: / itab-sale, itab-kunnr, itab-name1.

write: / itab-sale, itab-kunnr, itab-city.

endloop.

Hope it helps.

Regards, Dieter

8 REPLIES 8

suresh_datti
Active Contributor
0 Kudos

declare another itab2 with sale oder kunnr name1 as the fields.


sort itab1.
loop at itab1.
itab2-sale_order = itab1-sale_order.
itab2-kunnr = itab1-kunnr.
itab2-name1 = itab1-name1.
append itab2.
itab2-name1 = itab1-city2.
append itab2.
clear itab2.
endloop.
* Now Itab2 will ahve the data you need...

~Suresh

Former Member
0 Kudos

Hi rajini,

if you want it in a new internal table, than

append 1 time with name1 = name1 and 1 time with name1 = city

(2 appends!!).

If you want it only at an output:

loop at itab.

write: / itab-sale, itab-kunnr, itab-name1.

write: / itab-sale, itab-kunnr, itab-city.

endloop.

Hope it helps.

Regards, Dieter

Former Member
0 Kudos

loop at itab into wa_itab.

wa_itab1-vbeln = wa_itab-vbeln.

wa_itab2-vbeln = wa_itab-vbeln.

wa_itab1-kunnr = wa_itab-kunnr.

wa_itab2-kunnr = wa_itab-kunnr.

wa_itab1-name1 = wa_itab-name1.

wa_itab2-name1 = wa_itab-city.

append wa_itab1 to itab2.

append wa_itab2 to itab2.

endloop.

Itabe2 will have your req format.

Former Member
0 Kudos

<b>Hi code like this

data: itab which cointains

sale oder kunnr name1 city

And Data: itab1 which cointains

saleoder kunnr and name/city(50) type char.

Then

Loop at itab.

move saleoder to itab1-saleoder.

move kunnr to itab1-kunnr .

move name1 to itab1-name1.

append itab1.

move saleoder to itab1-saleoder.

move kunnr to itab1-kunnr .

move city to itab1-city.

append itab1.

endloop.

Regs

Manas Ranjan Panda</b>

Message was edited by:

MANAS PANDA

Former Member
0 Kudos

itab ---> your old table

saleorder

kunnr

name1

city

itab2 --> new table

saleorder

kunnr

text

sort itab.

Loop at itab.

clear itab2.

move-coressponding itab to itab2.

move itab-name1 to itab2-text.

append itab2.

clear itab2.

move-coressponding itab to itab2.

move itab-city to itab2-text.

append itab2.

Endloop.

anversha_s
Active Contributor
0 Kudos

hi,

try this.

sort itab1.

loop at itab1.

itab2-sale_order = itab1-sale_order.

itab2-kunnr = itab1-kunnr.

itab2-name1 = itab1-name1.

append itab2.

itab2-name1 = itab1-city2.

append itab2.

clear itab2.

endloop.

rgsd

anver

Former Member
0 Kudos

hi Rajini,


sort itab by field1 field2 field3 field4.
loop at itab into x_tab.
 x_tab-field1 = itab-field1.
 x_tab-field2 = itab-field2.
 x_tab-field3 = itab-field3.
 append x_tab to itab_new.
 x_tab-field3 = itab-field4.
 append x_tab to itab_new.
 clear x_tab.
endloop.

Hope this helps.

Regards,

richa

santhosh_patil
Contributor
0 Kudos

Hi,

Try with this ...

loop at itab1. ( your initial internal table)

itab2-vbeln = itab1-vbeln.

itab2-kunnr = itab1-kunnr.

itab2-name = itab1-name1.

append itab2.

itab2-name = itab1-city.

append itab2.

clear itab2.

endloop.

-


Santhosh