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

Commit to release memory

Former Member
0 Likes
1,497

Hi All,

I have a program that updates an infostructure from another by collecting based on certain criteria. But my source has around 2 Million records and uses up a lot of memory. How can i commit the update lets say, for every 25000 records.

And does that release the memory.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,059

hi,

do not update all the records at a time. split them into 5000 records something like that and update the database.

hope this help.

sorry i have understood it differently.

sudheer.A

Message was edited by: sudheer Addepalli

8 REPLIES 8
Read only

Former Member
0 Likes
1,060

hi,

do not update all the records at a time. split them into 5000 records something like that and update the database.

hope this help.

sorry i have understood it differently.

sudheer.A

Message was edited by: sudheer Addepalli

Read only

Former Member
0 Likes
1,058

Well you can use "commit work and wait" statement after each 5000 record. put a counter and inside the if condition use above command.

Read only

Former Member
0 Likes
1,058

Gather from the source in smaller chunks (like 25000) and commit the update. Then clear/refresh the internal table.

This will limit the internal table to a byte size of (25000) times (width of record).

Internal table size = number of record X record width

Read only

Former Member
0 Likes
1,058

Hi,

I have to modify like in the code below.

And how can i commit for every 25000 records when the situation is as below.


  modify s701 from table it_s701 .
  if sy-subrc eq 0.
    ws_dbcnt = ws_dbcnt + sy-dbcnt.
  endif.

  modify s701 from table it_zdrr.
  if sy-subrc eq 0.
    ws_dbcnt = ws_dbcnt + sy-dbcnt.
  endif.

  modify s701 from table it_zrep.
  if sy-subrc eq 0.
    ws_dbcnt = ws_dbcnt + sy-dbcnt.
  endif.

Thanks again..!

Read only

0 Likes
1,058

Hi,

Check this :

if ws_dbcnt = 25000 .

commit work and wait

endif.

if you are inside the loop , at the end use commit work.

AT LAST.

COMMIT WORK.

Laxman

Read only

0 Likes
1,058

Hi Laxman,

But, i wouldn't get the ws_dbcnt untill i get the whole Internal table updated to the DB table. so if it has a million records, i would still be losing on memory.

And i'm not looping in the internal table here, so i can't use the second option either.

Is there any other way to do this ?

Thanks again..!

Read only

0 Likes
1,058

hi,

Then use 'commit work and wait' after every modify statement.

try this.

Laxman

Read only

0 Likes
1,058

Use "Commit work and Wait" as i mentioned earlier. it will solve your problem.