Making a header with item journal lines

I have made a form with a new table for the header and transfer lines as the subform. All works, but I do not know how to delete the header after posting all the lines. Where would this occur? I looked at CodeUnit 23 but I do not know the right spot. Can anyone help?

I would not even consider making these kind of changes in the standard posting routines. You can either make a new codeunit for it that call’s the Item post thingy or better; make a new table for the lines, and a new codeunit for the posting, In that codeunit you can populate/post the ItemJournalimes without actualy inserting them in the table. And delete your header/lines, or better mark them posted or move to a history table.

Thanks for your suggestion. I think that makes the most sense. I will try it.