Application Development and Automation 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: 
Read only

moving itab data

Former Member
0 Likes
642

HI,

i have 2 structures.X_data and y_data both are of type structure TAB512 which is 512 characters

1.x_data-->contains data for ebeln and ihrez from ekko table.

2.Y_data--->conatins data for ebeln.ebelp and werks from ekpo table

3.now i want to move data of ebeln,ihrez and werks into z_data.

Since all are structures it is not accepting offset length in read table statement.

because here y_data and x_data conatins only one field WA of 512 characters.

So i have use offset lenth to divede into different fieldfs.

Ex: loop at y_data into e_data.

read table x_data inot f_data with ....here ..i am not able to give offset..

if sy-subrc eq 0.

move y_data-ebeln to z_data-ebeln.

move x_data-ihrez to z_data-ihrez.

move y_data-werks to z_data-werks.

append z_data

endif.

So can any body tell me how to resolve this?

5 REPLIES 5
Read only

Former Member
0 Likes
625

Hi,

Use loop endloop with offset instead of using Read statement.

Read only

Former Member
0 Likes
625

Hi,

You'll have to create two new tables

X_NEW_DATA with fields EBELN and IHREZ

Y_NEW_DATA with fields EBELN, EBELP and WERKS

and then use them.

This is because you cannot compare offset by offset and if you do it at all in Loop statement it will be a very ridiculous code.

because I guess you would like to compare something like this

X_DATA0(10) = Y_DATA0(10)

So,

please create new tables, more your data there and then manipulate these tables.

Regards

Nishant

Read only

Former Member
0 Likes
625

Try giving offset while moving as following..

loop at y_data into e_data.

read table x_data into f_data with ...

if sy-subrc eq 0.

move y_data+0(20) to z_data-ebeln.

move x_data-ihrez+20(10) to z_data-ihrez.

move y_data-werks+30(10) to z_data-werks.

append z_data

endif.

Hope this clarifies wat m saying..reply back in case of doubt

Reward points if it helps

Read only

0 Likes
625

hey prashant,

did u read that the tables are actually having only one field as line of 512 chars?

How will he put a condition in read statement?

regards

Nishant

Message was edited by:

Nishant Rustagi

Read only

former_member195698
Active Contributor
0 Likes
625

What are the fields and its sequence in the two tables?will you always have X_NEW_DATA with EBELN and IHREZ

and Y_NEW_DATA with EBELN, EBELP and WERKS in the 512 character internal tables?

Message was edited by:

Abhishek Jolly