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

Read a local Table after modifying it

Former Member
0 Likes
979

Hi Gurus.

I have a local table lt_table.

At some point of my code I modify that table using indexes and it works well.

The problem is that after I change that table I cannot read it into a structure with the changes being reflected.

Something like this.


DATA: 
          i type sy-tabix,
          lt_table type table of bla,
          ls_table type bla.


LOOP AT SOME_TABLE INTO SOME_WA.

   READ lt_table into ls_table
   WITH KEY field1 = SOME_WA-field1
   BINARY SEARCH.

   ...

   MODIFY lt_table FROM ls_table index i.

ENDLOOP.

After I modify the table, I can see in debug that the table was modified but the structure ls_table doesn't see the new results...

Is this normal behaviour from ABAP?

Thank you for your replies.

Jorge

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
911

hi,

u r moving it to internal table and after modifying u can find that in table what else the result want.

hi,

u r moving it to internal table and after modifying u can find that in table what else the result want.

4 REPLIES 4
Read only

Former Member
0 Likes
912

hi,

u r moving it to internal table and after modifying u can find that in table what else the result want.

Read only

Former Member
0 Likes
911
LOOP AT SOME_TABLE INTO SOME_WA.
  
   READ lt_table into ls_table
   WITH KEY field1 = SOME_WA-field1
   BINARY SEARCH.
  if sy-subrc eq 0.
 i = sy-tabix.
 .....
  ... 
   MODIFY lt_table FROM ls_table index i.
   clear ls_table.
 endif.
ENDLOOP.

if you don't use clear. and then check ls_table you will see old data only.

where are you reading. which index you are reading that also matters.

Read only

Former Member
0 Likes
911

Hi,

check by using,

MODIFY <itab> INDEX <idx> FROM <wa> 
       TRANSPORTING <field>.

Regards

Adil

Read only

Former Member
0 Likes
911

Your looping criteria is on SOME_TABLE and modifying ls_table where only the work area will be modified.. so keep looping in a reverse way to incorporate your modified changes