Hi All,
I want to create a 100 purchase orders with the same vendor and same item, can anyone help me
Thanks & Regards,
Sams.
Hi All,
I want to create a 100 purchase orders with the same vendor and same item, can anyone help me
Thanks & Regards,
Sams.
Hi, just adding an example for importing sales order, hope this helps.
Thanks.
ZHU
Hi,
Please change as per yellow marked.
trigger OnAfterGetRecord() var PurchaseHeader: Record "Purchase Header"; PurchaseLine: Record "Purchase Line"; i: Integer; begin for i := 1 to 100 do begin PurchaseHeader.init(); PurchaseHeader."Document Type" := PurchaseHeader."Document Type"::Order; PurchaseHeader.validate("No.",""); PurchaseHeader.Validate("Buy-From Vendor No.", '20000'); PurchaseHeader."Posting Date" := WorkDate(); PurchaseHeader."Document Date" := PurchaseHeader."Posting Date"; PurchaseHeader."Due Date" := PurchaseHeader."Posting Date"; PurchaseHeader.Insert(true); PurchaseLine.Init(); PurchaseLine."Document Type" := PurchaseHeader."Document Type"; PurchaseLine."Document No." := PurchaseHeader."No."; PurchaseLine.SetRange("Document Type",PurchaseHeader."Document Type"); PurchaseLine.SetRange("Document No.",PurchaseHeader."No."); PurchaseLine."Line No." := 10000; PurchaseLine.Type:= PurchaseLine.Type::Item; PurchaseLine."No.":= YourItemNo.Here. PurchaseLine.Insert(true); end; end; |
Hi All,
I am Sharing my can you please guide me,
trigger OnAfterGetRecord()
var
PurchaseHeader: Record "Purchase Header";
PurchaseLine: Record "Purchase Line";
i: Integer;
begin
for i := 1 to 100 do begin
PurchaseHeader.init();
PurchaseHeader."Document Type" := PurchaseHeader."Document Type"::Order;
PurchaseHeader."No." := '';
PurchaseHeader.Validate("Buy-From Vendor No.", '20000');
PurchaseHeader."Posting Date" := WorkDate();
PurchaseHeader."Document Date" := PurchaseHeader."Posting Date";
PurchaseHeader."Due Date" := PurchaseHeader."Posting Date";
PurchaseHeader.Insert(true);
PurchaseLine.Init();
PurchaseLine."Document Type" := PurchaseHeader."Document Type";
PurchaseLine."Document No." := PurchaseHeader."No.";
PurchaseLine.SetRange("Document Type",PurchaseHeader."Document Type");
PurchaseLine.SetRange("Document No.",PurchaseHeader."No.");
PurchaseLine."Line No." := 10000;
PurchaseLine.Insert(true);
end;
end;
Thanks & Regards,
Sams
It looks like you are trying to modify the System Id in your code. And that is not allowed.
Maybe you can share your code so we can give you more efficient help?
Hi All,
I have set the Vednor posting group and all, but I am getting this error, can anyone tell me what is this error and how to solve this error.
Hi,
Pls Assign Vendor Posting Group in Vendor. My given code is correct. This is setup issue.
Hi All,
I am using this code for creation of 100 purchase orders in a report,
trigger OnAfterGetRecord()
var
PurchaseHeader: Record "Purchase Header";
PurchaseLine: Record "Purchase Line";
Vendor: Record Vendor;
GetVendorNo: code[20];
GetLocation: code[20];
DocumentNo: Code[20];
i: Integer;
begin
for i := 1 to 100 do begin
PurchaseHeader.init();
PurchaseHeader."Document Type" := PurchaseHeader."Document Type"::Order;
PurchaseHeader."No." := '20000';
// PurchaseHeader.Insert(True);
PurchaseHeader.Validate("Buy-From Vendor No.", Vendor."No.");
PurchaseHeader.Validate("Posting Date", Workdate);
PurchaseHeader.Validate("Location Code", GetLocation);
PurchaseHeader."Vendor Posting Group" := Vendor."Vendor Posting Group";
// DocumentNo := PurchaseHeader."No.";
if not PurchaseHeader.Insert() then
PurchaseHeader.Modify;
PurchaseLine.Init();
PurchaseLine."Document Type" := PurchaseLine."Document Type"::Order;
PurchaseLine."Document No." := PurchaseHeader."No.";
PurchaseLine."Line No." := 10000;
PurchaseLine.Insert();
end;
But I am getting an error I am attaching the error, can anyone help me.
Thanks & Regards,
Sams
Hi,
Use the below code for reference.
Hi,
In that case you can create a CSV file with putting your Header and Line data in it, and then import that CSV file directly from Report using CSV import.
You can go with XML port creation
docs.microsoft.com/.../devenv-xmlport-object
Import CSV file using XML port
Hi Nithin,
I have to create a 100 purchase orders with the one vendor and one item only, this has to be done by the reports, but my question is how to create the purchase order.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,556 Super User 2024 Season 2
Martin Dráb 228,625 Most Valuable Professional
nmaenpaa 101,148