10-17-2008 7:15 AM
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
10-17-2008 7:43 AM
10-17-2008 7:50 AM
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
10-17-2008 7:55 AM
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
10-17-2008 7:55 AM
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
10-17-2008 8:06 AM
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
10-17-2008 8:07 AM
Use assigning in Loop statement:
LOOP AT <dyn_table_IN> ASSIGNING <WA>.
The rest is ok, I checked and works.
10-19-2008 2:05 PM