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 :
Finance | Project Operations, Human Resources, ...
Unanswered

Display Purchase Order Status and PO Type fields in Rdp report X++ - D365

(0) ShareShare
ReportReport
Posted on by 70

Hi all,

I'm developing a report on Purchase Order and I want to show fields like PO Status and PO Type and Item Type. based on the PurchId field. 


Here is my code . I'm using multi select filter on PO Status and PurchId and Item ID

class CFZPOHistoryStatusReportDP extends SrsReportDataProviderPreProcessTempDB
{

    CFZPOHistoryStatusReportHeaderTmp     cfzPOHistoryStatusReportHeaderTmp;
    CFZPOHistoryStatusReportLinesTmp      cfzPOHistoryStatusReportLinesTmp;
    
    CFZPOHistoryStatusReportContract      contract;

    TransDate       fFromdate, tTodate;
    CompanyInfo     companyInfo;


    List            listSiteId, listPurchName, listLocationId, listPurchId, listPOStatus, listDepartment, listBrand, listCategory, listSubCategory;
    ListEnumerator  enumPurchId, enumPOStatus;
    //RetailStoreId   retailStoreId;

    //AX Tables

    //CustTrans           custTrans;
    VendTrans           vendTrans;
    PurchTable          purchTable;
    PurchLine           purchLine;
    VendInvoiceTrans    vendInvoiceTrans;
    InventDim           inventDim;
    InvoiceId           invoiceId;
    InventTable         inventTable;
    VendInvoiceJour     vendInvoiceJour;
    InventLocation      inventLocation;
    VendPackingSlipTrans vendPackingSlipTrans;
    VendTable           vendTable;
    PurchId             purchIDVar;
    PurchStatus         purchStatusVar;
    //VendPackingSlipJour vendPackingSlipJour;
    //TaxTrans            taxTrans;
    //TaxTable            taxTable;
                
        // CFZPOHistoryStatusReportHeaderTmp get and set
    [SRSReportDataSetAttribute(tablestr('CFZPOHistoryStatusReportHeaderTmp'))]
    public CFZPOHistoryStatusReportHeaderTmp getCFZPOHistoryStatusReportHeaderTmp()
    {
        //select data from table buffer
        select * from cfzPOHistoryStatusReportHeaderTmp;

        //return the buffer
        return cfzPOHistoryStatusReportHeaderTmp;
    }

    // CFZPOHistoryStatusReportLinesTmp get and set
    [SRSReportDataSetAttribute(tablestr('CFZPOHistoryStatusReportLinesTmp'))]
    public CFZPOHistoryStatusReportLinesTmp getCFZPOHistoryStatusReportLinesTmp()
    {
        //select data from table buffer
        select * from cfzPOHistoryStatusReportLinesTmp;

        //return the buffer
        return cfzPOHistoryStatusReportLinesTmp;
    }

    public void processreport()
    {
    
        contract    = this.parmDataContract() as CFZPOHistoryStatusReportContract;

        fFromdate       = contract.parmFromDate();
        tTodate         = contract.parmToDate();
        listSiteId      = contract.parmSiteId();
        listLocationId  = contract.parmInventLocationId();
        listPurchName   = contract.parmPurchName();
        listPurchId     = contract.parmPONumber();
        listPOStatus    = contract.parmPOStatus();
        listDepartment  = contract.parmDepartment();
        listBrand       = contract.parmBrand();
        listCategory    = contract.parmCategory();
        listSubCategory = contract.parmSubCategory();
       
        this.HeaderTmp();
        this.LinesTmp();
    }

    private void HeaderTmp()
    {

        cfzPOHistoryStatusReportHeaderTmp.clear();
        companyInfo = CompanyInfo::find();
        cfzPOHistoryStatusReportHeaderTmp.ReportName     = "Purchase Order History Status Report";
        cfzPOHistoryStatusReportHeaderTmp.CompanyName    = companyinfo.Name;

        cfzPOHistoryStatusReportHeaderTmp.insert();

    }

    private void LinesTmp()
    {
        enumPurchID = listPurchId.getEnumerator();
        while(enumPurchId.moveNext())
        {
            purchIDVar = enumPurchId.current();

           // while select * from purchtable where purchtable.PurchId == purchIDVar
            //while select purchTable  
            //    where purchTable.PurchId == purchIDVar
            //        join purchLine                     
            //        where purchLine.PurchId == purchTable.PurchId
            //       // join vendTable
            //       // where vendTable.AccountNum == purchTable.OrderAccount
            //        join inventDim
            //        where inventDim.inventDimId == purchLine.InventDimId
            //        join inventTable
            //        where inventTable.ItemId == purchLine.ItemId                      
            //        join vendPackingSlipTrans
            //        where vendPackingSlipTrans.ItemId == inventTable.ItemId

            while select purchLine
                where purchLine.PurchId == purchIDVar
                    join purchTable
                    where purchTable.PurchId == purchLine.PurchId
                   // join vendTable
                   // where vendTable.AccountNum == purchTable.OrderAccount
                    join inventDim
                    where inventDim.inventDimId == purchLine.InventDimId
                    join inventTable
                    where inventTable.ItemId == purchLine.ItemId
                    outer join vendPackingSlipTrans
                    where vendPackingSlipTrans.ItemId == inventTable.ItemId

                 
            {
                cfzPOHistoryStatusReportLinesTmp.clear();
                cfzPOHistoryStatusReportLinesTmp.FromDate             = fFromdate;
                cfzPOHistoryStatusReportLinesTmp.ToDate               = tTodate;
                cfzPOHistoryStatusReportLinesTmp.PurchId              = purchTable.PurchId;
                cfzPOHistoryStatusReportLinesTmp.PurchName            = purchTable.PurchName;
                cfzPOHistoryStatusReportLinesTmp.DlvDate              = purchLine.deliveryDate;
                cfzPOHistoryStatusReportLinesTmp.CreationDate         = DateTimeUtil::date(purchTable.CreatedDateTime);
                cfzPOHistoryStatusReportLinesTmp.ItemId               = purchLine.ItemId;
                cfzPOHistoryStatusReportLinesTmp.ItemName             = InventTable::find(purchLine.ItemId).itemName();
                cfzPOHistoryStatusReportLinesTmp.InventLocationName   = InventLocation::find(purchTable.InventLocationId).Name;
                cfzPOHistoryStatusReportLinesTmp.PurchPrice           = PurchLine::find(purchLine.PurchId).PurchPrice; 
                cfzPOHistoryStatusReportLinesTmp.Color                = inventDim.InventColorId;
                cfzPOHistoryStatusReportLinesTmp.PurchUnit            = purchLine.PurchUnit;
                cfzPOHistoryStatusReportLinesTmp.QtyOrdered           = vendPackingSlipTrans.Ordered;
                cfzPOHistoryStatusReportLinesTmp.Qty                  = vendPackingSlipTrans.Qty;
                cfzPOHistoryStatusReportLinesTmp.QtyReceived          = vendPackingSlipTrans.ReceivedQty_IN;
                cfzPOHistoryStatusReportLinesTmp.QtyPending           = vendPackingSlipTrans.Ordered-vendPackingSlipTrans.Qty;

                if(purchIDVar)

                    cfzPOHistoryStatusReportLinesTmp.PurchaseType     = purchTable.PurchaseType;
                  




                cfzPOHistoryStatusReportLinesTmp.insert();
            }
 

            
        
        }
        

           
    }

}

Please guide me

Thanks

I have the same question (0)
  • nmaenpaa Profile Picture
    101,166 Moderator on at

    Where do you want to shot PO status, PO type and Item type? On the report? Or on the report dialog?

    Do you have some problems with your code?

  • Dynamics365 Profile Picture
    70 on at

    Hi Nikolaos Mäenpää

    My issue is resolved.

    Thanks for your help and time

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 733

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 461 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 278 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans