Hello,
Can I run Codeunit 80 with a temporary record Sales Header as parameter.
Through an interface I insert a Sales Invoice in tabel 36 en 37. If an error occurs during the posting the Sales Invoice should be deleted. The error should be shown, but after that error the proces will end. So there is no possiblitity to delete the Sales Invoice in code.
Main question is if I insert a temporary record Sales Header and temporary record Sales Line is the temporary record Sales Line available in codeunit 80 if I run codeunit 80 with the temporary record Sales Header.
0
Comments
Navision accesses Sales Line via a Sales Line record variable and therefore will never be able to get to your Temp Sales Line. Therefore it will never find the Sales Lines you put in your Temp Sales Line table.
If an error is raised during posting all changes to the database are then rolled back. So if you insert the records during the posting and an error occurs during the rest of the posting the changes (in this case your new Sales Invoice) will be rolled back and that data no longer exists.
Basically the Sales Invoice you insert will automatically be removed when an error occurs during the posting process.
Hope this answers your question.
J
I insert a record in tabel 36 and 37. After that I run codeunit 80.
I have to use a COMMIT before running codeunit 80 because I am in the middle of a write-transaction. If I don't do this the well known COMMIT-error occures.
So therefore the Salesheader and salesline will not be deleted.
Regards