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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

How to Reserve Lot Picking list registration for All Lines in D365 uisng X++

(0) ShareShare
ReportReport
Posted on by 6

Hi Experts,

on WMSPickingRegistration form to set Reslove Lot Easly for my company user as Donky work and Wasted a lot of time,
As we all know Reslove lot for Selected Line in D365 as be as shown in the attached pictures as well,

01

3513.pic1.JPG

02

pic2.JPG

03

pic3.JPG

So that Iwant to add Customize on above form WMSPickingRegistration on No. 5 in above image also to Reslove Lot for all Lines to consume Donky work and Wasted a lot of time.

So that I Emplement Attched Code Class to invole that but ihave iusse and Idont understand where?



Can Help me Please;
H.R

I have the same question (0)
  • Suggested answer
    Abdelhman Profile Picture
    6 on at

    Code:

    [quote user="Abdelhman"]

    Hi Experts,

    on WMSPickingRegistration form to set Reslove Lot Easly for my company user as Donky work and Wasted a lot of time,
    As we all know Reslove lot for Selected Line in D365 as be as shown in the attached pictures as well,

    01

    3513.pic1.JPG

    02

    pic2.JPG

    03

    pic3.JPG

    So that Iwant to add Customize on above form WMSPickingRegistration on No. 5 in above image also to Reslove Lot for all Lines to consume Donky work and Wasted a lot of time.

    So that I Emplement Attched Code Class to invole that but ihave iusse and Idont understand where?



    Can Help me Please;
    H.R

    [/quote]

    Some links to help:
    community.dynamics.com/.../reserve-salesline-throughcode
    www.schweda.net/blog_ax.php
    sangeethwiki.blogspot.com/.../reserve-and-unreserve-sales-order-line.html
    www.instructorbrandon.com/.../
    www.dynamicsuser.net/.../7
    community.dynamics.com/.../x-to-update-sales-line-reserve-physical-qty
    gfeaxblog.wordpress.com/.../
    eurom.be/.../storage-dimension-group-in-d365.html
    axfactory.wordpress.com/.../
    https://timsaxblog.wordpress.com/2015/08/31/the-reserved-ordered-items-inventory-parameter/

    public class GOWMSPickingRegistrationReserveLot

    {

       WMSOrderTrans   _WMSOrderTrans , _WMSOrderTransInsert;

       InventMovement _InventMovement;

       InventUpd_Reservation   _InventUpd_Reservation;

       InventSum               _InventSum;

       InventBatch     inventBatch;

       InventDim               inventDim;

       Qty         totalReservedQty,mainQty ,availableQty, RemainQty;

       public void ReserveLotLine(RecId _wmsOrderTransRecId)

       {

           select forUpdate _WMSOrderTrans

               where _WMSOrderTrans.RecId == _wmsOrderTransRecId;

           //select _InventSum

           //where  _InventSum.InventDimId == _WMSOrderTrans.inventDimId &&

           //       _InventSum.ItemId == _WMSOrderTrans.itemId

           select  _InventSum

               where  _InventSum.ItemId == _WMSOrderTrans.itemId &&//'F000442' &&

               _InventSum.AvailPhysical != 0

               join   inventBatch

                       order by inventBatch.expDate desc

               where  inventBatch.inventBatchId == _InventSum.inventBatchId

               join   inventDim

               where  inventDim.inventDimId == _InventSum.inventDimId;

           availableQty = _InventSum.AvailPhysical;// physicalInventCalculated(); //345+48 = 393

           //confirm -QTYs

           if (availableQty >= _WMSOrderTrans.qty)

           {

               this.UpdateLineNow(_WMSOrderTrans);

           }

           else

           {

               mainQty = _WMSOrderTrans.qty; // 102

               RemainQty = availableQty - mainQty; //393 - 102 = 291

               select _InventSum

               where  _InventSum.PostedQty + _InventSum.Received - _InventSum.Deducted + _InventSum.Registered - _InventSum.Picked >= RemainQty

               && _InventSum.ItemId == _WMSOrderTrans.itemId;

               //Order by InventBatch Expired date && Big on-Hand

               if(_InventSum)

               {

                   ttsBegin;

                   _WMSOrderTrans.qty = availableQty;

                   _WMSOrderTrans.update();

                   ttsCommit;

                   this.UpdateLineNow(_WMSOrderTrans);

                   //insert New Row///

                   _WMSOrderTransInsert.data(_WMSOrderTrans);

                   _WMSOrderTransInsert.inventDimId = _InventSum.InventDimId;

                   _WMSOrderTransInsert.qty = RemainQty;

                   _WMSOrderTransInsert.IsReserved = NoYes::Yes;

                   _WMSOrderTransInsert.expeditionStatus = WMSExpeditionStatus::Complete;

                   _WMSOrderTransInsert.insert();

                   this.UpdateLineNow(_WMSOrderTransInsert);

               }

               else

               {

                   //info("there is no onhand for all Qty")

                   ttsBegin;

                   _WMSOrderTrans.qty = availableQty;

                   _WMSOrderTrans.update();

                   ttsCommit;

                   this.UpdateLineNow(_WMSOrderTrans);

                   totalReservedQty += availableQty;

                   if(mainQty > totalReservedQty)

                   this.UpdateLineRecursiveNow(mainQty-totalReservedQty);

               }

           }

       }

       //////////////////////////////////////////////////////

       private void UpdateLineNow(WMSOrderTrans currWMSOrderLine)

       {

           if(_WMSOrderTrans)

           {

               _InventMovement = _WMSOrderTrans.inventMovement(true);

               _InventUpd_Reservation = InventUpd_Reservation::newInventDim(_InventMovement,currWMSOrderLine.inventDim(),currWMSOrderLine.qty * -1,false);

               _InventUpd_Reservation.updateNow();

           }

       }

       //////////////////////////////////////////////////////

       private void UpdateLineRecursiveNow(Qty _RQty)

       {

           select _InventSum

           where  _InventSum.PostedQty + _InventSum.Received - _InventSum.Deducted + _InventSum.Registered - _InventSum.Picked >= 0

               && _InventSum.ItemId == _WMSOrderTrans.itemId;

           //Order by InventBatch Expired date && Big on-Hand

           if(_RQty < _InventSum.physicalInventCalculated())

           {

               _WMSOrderTransInsert.data(_WMSOrderTrans);

               _WMSOrderTransInsert.inventDimId = _InventSum.InventDimId;

               _WMSOrderTransInsert.qty = _RQty;

               _WMSOrderTransInsert.IsReserved = NoYes::Yes;

               _WMSOrderTransInsert.insert();

               this.UpdateLineNow(_WMSOrderTransInsert);

               totalReservedQty += availableQty;

           }

           else

           {

               _WMSOrderTransInsert.data(_WMSOrderTrans);

               _WMSOrderTransInsert.inventDimId = _InventSum.InventDimId;

               _WMSOrderTransInsert.qty = _InventSum.physicalInventCalculated();

               _WMSOrderTransInsert.IsReserved = NoYes::Yes;

               _WMSOrderTransInsert.insert();

               this.UpdateLineNow(_WMSOrderTransInsert);

               totalReservedQty += _InventSum.physicalInventCalculated();

               if(mainQty > totalReservedQty)

                   this.UpdateLineRecursiveNow(mainQty-totalReservedQty);

           }

       }

       //////////////////////////////////////////////////////

    }

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Abdelhman,

    It is recommended to post the thread to the following forum for further help: 

    (+) Microsoft Dynamics AX - Forums, Blogs, Support

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 April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 103 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 83

#3
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans