Create sales line from x++

hi,

I use AX 2009. I would like to create sales order from x++. I use another Sales Order to take data.

I wrote below code. It creates sales order but doesn’t make reservation. Why ? I missed some parameters in code?

ret.clear();
ret.SalesId = _salesId;
ret.initFromSalesLine(_salesLine);
ret.createLine(NoYes::No, // Validate
NoYes::No, // initFromSalesTable
NoYes::No, // initFromInventTable
NoYes::No, // calcInventQty
NoYes::Yes, // searchMarkup
NoYes::Yes // searchPrice
);

The seventh parameter of createLine() is checkReservation - you should set it to true if the sales order is configured to automatically reserve inventory (SalesTable.Reservation == ItemReservation::Automatic).