Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

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

(0) ShareShare
ReportReport
Posted on by 18

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
    18 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
    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

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... 292,884 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,758 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans