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 233
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:
  • Martin Dráb Profile Picture
    231,880 Most Valuable Professional on at
    Whats the x++ code to get the value of the method "Reservation" in batch reservation form
    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.
  • ISDev Profile Picture
    233 on at
    Whats the x++ code to get the value of the method "Reservation" in batch reservation form
    Hello Aymen,
     
    i tried ur code but its not working
  • Suggested answer
    Aymen CHELBI Profile Picture
    344 on at
    Whats the x++ code to get the value of the method "Reservation" in batch reservation form
    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,

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,099 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,880 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans