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, ...
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
    586 Super User 2026 Season 1 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
    239,029 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 659

#2
André Arnaud de Calavon Profile Picture

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

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 304 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans