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: 

moving contents of itab at position....

Former Member
0 Kudos

Hi All,

Does anyone know how to move the contents of a range to an internal table (where the itab has the same structure) at a specifed index postion.??

URGENT ....PLEASE HELP

9 REPLIES 9

ThomasZloch
Active Contributor
0 Kudos

I'll be happy to tell you once you removed the "urgent" part.

0 Kudos

Why??

0 Kudos

because I think it's unpolite to flag something as "urgent", thus making your question seem more important than other peoples questions.

Cheers

Thomas

0 Kudos

Ok - wasnt my intention............................

Am testing out sols - Thanks

0 Kudos

no prob, I think Uwe has the right answer for you.

Thomas

uwe_schieferstein
Active Contributor
0 Kudos

Hello David

This is quite simple:

DATA: ls_rng    LIKE LINE OF r_range.  " same structure at lt_itab

ld_idx = 10.
LOOP AT r_range INTO ls_rng.
   INSERT ls_rng INTO TABLE lt_itab INDEX ld_idx.
ENDLOOP.

Regards

Uwe

0 Kudos

Hi Uwe, what about

APPEND LINES OF itab1 [FROM idx1] [TO idx2] TO itab2.

Edit: Just saw the difference, your code is inserting into the target at a given position (probably what the OP wants), whereas this statement is taking the source data from a given position.

Former Member
0 Kudos

use this ..

report .

types: begin of ty_itab ,

name(10) type c,

end of ty_itab .

data: itab type table of ty_itab with header line ,

itab1 type table of ty_itab with header line,

wa_itab type ty_itab,

wa_itab1 type ty_itab .

wa_itab-name = 'venkat1'.

append wa_itab to itab .

wa_itab-name = 'venkat2'.

append wa_itab to itab .

wa_itab-name = 'venkat3'.

append wa_itab to itab .

wa_itab-name = 'venkat4'.

append wa_itab to itab .

wa_itab-name = 'venkat5'.

append wa_itab to itab .

append lines of itab from 1 to 3 to itab1.

loop at itab1 into wa_itab1.

write:/ wa_itab1-name .

endloop.

Former Member
0 Kudos

Range is like a select option.

You have to loop at range nad populate the range-low field to the corrsponding internal table field.