web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Creating Item Journal from Custom Requisition

(0) ShareShare
ReportReport
Posted on by

Dear All,

This code below is for creating an Item Journal from a customized requisition. But cannot work.

It refuses to recognize the Journal template and the batch and if I comment both Journal template and the batch, it refuses to recognise the posting date and lock the document. 

what could be the issue.

procedure CreateItemJournal()
var
ItmJnl: Record "Item Journal Line";
PRQHeader: Record "Purchase Requisition Header";
PRLine: Record "Purchase Requisition Lines";
NextLineNo :Integer;
//counter:Integer;
//counter := counter + 10000;

begin
if PRQHeader.Find then

ItmJnl.INIT();

ItmJnl.VALIDATE("Journal Template Name",'GENERAL');
ItmJnl.VALIDATE("Journal Batch Name",'Default');

IF ItmJnl.FINDLAST THEN
NextLineNo := ItmJnl."Line No." + 10000
ELSE
NextLineNo := 10000;

//NextLineNo := NextLineNo + 10000;
//ItmJnl.validate("Line No.",NextLineNo);

ItmJnl.VALIDATE("Posting Date",PRQHeader."PRQ Date");
ItmJnl.VALIDATE("Entry Type",ItmJnl."Entry Type"::"Negative Adjmt.");
ItmJnl.VALIDATE("Document No.",'Issue'+PRLine."PRQ No.");
ItmJnl.VALIDATE("Item No.",PRLine."No.");
ItmJnl.VALIDATE(Description,PRLine.Description);
ItmJnl.VALIDATE("Variant Code",'');
ItmJnl.VALIDATE("Location Code",'HQ');
ItmJnl.VALIDATE(Quantity,PRLine.Quantity);
ItmJnl.VALIDATE("Quantity (Base)",PRLine.Quantity);
ItmJnl.VALIDATE("Unit of Measure Code",PRLine."Unit of Measure Code");
ItmJnl.VALIDATE("Unit Amount",PRLine."Unit Cost");
ItmJnl.VALIDATE(Amount,PRLine.Quantity*PRLine."Unit Cost");
ItmJnl.VALIDATE("Unit Cost",PRLine."Unit Cost");
ItmJnl.VALIDATE("Applies-to Entry",0);
ItmJnl.Insert();
end;
}

I have the same question (0)
  • Suggested answer
    Suresh Kulla Profile Picture
    50,251 Super User 2025 Season 2 on at

    The template name for Item Journal is ITEM not GENERAL,  change this ItmJnl.VALIDATE("Journal Template Name",'GENERAL'); to ItmJnl.VALIDATE("Journal Template Name",'ITEM');

  • Romryan Profile Picture
    on at

    Suresh,

    Thank you for your response.

    Your suggestion worked, but on item field, its shows a message that's empty while there is data from my requisition lines item field i.e. I can pick the data from requisition lines but I can pick from requisition header.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

News and Announcements

Season of Giving Solutions is Here!

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,573

#2
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 773 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 760 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans