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

WHSwork is created for the remaining quantity instead of the reserved quantity

(0) ShareShare
ReportReport
Posted on by

Hi everyone,

I am working on a customization for Production orders where we need to reserve raw materials by License Plate (LP) and then generate the corresponding WHS work for the reserved quantity.

I am currently using the standard reservation engine with InventUpd_Reservation to reserve against a specific LP. The reservation is created correctly (e.g., 8 units reserved physically on a specific License Plate).
However, when I release the production order to the warehouse, the WHS work that gets created is not for the reserved quantity (8 units), but instead for the remaining unreserved quantity (e.g., 3 units).

It seems that the WHS work creation logic ignores the reservation created via InventUpd_Reservation and only generates work for the quantity that is still “unreserved” from a WHS perspective.

Is there any way to make WHS work generation respect the reservation performed by InventUpd_Reservation?

Here's the code:

 private void licensePlateReserve()
 {
     ProdBOM                         prodBOMAux;
     WHSInventTable              whsInventTable;
     InventTrans                     inventTrans;
     InventTransOrigin           inventTransOrigin;
     InventSum                      inventSum;
     InventDim                      inventDim, inventDimAux;
     InventMovement             inventMovement;
     InventUpd_Reservation   reservation;
     real                                remainQty;
     boolean                         reserveSuccess          = false;
     Set                                 licensePlatesChecked    = new Set(Types::String);
     WHSWorkTable               whsWork;
 
     remainQty = prodTable.qtySched;
 
     while select prodBOMAux
         join whsInventTable
             where whsInventTable.ItemId == prodBOMAux.ItemId
         join inventDim
             where   inventDim.inventDimId                           == prodBOMAux.InventDimId
                 &&  prodBOMAux.ProdId                               == prodTable.ProdId
     {
         while (remainQty > 0)
         {
             reserveSuccess = false;
             while select inventSum
                 order by LicensePlateId asc
                     where   inventSum.ItemId                     == prodBOMAux.ItemId
                         &&  inventSum.InventLocationId      == inventDim.InventLocationId
                         &&  inventSum.InventSiteId              == inventDim.InventSiteId
                         &&  inventSum.AvailPhysical            > 0
                         &&  inventSum.LicensePlateId           != ''
             {
                 if (licensePlatesChecked.in(inventSum.LicensePlateId))
                 {
                     continue;
                 }
                 inventMovement      = InventMovement::construct(prodBOMAux);
                 
                 inventDimAux.clear();
                 inventDimAux.data(inventDim);
                 inventDimAux.LicensePlateId    = inventSum.LicensePlateId;
                 inventDimAux.wMSLocationId     = inventSum.wMSLocationId;
                 inventDimAux.inventBatchId     = inventSum.inventBatchId;
                 inventDimAux                   = InventDim::findOrCreate(inventDimAux);
                 InventDimParm inventDimParm;
                 inventDimParm.initFromInventDim(inventDimAux);
                 
                 InventAvailabilityByUnit    inventAvailabilityByUnit    = InventAvailabilityProvider::findByItemSumDim(inventSum.inventTable(), inventSum, inventDimAux);
                 InventQty                   availQtyreserve             = inventAvailabilityByUnit.parmInventAvailability().availReservation();
                 
                 if(availQtyreserve >= prodBOMAux.BOMQty)
                 {
                     reservation = InventUpd_Reservation::newParameters(inventmovement,
                                 inventDim,
                                 inventDimParm,
                                 InventDimFixedClass::inventDimParm2InventDimFixed(inventDimParm),
                                 -prodBOMAux.BOMQty,
                                 false);
 
                     reservation.parmInventDimOnHandSelectionCriteria(inventDimAux);
                     reservation.updateNow();
                     remainQty--;
                     reserveSuccess = true;
                     break;
                 }
                 else
                 {
                     licensePlatesChecked.add(inventSum.LicensePlateId);
                 }
             }
             if (!reserveSuccess)
             {
                 warning(strFmt('No se encontró matrícula con cantidad suficiente para el artículo %1. Cantidad requerida: %2. Piezas pendientes: %3', prodBOMAux.ItemId, prodBOMAux.BOMQty, remainQty));
                 break; 
             }
         }
     }
 }

Thanks!

I have the same question (0)

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
André Arnaud de Calavon Profile Picture

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

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 366

#3
Adis Profile Picture

Adis 256 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans