AX 2009 - InventTrans record of SalesLine

Hi All,

I create sales line like this:

salesLine.SalesId = this.SalesId;
salesLine.ItemId = this.ItemId;
salesLine.SalesQty = this.Qty;
salesLine.SalesUnit = this.SalesUnit;
salesLine.Dimension = this.Dimension;
salesLine.InventDimId = this.InventDimId;
salesLine.LineNum = SalesLine::lastLineNum(this.SalesId) + 1.0;

In spite of filling InventTransId field It doesn’t create any inventTrans record. I used AxSalesLine class before for this job but in this client I cannot use because of customisations. I never care about if InventTrans record created before, now see.

My questions:

-Should every SalesLine record has be an InventTrans record?

-If yes, why mine doesn’t create?

-If no, which situations requires InventTrans record and how?

No, it doesn’t necessarily have any InventTrans record, e.g. if it’s a journal order.

I can’t comment on your specific order, because I don’t have enough information about it.

Thank you,

What should I do for create inventtrans record?

Only the sales orders of type journal will not have the inventTrans. Generally the insert into the salesLine will handle the creation of estimated inventTrans. The dropInvent parameter in salesLine.insert will controls it. I suspect your sales order is of type journal.

Thank you Kranthi,

After you gave me clue, I followed dropinvent parameter until InventUPD_Estimated class. I see transEstimated = 0 is reason of this doesn’t creating InventTrans record.

I don’t know why but after I filled RemainInventPhysical with QTY, it works than…

Basically your salesLine is not properly filled. The estimated qty that is used to create inventTrans is calculated based on the RemainInventPhysical.

If you don’t have the remainInventPhysical mean that you have nothing to deliver, so no inventTrans