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: 

MOVE-CORRESPONDING

Former Member
0 Kudos

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

Former Member
0 Kudos

can any one give their views?

peter_ruiz2
Active Contributor
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

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

MarcinPciak
Active Contributor
0 Kudos

Use assigning in Loop statement:

LOOP AT <dyn_table_IN> ASSIGNING <WA>.   

The rest is ok, I checked and works.

Former Member
0 Kudos

Thanks Peter ,

you gave me a right directions to achieve my goal.