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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Whats the x++ code to get the value of the method "Reservation" in batch reservation form

(4) ShareShare
ReportReport
Posted on by 275
Hello
 
i have a custom report im developing, i need to retrieve the value of field Reservation in batch reservation form, to go through this form, first go All sales order and check sales line, make sure u are selecting a line order(itemid). then click on inventory and click after on batch reservation.
i need the x++ code to be able to retrieve the value knowing that its a method and not a field on the form. the method name is reserveNowQty() in form data source of table TmpPdsBatchSelect in form WHSBatchAttribReserve.
if anyone can provide me the code that i need to implement in my DP class please. it should be based on Itemid because each salesline has a a different ItemID.
 
Thank you
Categories:
I have the same question (0)
  • Suggested answer
    Aymen CHELBI Profile Picture
    574 on at
    Hello,
     
    Here’s a possible implementation of the X++ code to retrieve the value of reserveNowQty() from the WHSBatchAttribReserve form for a given ItemId in your DP (Data Provider) class :
     
    class MyReportDP extends SrsReportDataProviderBase
    {
        TmpMyReportTable tmpMyReportTable; // Temporary table for report data
        public void processReport()
        {
            SalesLine salesLine;
            TmpPdsBatchSelect tmpPdsBatchSelect;
            InventDim inventDim;
            WHSBatchAttribReserve whsBatchAttribReserve;
            Qty reservedQty;
            // Iterate through all sales lines with an ItemId
            while select salesLine
                where salesLine.SalesStatus == SalesStatus::Backorder
            {
                // Get inventory dimension
                inventDim = InventDim::find(salesLine.InventDimId);
                // Open the Batch Reservation form programmatically
                whsBatchAttribReserve = new WHSBatchAttribReserve();
                whsBatchAttribReserve.initParm(salesLine.ItemId, inventDim.InventBatchId);
                whsBatchAttribReserve.run();
                // Retrieve the reservation quantity from the method
                select firstonly tmpPdsBatchSelect
                    where tmpPdsBatchSelect.ItemId == salesLine.ItemId;
                if (tmpPdsBatchSelect)
                {
                    reservedQty = tmpPdsBatchSelect.reserveNowQty(); // Call the method
                }
                // Insert into temporary table for the report
                tmpMyReportTable.ItemId = salesLine.ItemId;
                tmpMyReportTable.ReservedQty = reservedQty;
                tmpMyReportTable.insert();
            }
        }
        public TmpMyReportTable getTmpMyReportTable()
        {
            return tmpMyReportTable;
        }
    }
     
    Best regards,
  • ISDev Profile Picture
    275 on at
    Hello Aymen,
     
    i tried ur code but its not working
  • Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at
    This is a duplicate of x++ code to get the value of the method "Reservation" in batch reservation form. Please select a thread - continue the discussion in one and abandon the other.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans