I think it's a simple record locking issue. You can't use replace field contents when there are open records. You could check for open records first, and if open records exist, abort script with a message.
What you suggest here ? How could I check open records exists or not for all records at same time.I mean how to check open records in current found set
1. Some imports should not be done with other users on the system. That could be the issue in your case.
2. You could try to use a loop and a SET FIELD TO instead of REPLACE FIELD CONTENTS. That is, try a different approach.
3. Try to run the script in the debugger to see what might be happening.
4. Log some problem records so you can go back and see if anyone else using the solution had that record open.
But, mostly (esp if you're modifying EXISTING records), I would just do certain imports when you know nobody is on the system.
HOPE THIS HELPS.