Dimension Issues..........While creating planned purchase order

Hi Everyone,

We have created new inventory dimension “location” , apart from site and warehouse. We are giving all three dimension while creating the sales order.

Now when we are creating the planned purchase order , all three dimension are flowing to purchase order line —> through custmization .

For this I have written the code in the class “ReqTransPoMarkFirm” method “createPurchLine” and updating invent dim id in table purch line as follows:

this.insertMovement(purchLine); ----- standard code

//New Code ----> Start
ttsbegin;
select forupdate localpurchLine where localpurchLine.RecId == purchLine.RecId;
if(localpurchLine)
{
select firstonly localSalesLine where localSalesLine.SalesId == _reqPO._SalesId;
if(localSalesLine)
{
localpurchLine.InventDimId = localSalesLine.InventDimId;
localpurchLine.doUpdate();
}
}

Select forupdate localinventtrans where localinventtrans.InventTransId == localpurchLine.InventTransId
&& localinventtrans.StatusReceipt == StatusReceipt::Ordered
&& localinventtrans.TransRefId == localpurchLine.PurchId;
if(localinventtrans)
{
localinventtrans.inventDimId = localpurchLine.InventDimId;
localinventtrans.doUpdate();
}
ttscommit;
//New Code—> End

Now if i check the inventory on hand transaction, it is coming as per below screenshot. Plz let me know how to proceed…

  1. What’s your version of AX?
  2. Can you upload the screenshot again?
  3. Could you please describe current behavior and how it differs from the behavior you want to achieve?
  4. Can’t you simply use wmsLocationId instead of creating a new dimension?

Hi Martin,

Thanks for the reply …

  1. I am using AX 2009 with SP1.

  2. Screenshot

Sorry, I don’t follow you very well. Did you create a new dimensions or are you using wmsLocationId, which is included in AX out of the box? And why are you doing anything with sales lines in ReqTransPoMarkFirm?

Nevertheless the main problem is that you change InventDimId and skip the standard update logic. Attempting to update InventTrans and all related things (such as InventSum) and is very bad idea and you see how it ends. Stop it immediately and leave it on InventUpdate class.