Wednesday, November 27, 2013

Changing remaining quantity on sales line (intercompany)

While investigating intercompany processes in AX2012 I've found an interesting thing.

Let's assume the scenario from my previous post: an intercompany direct delivery.
Out supply chain looks like this:
SO 101 -> PO 2012 -> SO 102, where 101 and 102 are company names, SO stands for "Sales order" and PO for "Purchase order".

If you're trying to manipulate delivery remainder from the code (not changing the ordered quantity), you would do the following:

    SalesLine    salesLine102;
    SalesQty     qtyDifference;
    InvetnQty    qtyDifferenceInvent;
    //select sales line
    //...
    qtyDifferenceInvent               =
       salesLine102.unitConvertSales2Invent(qtyDifference);
    salesLine102.RemainSalesPhysical -= qtyDifference;
    salesLine102.RemainInventPhysical-= qtyDifferenceInvent;                
      
    salesLine102.update();



The logic behind an update method should update the whole chain of order lines (PO102 and than SO101). However it won't happen!

The right code is placed into the form "Update delivery remainder", which can be called from the order line:


\Forms\SalesUpdateRemain\Methods\closeOk

The right code should be placed before calling update on sales order line buffer:

    

    InterCompanyUpdateRemPhys::synchronize(saleLine102,
                                           qtyDifferenceInvent,
                                           qtyDifference);



Hope it helps you in customizing AX!

2 comments:

DUŠKA ALŽBĚTA said...

I would highly recommend Mr, Benjamin services to any person in need financial help and they will keep you on top of high directories for any further needs. Once again I commend yourself and your staff for extraordinary service and customer service, as this is a great asset to your company and a pleasant experience to customers such as myself. Wishing you all the best for the future.Mr, Benjamin is best way to get an easy loan,here is there email.. / 247officedept@gmail.com     Or talk to Mr Benjamin On WhatsApp Via_+1-989-394-3740 Thank You for helping me with loan once again in my sincerely heart I'm forever grateful.

Teichmann Containers said...

I was reading some of your content on this website and I conceive this internet site is really informative ! Keep on putting up. abrollcontainer in Germany