web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Post PO Invoice From X++ Code

(0) ShareShare
ReportReport
Posted on by 575

Dear Professionals

I have a case in which I want to post a PO invoice from code and I want to select the from the product receipts already postedI already can post the invoice through the code but it posts all the product receipt quantity.

Can any one help?

Appreciating...

Amr Saad

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hi,

    My understanding is, you want to do invoice the PO with received quantity. In this case we can use below method.

    PurchFormLetter.chooseLinesQuery(queryRun);

    This job may help you.


    PurchFormLetter PurchFormLetter;
    Query query = new Query(QueryStr(PurchUpdatePackingSlip));;
    QueryRun queryRun;

    query.dataSourceTable(tableNum(purchline)).addRange(fieldNum(purchline, PurchStatus)).value(queryValue(PurchStatus::Received));



    PurchFormLetter = PurchFormLetter::construct(DocumentStatus::Invoice);
    PurchFormLetter.chooseLinesQuery(queryRun);
    PurchFormLetter.update(purchtable::find("XXX"),"1");

  • Amr Saad Profile Picture
    575 on at

    Hi

    Thanks a lot for your kind reply

    I want to post the invoice based on an already posted "Product Receipt" like what I can do when posting it from the form. I want to select one or more product receipt from the already post receipts before.

    Appreciating...

    Amr

  • Bashir Ahmad Profile Picture
    5,248 on at

    Just to give you an idea you can do some thing like that here is a code for product receipts from X++ CODE :

    this may help to generate invoices from receipts:

    kurthatlevik.wordpress.com/.../help-requested-ax2012-fp-product-receipt-from-x

  • Community Member Profile Picture
    on at

    Have a look on this; it might give some ideas.
    Note: just replace any word "Sales" with "Purch"; it may work. 

    dynamicsuser.net/.../199021.aspx

    And let me know your results.

  • Amr Saad Profile Picture
    575 on at

    I have already posted the product receipt in the same way but the problem is that I want to select one or more product receipts to make the invoice for them.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Andrew Jones a1x Profile Picture

Andrew Jones a1x 2

#3
GL-01081504-0 Profile Picture

GL-01081504-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans