Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

How to drop the lines in Purchase Order?

Posted on by 2,201 Moderator

I have created the custom dialog box in which we give the Vendor Name, Vendor No, and one Item No. and Item Quantity, as Input and the Purchase Order, is created.

I have created the Purchase Order, but cannot drop the line details...

So my question is how to drop the line details in PO?

this is how I manually drop the line details, but it still doesn't allow me to post my newly created purchase order.

        POLines.Reset();
        POLines.Init();
        POLines."Document No." := POHead."No.";
        POLines."Line No." := 1;
        POLines."Document Type" := DocType;
        // POLines.SetRange("Document No.", POHead."No.");
        POLines.Type := POType::Item;
        POLines."No." := ItemNo;
        POLines.Quantity := ItemQuantity;
        POLines.Description := Item.Description;
        POLines."Description 2" := Item."Description 2";
        POLines."Units per Parcel" := Item."Units per Parcel";
        POLines."Indirect Cost %" := Item."Indirect Cost %";
        POLines."Overhead Rate" := Item."Overhead Rate";
        POLines."Allow Invoice Disc." := Item."Allow Invoice Disc.";
        POLines."Gen. Prod. Posting Group" := Item."Gen. Prod. Posting Group";
        POLines."VAT Prod. Posting Group" := Item."VAT Prod. Posting Group";
        POLines."Tax Group Code" := Item."Tax Group Code";
        POLines.Nonstock := Item."Created From Nonstock Item";
        POLines."Item Category Code" := Item."Item Category Code";
        POLines."Allow Item Charge Assignment" := true;
        POLines."Qty. to Receive" := POLines."Outstanding Quantity";
        POLines."Qty. to Receive (Base)" := POLines."Outstanding Qty. (Base)";
        if Item."Purch. Unit of Measure" <> '' then
            POLines."Unit of Measure Code" := Item."Purch. Unit of Measure"
        else
            POLines."Unit of Measure Code" := Item."Base Unit of Measure";
        POLines.Insert(true);

Categories:
  • Suggested answer
    Mohana Yadav Profile Picture
    Mohana Yadav 58,878 Super User 2024 Season 2 on at
    RE: How to drop the lines in Purchase Order?

    you have to store the Purchase Header created and use this while inserting the lines.

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

Quick Links

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,554 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,588 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans