Skip to main content

Notifications

Microsoft Dynamics AX forum
Unanswered

Inventory - reserve/ unreserve

Posted on by 7
I facing challenge on unreserving the inventory for SO which already has a work created. When tried to unreserved via code getting the following error, /Reservation cannot be removed because there is a work created which relies on the reservation/.
I have used the below blog to implement the unreservation / reservation.
REF: https://omar-iqbal.com/index.php/2022/07/07/reserve-and-unreserve-salesline-inventory-in-x/
 
Hoping the community members to provide a work around to unreserve the item without canceling  the work
  • Andre Arnaud de Calavon Profile Picture
    Andre Arnaud de Cal... 283,418 Super User on at
    Inventory - reserve/ unreserve
    Hi,
     
    I don't have technical information about how to extend or develop mobile processes. With my previous employer, we had to extend one process. At that time, I did some reverse engineering to check how all should be developed as it is hard or impossible to find public information.
     
  • Inventory - reserve/ unreserve
    As there is a deviation from Initial post, created a separate detailed post on the same.
    Kindly follow up the discussion here - Work Split
     
  • Inventory - reserve/ unreserve
    Hi Andre,
    The 3PL is using the mobile app and I have to stick with work process. I have did some digging and found the following ways
    1. in mobile app there full button which split work based on quantities and batches which is updating the reservation as well,
    2. Split work functionality within FO, facing challenges on splitting the work with single pick line and no option to update quantities/ batches.
    The mobile app scenario suits my requirement and tried to implement the same but couldn't  find any technical reference. can you help me with any code reference to implement the same
     
     
  • Andre Arnaud de Calavon Profile Picture
    Andre Arnaud de Cal... 283,418 Super User on at
    Inventory - reserve/ unreserve
    Hi,
     
    When I understand it correctly, you are using an external warehouse provider (3PL). Also when work is created, it looks like there is a setup for advanced warehouse management in your environment. I would not enable advanced warehouse management in this scenario unless the 3PL is using mobile devices linked to your Dynamics environment. As you receive a message, in case warehouse management is not enabled, you can update the 3PL information in the picklist registration with the batch numbers and quantities. When work is created, you indeed can't change reservation details. 
  • Inventory - reserve/ unreserve
    As part of EDI Customization, The SO in released status is shared to Network(third party) Warehouse via EDI where the picking /shipping happens. Once shipped Network(third party) Warehouse sends back the information of Quantities and Batch against which the order is shipped via EDI, once received will be updating the same in the SO reservation, Load Line and Work. I'm trying to achieve the same but facing difficulties in updating the reservations
    I have used the below code to unreserve the item
     
     /// This method unreserves SalesLine record.
        /// The SalesLine record to unreserve.
        public void unReserveInventory(SalesLine _salesLine)
        {
            InventTrans           inventTrans;
            InventTransOrigin     inventTransOrigin;
            InventMovement        inventMovement;
            InventUpd_Reservation inventUpd_Reservation;
            SalesLine             salesLine;
    
            // Remove reservations and markings on a reserved salesorder
            while select inventTrans
                where inventTrans.StatusReceipt     == StatusReceipt::None
                        && (inventTrans.StatusIssue == StatusIssue::ReservPhysical
                        ||  inventTrans.StatusIssue == StatusIssue::ReservOrdered)
            exists join inventTransOrigin
                where   inventTransOrigin.RecId == inventTrans.InventTransOrigin
            exists join salesLine
                where   salesLine.InventTransId == inventTransOrigin.InventTransId
                        &&  SalesLine.RecId     == _salesLine.RecId
            {
                if (inventTrans.MarkingRefInventTransOrigin)
                {
                    InventTransOrigin::deleteMarking(inventTrans.MarkingRefInventTransOrigin,   
                                     inventTrans.InventTransOrigin,
                                     -inventTrans.Qty,
                                     true);
    
    InventTransOrigin::deleteMarking(inventTrans.InventTransOrigin,    
                                     inventTrans.MarkingRefInventTransOrigin,  
                                     inventTrans.Qty,
                                     true);
                }
    
                if (inventTrans.StatusIssue == StatusIssue::ReservPhysical || 
                    inventTrans.StatusIssue == StatusIssue::ReservOrdered)
                {
                    inventMovement = inventTrans.inventmovement(true);
                    inventUpd_Reservation =   
                    InventUpd_Reservation::newInventDim(inventmovement,
                                                        inventTrans.inventDim(),
                                                        -1 * inventTrans.Qty, 
                                                        false);
                    inventUpd_Reservation.updatenow();
                }
    
            }
        }
    When tried to unreserved via code getting the following error

    Reservation cannot be removed because there is a work created which relies on the reservation

     
       /// This method reserves SalesLine record with specific InventBatchId. 
        ///The SalesLine record to reserve.
        ///Quantity to reserve.
        ///InventBatchId to reserve against
        public void reservesalesLineByBatchId(SalesLine _salesLine, 
                                              InventQty _reserveQuantity,             
                                              InventBatchId _inventBatchId)
        {
            InventUpd_Reservation reservation;
            InventMovement        movement;
            InventDim             inventDimSalesLine, inventDim;
            InventSum             inventsum;
          
            movement = InventMovement::construct(_salesLine);
            
            if (_reserveQuantity > 0)
            {
    
                select inventdim
                where inventdim.inventSiteId == _salesLine.inventDim().InventLocationId &&
                inventdim.inventBatchId == _inventBatchId
                exists join inventsum
                where inventdim.inventdimId == inventsum.inventdimId &&
                inventsum.itemId  == _salesLine.itemId &&
                inventsum.availPhysical >= _reservedQuantity;
    
                reservation = InventUpd_Reservation::newInventDim(movement,
                                                                 inventDim,
                                                               -_reserveQuantity, 
                                                                 false);
                reservation.updateNow();
            }
        }
     
    I also tried the above code to reserve the item against the batch, it's not working but there are also no errors.
    I'm looking for a way to update the reservation without canceling the work.
     
  • Andre Arnaud de Calavon Profile Picture
    Andre Arnaud de Cal... 283,418 Super User on at
    Inventory - reserve/ unreserve
    Hi,
     
    Can you describe the required business process and where you currently have the gap for which you need to remove the inventory reservation? Why do you need to remove the reservation by coding? 

Helpful resources

Quick Links

Contextual content recommendations & SharePoint Q&A

Instantly access relevant sales materials…

Beyond the DRA Cloud Label Printing

Explore cloud-based label printing within Dynamics 365…

HR Infrastructure Customer merge

Important considerations for HR Customer migrations…

Leaderboard

#1
Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,418 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 223,760 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,142

Featured topics

Product updates

Dynamics 365 release plans