Error while posting Item Journal Line

Dear all,
I am trying to post item journal line programatically using Codeunit 22 "Item Jnl.-Post Line". While posting i am facing this error.
dtr40ysnlw31.png

My code is as under:
ItemJournalLine.INIT;
ModifiedTime := FORMAT("Modified On");
Pos := STRPOS(ModifiedTime,' ');
ItemJournalLine."Document No." := Item."No." + ' ' + DELSTR(ModifiedTime, 1, Pos);
ItemJournalLine."Posting Date" := TODAY; 
ItemJournalLine."Entry Type" := ItemJournalLine."Entry Type"::Purchase;
ItemJournalLine."Item No." := Item."No.";
ItemJournalLine.Quantity := Inventory;
ItemJournalLine."Quantity (Base)" := Inventory;
ItemJournalLine."Gen. Prod. Posting Group" := Item."Gen. Prod. Posting Group";
ItemJournalLine."Gen. Bus. Posting Group" := IntegrationSetup."Gen. Bus. Posting Group";
CODEUNIT.RUN(CODEUNIT::"Item Jnl.-Post Line",ItemJournalLine);
MODIFY;
COMMIT;

Any help will be appreciated.
Best Regards
Zohaib Ahmed
Dynamics NAV ERP Technical Consultant.

please like / agree / verify my answer, if it was helpful for you. thanks.

Best Answer

Answers

Sign In or Register to comment.