Hi ALL,
I am creating a purchase order through AL code using multiple items, in a report but it is coming like this,
Can anyone help me please, I am sharing my code how to I am creating the purchase order.
Hi ALL,
I am creating a purchase order through AL code using multiple items, in a report but it is coming like this,
Can anyone help me please, I am sharing my code how to I am creating the purchase order.
Hi Nitin,
Thanks for your help.
Thanks & Regards.
Try this one
|
Hi Nitin,
I am trying in your way but it is not working, in the debugger also it is not catching the report, can you suggest me another way,
Thanks & Regards
P V Sarath.
Hi,
You can go with the below code.
report 51458 "Purchase Order MultipleItems"
{
UsageCategory = ReportsAndAnalysis;
ApplicationArea = All;
ProcessingOnly = true;
trigger OnPostReport()
var
PurchaseHeader: Record "Purchase Header";
PurchaseLine: Record "Purchase Line";
Vendor: Record Vendor;
i: Integer;
begin
// for i := 0 to 1 do begin
if Vendor."No." = '' then
CurrReport.Skip();
PurchaseHeader.init();
PurchaseHeader."Document Type" := PurchaseHeader."Document Type"::Order;
PurchaseHeader.Validate("No.", '');
PurchaseHeader.Insert(true);
PurchaseHeader.Validate("Buy-From Vendor No.", '20000');
PurchaseHeader."Posting Date" := WorkDate();
PurchaseHeader."Document Date" := PurchaseHeader."Posting Date";
PurchaseHeader."Due Date" := PurchaseHeader."Posting Date";
PurchaseHeader.Modify();
PurchaseLine.Init();
PurchaseLine."Document Type" := PurchaseHeader."Document Type";
PurchaseLine."Document No." := PurchaseHeader."No.";
PurchaseLine."Line No." := 10000;
PurchaseLine.Insert(true);
PurchaseLine.Type := PurchaseLine.Type::Item;
PurchaseLine."No." := '1896-S';
PurchaseLine.Modify();
PurchaseLine.Init();
PurchaseLine."Document Type" := PurchaseHeader."Document Type";
PurchaseLine."Document No." := PurchaseHeader."No.";
PurchaseLine."Line No." += 10000;
PurchaseLine.Insert(true);
PurchaseLine.Type := PurchaseLine.Type::Item;
PurchaseLine."No." := '1900-S';
PurchaseLine.Modify();
end;
}
|
hi,
Pls apply filter on Integer onpredataitem
Setrange(Number,1);
In your case Integer is running in infinite loop.
Regards
Amit Sharma
André Arnaud de Cal... 291,759 Super User 2024 Season 2
Martin Dráb 230,468 Most Valuable Professional
nmaenpaa 101,156