Skip to main content


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.
  • Unable to create automated PO from PR
    Hi please find below code to create PO from PR.
    //created by Prasanth
    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();
            while (listEnumerator.moveNext())
                purchReqLineTmp = listEnumerator.current();
                select crosscompany purchReqLineTmpUpdate where purchReqLineTmpUpdate.recid == purchReqLineTmp.recid;
                if (purchReqLineTmpUpdate)
                    select forupdate purchTableTmpUpdate where purchTableTmpUpdate.purchid == purchReqLineTmpUpdate.purchid;
                          //your code 
    If above code helpful please mark it as verified.
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 2,982 on at
    Unable to create automated PO from PR
    Check the below links, it maybe helps you:
    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!


André Arnaud de Calavon Profile Picture

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

Martin Dráb Profile Picture

Martin Dráb 224,463 Super User

nmaenpaa Profile Picture

nmaenpaa 101,146

Featured topics

Product updates

Dynamics 365 release plans