Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / Unable to create autom...
Finance forum
Suggested answer

Unable to create automated PO from PR

Posted on by 2
Hi all,
 
I tried creating automated PO from PR but after approving the PR, the PO is not getting create automatically. Even after i have done the required setup in purchasing policy.
Required setup done is: In purchasing policy, under Purchase order creation and demand consolidation rule, i enabled the automatically create purchase orders option for the required legal entity.
 
Thanks
  • Unable to create automated PO from PR
    Hi please find below code to create PO from PR.
     
    //created by Prasanth
    [ExtensionOf(classStr(PurchAutoCreate_PurchReq))]
    public final class PurchAutoCreate_PurchReq_Apnt_Extension
    {
           public void create()
        {
            next create();
    
            purchReqLine            purchReqLineTmp,purchReqLineTmpUpdate;
            SalesTable              SalesTable;
            purchTable              purchTableTmpUpdate;
            listEnumerator          listEnumerator;
            List                    listRecordListCopy = new List(Types::Record);
            
            
            listRecordListCopy  = this.parmPurchReqLineRecordList();
            listEnumerator      = listRecordListCopy.getEnumerator();
    
            infolog.clear();
            ttsbegin;
            while (listEnumerator.moveNext())
            {
                purchReqLineTmp = listEnumerator.current();
    
                select crosscompany purchReqLineTmpUpdate where purchReqLineTmpUpdate.recid == purchReqLineTmp.recid;
    
                if (purchReqLineTmpUpdate)
                {
                    
                    select forupdate purchTableTmpUpdate where purchTableTmpUpdate.purchid == purchReqLineTmpUpdate.purchid;
    
                    if(purchTableTmpUpdate)
                    {
                          //your code 
                    }
                    
                }
            }
            ttscommit;
        }
    
    }
     
    If above code helpful please mark it as verified.
     
    Thanks
     
    Prasanth
     
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 2,982 on at
    Unable to create automated PO from PR
    Hi,
     
    Check the below links, it maybe helps you:
     
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     

Helpful resources

Quick Links

Can you answer this forum question?

You could make someone's day!

Community Newsletter - May 2024

Kudos to our community stars!

Community Spotlight of the Month

Kudos to Mohamed Amine Mahmoudi!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 283,623 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 224,463 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,146

Featured topics

Product updates

Dynamics 365 release plans