btnFase3 - OnPush() ItemJnlBatch.GET('ARTIKEL','O. GEWICHT'); lv_DocNo := NoSeriesMgt.TryGetNextNo(ItemJnlBatch."No. Series",WORKDATE); lv_ItemJnlLine.RESET; lv_ItemJnlLine.INIT; lv_ItemJnlLine."Journal Template Name" := 'ARTIKEL'; lv_ItemJnlLine."Journal Batch Name" := 'O. GEWICHT'; lv_ItemJnlLine."Posting Date" := WORKDATE; lv_ItemJnlLine."Line No." := lv_ItemJnlLine.GetNextLineNo('ARTIKEL','O. GEWICHT');; // lv_ItemJnlLine."Item No." := lv_ProdOrder."Source No."; lv_ItemJnlLine."Item No." := 'GRIND 1-3'; lv_ItemJnlLine."Document No." := lv_DocNo; lv_ItemJnlLine."Entry Type" := lv_ItemJnlLine."Entry Type"::"Positive Adjmt."; lv_ItemJnlLine.Quantity := Overgewicht; lv_ItemJnlLine.INSERT(TRUE); COMMIT; CODEUNIT.RUN(CODEUNIT::"Item Jnl.-Post",lv_ItemJnlLine);
Comments
2) Move the code into some function and call the functionfrom the OnPush, else you will loose the code when somebody delete the button etc.
3) Enable debugger and look where it will stop, there must be some oint in the no. series selection or somewhere else when the NAV is trying to show you some form, but the transaction already started.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
What is, if an user use the Journal 'ARTIKEL' / 'O. GEWICHT' ? U post your lines after create. If also a user insert there lines, these post you also. Is this correct? I think not or?
Why do you not create the lines and post them like the standard it does`?
Take a look into CU 80 or 90 in function "PostItemJnlLine()" and use the same way
Regards