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: 

Modify from work area transporting

Former Member
0 Kudos
23,130

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

7 REPLIES 7

Rodrigo-Giner
Active Contributor
0 Kudos
3,689

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

rahulkavuri
Active Contributor
0 Kudos
3,689

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

Former Member
0 Kudos
3,689

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

former_member583013
Active Contributor
0 Kudos
3,689

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.

0 Kudos
3,689

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

0 Kudos
3,689

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.

Former Member
0 Kudos
3,689
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