Skip to Content

Insert statement following a Delete for ZTable not working

Hi,

i have the below statements that does a full replace/refresh of a z table nightly....

when i run in debug it always writes the correct amount of entries, about 10,000. When it runs in background it only ever writes about 1,500. It seems the delete is not finished before the insert happens and overlaps/locks occur. This is why i added commit work and wait, but still the same outcome.

DELETE FROM zgenesis_mstdata. COMMIT WORK AND WAIT.

INSERT zgenesis_mstdata FROM TABLE lt_genesis ACCEPTING DUPLICATE KEYS.

Lots of ideas online on the forum (listed below) but not sure which is best;

- adding commit work and wait after the delete (like i did)

- other says that wont work unless the delete was in a functional module for example (a different luw)

- add commit after the insert

- add wait 5 seconds after the delete (to ensure the entries are definitely deleted before the insert happens)

- lock the ztable before the delete and unlock after and then do the same for the insert

- use modify and not delete

Which is right!?!?

Thanks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Nov 04, 2019 at 08:56 AM

    A combination of a wait up to 5 seconds after the delete and a commit after the insert resolved the issue

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.