Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 Community / Forums / Finance forum / To reconfirm PO, what ...
Finance forum
Unanswered

To reconfirm PO, what document status is needed ?

Posted on by 938
Hi guys,
 
I'm creating a custom API which the job is to be able to re-confirm PO with before it is re-confirm, I may want to update its prices.
 
May I know what Document Status is applicable in order to run Confirmation against a once confirmed PO ?
 
I'm using this :
//update purchase orderPurchFormLetterParmData          purchFormLetterParmData;purchFormLetterParmData = PurchFormletterParmData::newData(DocumentStatus::Confirmation,                            VersioningUpdateType::Correction);
 
But currently stuck with error like this :
/Function FormLetterParmDataCorrection.parmFormLetterParmData has been incorrectly called./
 
When I tried to debug, it looks it is hit this checking :
 
 
It looks like something with the versioningUpdate, which not allowing to have data update ?
 
May I know is there any specific rule for the Document Status to allow a confirmed PO, to change its data especially the Price. 
And basically may I know how the Re-confirmation PO with X++ looks ?
 
Thanks.
 
 
 
  • Voltes Profile Picture
    Voltes 938 on at
    To reconfirm PO, what document status is needed ?
    Hi Andre,
     
    Ni, I'm not enabled change management.
     
    The initial of my program is like this :
    purchFormLetterParmData = PurchFormletterParmData::newData(DocumentStatus::PurchaseOrder,
                                VersioningUpdateType::Initial);
                            purchFormLetterParmData.parmOnlyCreateParmUpdate(true);
                            purchFormLetterParmData.createData(false);
                            purchParmUpdate = purchFormLetterParmData.parmParmUpdate();
    
                            purchParmTable.clear();
                            purchParmTable.TransDate                = DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone());
                            purchParmTable.Ordering                 = DocumentStatus::PurchaseOrder;
                            purchParmTable.ParmJobStatus            = ParmJobStatus::Waiting;
                            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.DocumentDate             = purchTable.AccountingDate;
                            purchParmTable.Payment                  = purchTable.Payment;
                            purchParmTable.ParmId                   = purchParmUpdate.ParmId;
                            purchParmTable.insert();
                            
                            List         puchLinesList = _request.parmPurchLineList();
    
                            ListIterator literator = new ListIterator(puchLinesList);
    
                            while (literator.more())
                            {
                                MyLineRequest   updateLineRequest;
                                updateLineRequest = literator.value();
                
                                LineNum     lineNum;
                                ItemId      itemId;                          
                                Price       purchPrice;
    
                                lineNum     = updateLineRequest.parmLineNum();
                                itemId      = updateLineRequest.parmItemId();                     
                                purchPrice  = updateLineRequest.parmPurchPrice();
                                                        
                                PurchLine   purchLine;
    
                                select purchLine
                                where purchLine.PurchId == purchTable.PurchId
                                   && purchLine.LineNumber == lineNum
                                   && purchLine.ItemId == itemId;
    
                                if (purchLine)
                                {
                                    purchParmLine.clear();
                                    purchParmLine.InitFromPurchLine(purchLine);
    
                                    purchParmLine.ParmId      = purchParmTable.ParmId;
                                    purchParmLine.TableRefId  = purchParmTable.TableRefId;         
                                    purchParmLine.PurchPrice  = purchPrice;
                                    purchParmLine.setQty(DocumentStatus::PurchaseOrder, false, true);
                                    purchParmLine.setLineAmount();
                                    purchParmLine.insert();
                        
                                    literator.next();
                                }
                                
                                purchFormLetter = PurchFormLetter::construct(DocumentStatus::PurchaseOrder);
                                purchFormLetter.transDate(DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone()));
                                purchFormLetter.proforma(false);
                                purchFormLetter.specQty(PurchUpdate::All);
                                purchFormLetter.purchTable(purchTable);
                                purchFormLetter.parmParmTableNum(purchParmTable.ParmId);
                                purchFormLetter.parmId(purchParmTable.ParmId);
                                purchFormLetter.purchParmUpdate(purchFormLetterParmData.parmParmUpdate());
                                purchFormLetter.run();
                            }
     
    By this, the confirmation is done, but when I check, the price is not updated. At first I suspect because I'm using VersioningUpdateType::Initial, so changed to VersioningUpdateType::Correction. But after since, I get that error all time.  "/Function FormLetterParmDataCorrection.parmFormLetterParmData has been incorrectly called./
     
  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 290,532 Super User 2024 Season 2 on at
    To reconfirm PO, what document status is needed ?
    Hi,
     
    In case you have enabled Change management, a user would first need to perform an action called 'Request change'. 

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,532 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,501 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans