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 to copy data from one itab1 to itab2 based on a range of values

Former Member
0 Kudos

Hi frnds,

I have an the internal table itab1 (vbak) with data. I want to move some data from itab1 to itab2 where vbeln = s_vbeln-low to s_vbeln-high. Here s_vbeln is a select-option on selection-screen.

Please suggest me an idea how we can implement this as I can't find any option in loop or read statements for this kind of requirement.

Thanks in advance.

<REMOVED BY MODERATOR - REQUEST OR OFFER POINTS ARE FORBIDDEN>

regards,

Shano

Edited by: Alvaro Tejada Galindo on Sep 19, 2008 5:07 PM

1 ACCEPTED SOLUTION

naveen_inuganti2
Active Contributor
0 Kudos

Hi

Maintain both internal table with same structure...also declare one work area like wa

After fetching the itab1.

loop at itab1 into wa where vebln between low and high.  (or vbeln in s_vbeln) 
   append wa to itab2.
   clear wa.
endloop.

Thanks,

Naveen.I

3 REPLIES 3

naveen_inuganti2
Active Contributor
0 Kudos

Hi

Maintain both internal table with same structure...also declare one work area like wa

After fetching the itab1.

loop at itab1 into wa where vebln between low and high.  (or vbeln in s_vbeln) 
   append wa to itab2.
   clear wa.
endloop.

Thanks,

Naveen.I

Former Member
0 Kudos

hi,

data : v_vbeln like vbak-vbeln.

select-options : s_vbeln for v_vbeln.

start-of-selection.

select fields into table itab1

from dtab

where vbeln in s_vbeln.

loop at itab1 into wa1 where vbeln in s_vbeln.

append wa1 to itab2.

clear wa1.

endloop.

Regards,

deepthi.

Edited by: deepthi dandibhotla on Sep 19, 2008 3:27 PM

Former Member
0 Kudos

Hi Shano,

Make S_vbeln-sign as 'E' and then delete itab1 where vbeln not in S_VBELN. Then you will have itab1 with data between teh range S_VBELN-LOW and S_VBELN-high.

Srikanth