Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Confirm single purch line x++ AX2012

Posted on by Microsoft Employee

There is a way to confirm a selected lines from a purch order?

not to confirm de entire purch order

*This post is locked for comments

  • Enxhi Bregu Profile Picture
    Enxhi Bregu 123 on at
    Confirm single purch line x++ AX2012
     
  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Confirm single purch line x++ AX2012

    it does not work, Always posts all lines in the purch order, it does not matter if I select a single line.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Confirm single purch line x++ AX2012

    Ok, If I have one purch order with 3 lines, I want to confirm only one line, something like packingSlip, I want to chose the lines to confirm.

    I hope to have explained.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Confirm single purch line x++ AX2012

    the purch order contains 3 lines, different items on each line, so I just chose one with that itemId

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Confirm single purch line x++ AX2012

    static void BTW_makePurchLineConfirm(Args _args)

    {

       PurchFormLetter             purchFormLetter;

       PurchFormletterParmData     purchFormLetterParmData;

       PurchParmUpdate             purchParmUpdate;

       PurchParmTable              purchParmTable;

       PurchParmLine               purchParmLine;

       PurchTable                  purchTable;

       PurchLine                   purchLine;

       PurchId                     purchId;

       Num                         vendPurchOrderId;

       int                         ierror;

       str                         errorTxt;

       ;

       setPrefix("Purchase Order");

       purchId             = "Purch-000001";

       purchTable          = PurchTable::find(purchId);

       vendPurchOrderId    = strFmt("%1-%2", purchId, int642str(VendPurchOrderJour::numberOfPurchOrder(purchTable) + 1));

       try

       {

           ttsBegin;

           // Set purchFormLetterParmData class

           purchFormLetterParmData = PurchFormletterParmData::newData(DocumentStatus::PurchaseOrder, VersioningUpdateType::Initial);

           purchFormLetterParmData.parmOnlyCreateParmUpdate(true);

           purchFormLetterParmData.createData(false);

           purchParmUpdate = purchFormLetterParmData.parmParmUpdate();

           // Set PurchParmTable table

           purchParmTable.clear();

           purchParmTable.TransDate                = systemDateGet();

           purchParmTable.Ordering                 = DocumentStatus::PurchaseOrder;

           purchParmTable.ParmJobStatus            = ParmJobStatus::Waiting;

           purchParmTable.Num                      = vendPurchOrderId;

           purchParmTable.PurchId                  = purchTable.PurchId;

           purchParmTable.PurchName                = purchTable.PurchName;

           purchParmTable.DeliveryName             = purchTable.DeliveryName;

           purchParmTable.DeliveryPostalAddress    = purchTable.DeliveryPostalAddress;

           purchParmTable.OrderAccount             = purchTable.OrderAccount;

           purchParmTable.CurrencyCode             = purchTable.CurrencyCode;

           purchParmTable.InvoiceAccount           = purchTable.InvoiceAccount;

           purchParmTable.ParmId                   = purchParmUpdate.ParmId;

           purchParmTable.insert();

           // Set PurchParmLine table

           while select purchLine

               where purchLine.PurchId == purchTable.purchId

               && purchLine.ItemId == "XXXXX"

           {

               purchParmLine.InitFromPurchLine(purchLine);

               purchParmLine.ReceiveNow    = PurchLine.PurchQty;

               purchParmLine.ParmId        = purchParmTable.ParmId;

               purchParmLine.TableRefId    = purchParmTable.TableRefId;

               purchParmLine.setQty(DocumentStatus::PurchaseOrder, false, true);

               purchParmLine.setLineAmount();

               purchParmLine.insert();

           }

           purchFormLetter = PurchFormLetter::construct(DocumentStatus::PurchaseOrder);

           purchFormLetter.createFromLines(true);

           purchFormLetter.transDate(systemDateGet());

           purchFormLetter.proforma(false);

           purchFormLetter.specQty(PurchUpdate::All);

           purchFormLetter.purchTable(purchTable);

           // This is the ID we hard code as the product receipt ID, if we do the posting via UI

           // user would have the option to manually enter this value

           purchFormLetter.parmParmTableNum(purchParmTable.ParmId);

           purchFormLetter.parmId(purchParmTable.ParmId);

           purchFormLetter.purchParmUpdate(purchFormLetterParmData.parmParmUpdate());

           purchFormLetter.run();

           ttsCommit;

           info(vendPurchOrderId);

       }

       catch

       {

           ttsAbort;

       }

    }

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Confirm single purch line x++ AX2012

    it does not work, the priocess confirmed the entire purch order

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,151 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,993 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans