/ Microsoft / Calculate totals of RFQ reply using X++ in D365FO

Calculate totals of RFQ reply using X++ in D365FO

Learn, share and spread knowledge
Calculate totals of RFQ reply using X++ in D365FO

It is often difficult to calculate the totals of RFQ reply using X++ in D365FO. The form of Totals in Manage replies form show Totals of RFQ reply, but it is difficult for developers to get them using X++ code. For this purpose, I am writing this article to give you the code to calculate the totals of RFQ reply using X++.

What is RFQ?

As per Microsoft documentation, in an RFQ, you ask vendors to provide the prices and delivery times for the item quantities that you specify. You can also ask vendors to specify whether there are any incidental charges, such as shipping costs, or any discounts for large orders.

What is the process of RFQ?

Microsoft documentation says that the RFQ process consists of the following tasks:

  1. Create and send an RFQ to one or more vendors.
  2. Receive and register bids (RFQ replies).
  3. Transfer bids that you accept to a purchase order, purchase agreement, or purchase requisition.

The image below shows the Totals form of RFQ replies. I have selected one vendor and then click the Totals. A form appears with different values of the RFQ reply. See the image below:

Calculate totals of RFQ reply using X++ in D365FO
Total amount of RFQ reply in Microsoft Dynamics 365 for Finance and Operations

Calculate totals of RFQ reply using X++

In this article, I will calculate the total amount of RFQ reply using X++ of one vendor. Follow the steps:

  • Create a runnable class (job) named as CalculateTotalsOfRFQReply
  • Copy the below code and paste in the newly created class
  • Change the RFQ Id according to your system’s data
  • In my case, the RFQ Id is RFQ.000002
  • Execute the job
class CalculateTotalsOfRFQReply
{
    public static void main(Args _args)
    {
        //Calculate totals of RFQ reply per vendor using RFQID
        PurchRFQReplyTable  PurchRFQReplyTable  = PurchRFQReplyTable::find('RFQ.000002'); // change the RFQID as per your system's data
        PurchRFQTotals purchRFQTotals = PurchRFQTotals::construct(PurchRFQReplyTable);
        AmountCur   totalAmount;
        purchRFQTotals.calc();
        totalAmount = purchRFQTotals.totalAmount();
        info(strFmt("RFQ Reply: %1 - Total value: %2", PurchRFQReplyTable.RFQId, purchRFQTotals.totalAmount()));
    }

}

You will see the total amount of the specified RFQ reply on the screen. Please note that I have tested this code in D365FO, I hope it will work on AX 2012 as well.

So, in this way you can calculate totals of RFQ reply using X++ in D365FO. Moreover, if this helps you, please Like, Comment and Share to help other people.

If you found any ambiguity or a better solution, please feel free to ask.

See also:

Website: Click here

Blog: Click here

YouTube: Click here

GitHub: Click here

Facebook: Click here

Only those who dare to fail greatly can ever achieve greatly. – Robert F. Kennedy

0 POST COMMENT

Send Us A Message Here

Your email address will not be published. Required fields are marked *