Aaargh! Where is that COMMIT?

This trick has nothing to do with the OMA but I really want to share it. Did you ever had to search for a COMMIT? The command CONSISTENT can help you with that.
This command is specially build to make sure that at the end of a transaction the G/L Accounts are in balance. In codeunit “Gen. Jnl.-Post Line” you will see the following C/AL statement:

  (BalanceCheckAmount = 0) AND
  (BalanceCheckAmount2 = 0) AND
  (BalanceCheckAddCurrAmount = 0) AND
  (BalanceCheckAddCurrAmount2 = 0));

If you put a COMMIT somewhere is the posting routine after the consistency of the “General Ledger Entry” was set to false you will get the following beautiful error:


So if you have to find a COMMIT someday the only thing you have to do is first set a random table to CONSISTENT(FALSE) and the debugger will bring you to the first COMMIT.



PS: Kudos goes to rmv_RU. This topic was the first time I read about this.

Explore posts in the same categories: Object Manager

2 Comments on “Aaargh! Where is that COMMIT?”

  1. ara3n Says:

    You can also use code coverage and then filter on commit and see where the commit is.

  2. Reijer Molenaar Says:

    Yes you’re right! That’s sometimes an easier way to do it. Then you don’t have to modify any object.

    But there are COMMIT’s in disguise that are harder to find. After an “IF CODEUNIT.RUN” there is also a commit that you cannot find with the code coverage. The CONSISTENT(FALSE) command is bullet proof.

    You can also use it when you are debugging and you want to rollback your transaction at the end.


To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
Click to hear an audio file of the anti-spam word