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

MOVE-CORRESPONDING

Former Member
0 Likes
875

Hi all,

I hve two different dynamic tables with same structure <dyn_table_IN> and <dyn_table_OUT>.

I'm loop in <dyn_table_IN> for calculate the values of some fields of <dyn_table_OUT>.

but i want to move only particuler fields of <dyn_table_IN> into <dyn_table_OUT>. whose i'm not calculated in select(dynamically)

LOOP AT <dyn_table_IN> INTO <WA>.( suppose struct of dyn_table_IN is matnr pstat matnr same as <dyn_table_OUT>. )

data : dy_line1 type ref to data.

create data dy_line1 like line of <dyn_table_OUT>.

assign dy_line1->* to <wa1>.

SELECT (QLIST) FROM (QFROM) (suppose qlist is matnr matnr)

INTO corresponding fields of <WA1>

WHERE (QWHERE1) .

MOVE-CORRESPONDING <WA> TO <WA1>. here i want to transfer the values of only pstat into <wa1>

endloop.

pls help me.

regards

anuj

7 REPLIES 7
Read only

Former Member
0 Likes
835

can any one give their views?

Read only

peter_ruiz2
Active Contributor
0 Likes
835

hi Anuj,

try this one.

data:

ld_field type char20.

field-symbols:

<fs_field1> type any,

<fs_field2> type any.

move 'PSTAT' to ld_field.

assign component ld_field of structure <wa> to <fs_field1>.

assign component ld_field of structure <wa_1> to <fs_field2>.

move <fs_field2> to <fs_field1>.

regards,

Peter

Read only

Former Member
0 Likes
835

I didnt get your requirement exactly

after select the statement, append ll the values into it_wa1.

then use

LOOP AT <dyn_table_IN> INTO <WA>

READ TABLE IT_WA1 WHERE (GIVE THE FIELD NAMES YOU WANT TO COMPARE)
IF SY-SUBRC <> 0.
MOVE-CORRESPONDING <WA> TO <WA1>.
ENDIF

ENDLOOP.

REVERT BACK FOR QUERIES

Read only

Former Member
0 Likes
835

Thanks peter,

but i just give PSTST as an example i want to move that fields which r different between qlist & <dyn_in> .

regards,

Anuj

Read only

0 Likes
835

hi Anuj,

yes, i know. i used it as an example. by the way, in your program you can determine which fields are not used in the computation. so, you can easily assign those fields into a field symbol and use ito to copy the contents of those fields.

regards,

Peter

Read only

MarcinPciak
Active Contributor
0 Likes
835

Use assigning in Loop statement:

LOOP AT <dyn_table_IN> ASSIGNING <WA>.   

The rest is ok, I checked and works.

Read only

Former Member
0 Likes
835

Thanks Peter ,

you gave me a right directions to achieve my goal.