2008 Mar 10 3:49 PM
Hi Friends ,
I have an internal table with 2 records . A work area which has the changes to a particular zfield1 .
I am using the following statement below to modify the internatable record with that field .
How will this statement execute ?
Thanks!
LOOP AT I_TABLE_TEMP INTO W_TEMP
....
...
MODIFY I_TABLE_TEMP FROM W_TEMP TRANSPORTING DATE.
...
..
ENDLOOP.
I_TABLE_TEMP has 2 records in the body of the internal table .
Edited by: Hari G Krishna on Mar 10, 2008 11:49 AM
2008 Mar 10 5:12 PM
LOOP AT I_TABLE_TEMP INTO W_TEMP
....
...
MODIFY I_TABLE_TEMP FROM W_TEMP TRANSPORTING DATE.
...
..
ENDLOOP.
MODIFY I_TABLE_TEMP FROM W_TEMP TRANSPORTING DATE.
This command will only move the value of the field date, u should use it without that adition, so all the fields of the work area will be moved to the internal table.
MODIFY I_TABLE_TEMP FROM W_TEMP.
gl
2008 Mar 10 5:32 PM
hi
When you use this statement it will modify the record using the field DATE.
LOOP AT I_TABLE_TEMP INTO W_TEMP
....
...
MODIFY I_TABLE_TEMP FROM W_TEMP TRANSPORTING DATE.
...
..
ENDLOOP.
In the above code even if you are going to modify some other field in the internal table say I_TABLE_TEMP-MAKTX and change it at runtime the value would not change in the internal table as you are transporting only DATE.
The general terminology is to use index sy-tabix.. but using transporting you optimise the code performance as you modify only one record which you want and not the rest....
In this way you can use the other field in the work area at runtime and also simultaneously improve the performance...
You can find the difference when you are going to particularly use ITAB os structure MARA where where have more than 100 fields and you need to modify only field in the internal table..
Hope you found this helpful
2008 Mar 10 5:53 PM
hi,
inside the loop populate the value of the field and write as below.
loop...
zfield1 = date.
MODIFY I_TABLE_TEMP FROM W_TEMP TRANSPORTING zfield1.
endloop.
Thanks,
Kiran
Edited by: kiran kumar pattapu on Mar 10, 2008 6:53 PM
2008 Mar 10 7:28 PM
Better use Field-Symbols:
FIELD-SYMBOLS: <FS_TABLE_TEMP> LIKE LINE OF I_TABLE_TEMP.
LOOP AT I_TABLE_TEMP ASSIGNING <FS_TABLE_TEMP>.
....
...
MODIFY I_TABLE_TEMP FROM <FS_TABLE_TEMP>.
...
..
ENDLOOP.
Greetings,
Blag.
2008 Mar 10 8:23 PM
Alvaro,
Isn't modifying field symbol equal to modifying tables record that has been assigned to this FS?
In my opinion no MODIFY statement is needed in this example
FIELD-SYMBOLS: <fs_table_temp> LIKE LINE OF i_table_temp.
LOOP AT i_table_temp ASSIGNING <fs_table_temp>.
"some changes to the <fs_table_temp>
....
....
ENDLOOP.
Rgds
Mat
Edited by: Mateusz Adamus on Mar 10, 2008 9:23 PM
2008 Mar 10 8:39 PM
Isn't modifying field symbol equal to modifying tables record that has been assigned to this FS?
In my opinion no MODIFY statement is needed in this example
You're right Mateusz -:) My mistake -:(
Greetings,
Blag.
2008 Mar 10 8:44 PM
LOOP AT T_CHILD WHERE EBELP NE ' '..
MOVE T_CHILD-EBELN TO Z_EBELN.
MOVE T_CHILD-TXZ01 TO Z_TXZ01.
READ TABLE T_CHILD INDEX Z_INDEX INTO T_ZCHILD .
MOVE Z_EBELN TO T_ZCHILD-EBELN.
MOVE Z_TXZ01 TO T_ZCHILD-MATNR.
MODIFY T_CHILD FROM T_ZCHILD INDEX Z_INDEX TRANSPORTING EBELN MATNR.
ENDLOOP.
Here is the code.follow this its pretty simple.
Nirad