Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Unanswered

Quantity ordered may not be reduced because there are not enough inventory transactions with on order'status

Posted on by 163

Hello

I have an Item that I want to cancel on an IC SO.

One qty  is "Delivered" and I want to use "Deliver remainder" to cancel the line ( add -1 in the Deliver remainder).

When I add "-1" and press "ok", error message "Quantity ordered may not be reduced because there are not enough inventory transactions with on order'status" apperars.

Here ( see below) is the "code" of the error message.

Can anyone see what I should do to make the line to be cancel?

: -----------------------------------

void synchronizeEX()

{

    PurchLine      purchLine;

    InventQty      newRemainInventPhysical;

    InventQty      newRemainPurchSalesPhysical;

    PdsCWInventQty newPdsCWRemainInventPhysical;

    boolean        interCompanyStocked;

    boolean        isStocked = salesLine.isStocked();

 

    if (salesLine.InterCompanyInventTransId)

    {

        changecompany(salesLine.salesTable().InterCompanyCompanyId)

        {

            setPrefix(strFmt("Company: %1",TradeInterCompany::curCompanyName()));

 

            purchLine = PurchLine::findInventTransId(salesLine.InterCompanyInventTransId,true);

            //

            //  NO unit conversion is performed externally, since the unit is always alike

            //

            interCompanyStocked = purchLine.isStocked();

 

            if (isStocked && !interCompanyStocked && diffInventPhysical)

            {

                diffInventPhysical = 0;

            }

 

            if (diffInventPhysical)

            {

                diffInventPhysical = UnitOfMeasureConverter::convert(diffPurchSalesPhysical,

                                                     UnitOfMeasure::unitOfMeasureIdBySymbol(purchLine.PurchUnit),

                                                     UnitOfMeasure::unitOfMeasureIdBySymbol(purchLine.inventTable().inventUnitId()),

                                                     NoYes::Yes,

                                                     InventTable::itemProduct(purchLine.ItemId));

            }

 

            if (!isStocked && interCompanyStocked && !diffInventPhysical)

            {

                diffInventPhysical  =  purchLine.calcQtyOrdered(diffPurchSalesPhysical);

            }

 

            newRemainInventPhysical      = purchLine.RemainInventPhysical - diffInventPhysical;

            newRemainPurchSalesPhysical  = purchLine.RemainPurchPhysical  - diffPurchSalesPhysical;

            newPdsCWRemainInventPhysical = purchLine.PdsCWRemainInventPhysical - diffPdsCWRemainInventPhysical;

 

            if (salesLine.creditNoteLine())

            {

                if (newRemainInventPhysical > 0 || newRemainPurchSalesPhysical > 0)

                {

                    throw error("Quantity ordered may not be reduced because there are not enough inventory transactions with on order'status");

                }

            }

            else

            {

                if (newRemainInventPhysical < 0 || newRemainPurchSalesPhysical < 0)

                {

                    throw error("Quantity ordered may not be reduced because there are not enough inventory transactions with on order'status");

                }

            }

 

            //

            //  Remain physical must not be negative

            //

            purchLine.RemainInventPhysical      = newRemainInventPhysical;

            purchLine.RemainPurchPhysical       = newRemainPurchSalesPhysical;

            purchLine.PdsCWRemainInventPhysical = newPdsCWRemainInventPhysical;

 

            setPrefix(#PreFixField(PurchLine, PurchId));

 

            if (!purchLine.validateWrite())

            {

                throw error("@SYS18738");

            }

 

            InterCompanyUpdateRemPhys::synchronize(purchLine,

                                                   diffInventPhysical,

                                                   diffPurchSalesPhysical,

                                                   InterCompanySkipUpdate::InterCompany,

                                                   diffPdsCWRemainInventPhysical);

            // Rereading the PurchLine buffer in order to avoid update conflicts.

            // In certain drop shipment scenarios, the PurchLine buffer is updated in the call to InterCompanyUpdateRemPhys::synchronize().

            if (purchLine.ItemRefType  == InventRefType::Sales

            &&  purchLine.InventRefTransId

            &&  purchLine.isDropShipment())

            {

                purchLine.reread();

                purchLine.RemainInventPhysical      = newRemainInventPhysical;

                purchLine.RemainPurchPhysical       = newRemainPurchSalesPhysical;

                purchLine.PdsCWRemainInventPhysical = newPdsCWRemainInventPhysical;

            }

            purchLine.update();

        }

    }

}

regards BCC

  • BCC Profile Picture
    BCC 163 on at
    RE: Quantity ordered may not be reduced because there are not enough inventory transactions with on order'status

    Yes, and it Comes up a error massage too when I do that. So I need to correct it via the AOT I think…

  • Krishna Pushpak Profile Picture
    Krishna Pushpak 265 on at
    RE: Quantity ordered may not be reduced because there are not enough inventory transactions with on order'status

    Tried canceling packing slip ?

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans