I would like to explain the marking transactions through the user interface.
AX2012
For example open the form Transactions from the Transfer order.
To do this, follow the steps below
- 1.Open the form by the link Inventory management / Periodic / Transfer Orders
2. At the bottom of the form on the Tab Lines, click Inventory / Transactions

3. To open the Marking form click Inventory / Marking.
- 4. You need to activate “Set mark now” check box for marking and click Apply.

After that, you will see a green sign indicating the marking.

On the Transactions form on the General tab, the field Reference lot will not be empty.

D365O
For example open the form Transactions from the Sales order.
To do this, follow the steps below
- 1.Open the form by the link Account receivable / Orders / All sales orders / Edit
- 2. At the Sales orders lines tab of the form, click Inventory / Marking

- 3. You need to activate “Set mark now” check box for marking and click Apply.

You can use this code to mark transactions throw X ++.

Or you can use this code to mark

public static void setMark(
InventTransId _inventTransId,
InventTransId _refInventTransId,
InventQty _qtyTomark)
{
TmpInventTransMark tmpInventTransMask;
Map mapMarkNow;
InventDim inventDim;
InventTransOrigin inventTransOrigin;
InventTrans inventTrans;
container con;
Map mapTmp;
MapEnumerator mapEnumerator;
InventTransOriginId issueInventTransOriginId;
InventTransOriginId receiptInventTransOriginId;
InventQty qtyToMark;
issueInventTransOriginId = InventTransOrigin::findByInventTransId(_inventTransId).RecId;
receiptInventTransOriginId = InventTransOrigin::findByInventTransId(_refInventTransId).RecId;
qtyToMark = _qtyTomark;
while select inventDim
join Qty from inventTrans
where inventTrans.inventDimId == inventDim.inventDimId
join RecId from inventTransOrigin
where inventTransOrigin.RecId == inventTrans.InventTransOrigin
&& inventTransOrigin.InventTransId == _inventTransId
{
[con] = TmpInventTransMark::packTmpMark(
InventTransOrigin::find(issueInventTransOriginId),
inventDim,
inventTrans.Qty);
mapTmp = Map::create(con);
mapEnumerator = mapTmp.getEnumerator();
while (mapEnumerator.moveNext())
{
tmpInventTransMask = mapEnumerator.currentValue();
if (tmpInventTransMask.InventTransOrigin == receiptInventTransOriginId)
{
tmpInventTransMask.QtyMarkNow = tmpInventTransMask.Qty;
tmpInventTransMask.QtyRemain -= tmpInventTransMask.QtyMarkNow;
qtyToMark -= tmpInventTransMask.QtyMarkNow;
mapMarkNow = new Map(Types::Int64, Types::Record);
mapMarkNow.insert(tmpInventTransMask.RecId, tmpInventTransMask);
TmpInventTransMark::updateTmpMark(
issueInventTransOriginId,
inventDim,
-tmpInventTransMask.Qty,
mapMarkNow.pack());
if (!qtyToMark)
{
break;
}
}
}
}
}
If you want to unmark transactions, you can use this code

public static void unMark(InventTransId _inventTransId, InventTransId _refInventTransId, InventQty _qty)
{
InventTransOrigin::deleteMarking(
InventTransOrigin::findByInventTransId(_inventTransId).RecId,
InventTransOrigin::findByInventTransId(_refInventTransId).RecId,
_qty);
}

Reservation AX2012
To reserve in the form Transactions follow the steps below
1.Click Inventory / Reservation to open the reservation from

2. Enter the quantity in the field Reservation
- 3. Click Reserve lot or Reserve line

As a result status of the transaction will change to Reserve physical or Reserve ordered.
Reservation D365O
To reserve in the form Sales order follow the steps below
1.Click Inventory / Reservation to open the reservation from

2. Enter the quantity in the field Reservation
- 3. Click Reserve lot

You can use this code to reserve transactions throw X ++.

public static void reserve(InventTransId _inventTransId)
{
InventTrans inventTrans;
InventTransOrigin inventTransOrigin;
InventMovement inventMovement;
InventUpd_Reservation inventUpd_Reservation;
while select inventTrans
where inventTrans.StatusReceipt == StatusReceipt::None
&& inventTrans.StatusIssue == StatusIssue::OnOrder
join RecId from inventTransOrigin
where inventTransOrigin.RecId == inventTrans.InventTransOrigin
&& inventTransOrigin.InventTransId == _inventTransId
&& inventTransOrigin.ReferenceCategory != InventTransType::Sales
{
Inventmovement = inventTrans.inventmovement(true);
inventUpd_Reservation = InventUpd_Reservation::newInventDim(inventmovement, inventTrans.inventDim(), inventTrans.Qty, false);
inventUpd_Reservation.updatenow();
}
}
You can use this code to unreserve transactions throw X ++.

public static void unreserve(InventTransId _inventTransId)
{
InventTrans inventTrans;
InventTransOrigin inventTransOrigin;
InventMovement inventMovement;
InventUpd_Reservation inventUpd_Reservation;
while select inventTrans
where inventTrans.StatusIssue == StatusIssue::ReservPhysical
|| inventTrans.StatusIssue == StatusIssue::ReservOrdered
join RecId from inventTransOrigin
where inventTransOrigin.RecId == inventTrans.InventTransOrigin
&& inventTransOrigin.InventTransId == _inventTransId
{
Inventmovement = inventTrans.inventmovement(true);
inventUpd_Reservation = InventUpd_Reservation::newInventDim(inventmovement, inventTrans.inventDim(), -inventTrans.Qty, false);
inventUpd_Reservation.updatenow();
}
}
Reserve ordered
If you want to reserve ordered items You should active check box Inventory management > Setup > Inventory management parameters > General->Reserve ordered items
First you should mark selected transactions and then do reservation. Notice! Inventory dimensions must be the same for selected transactions.
For example you can reserve items from purchase or transfer orders.
If the reservation is successful, The transaction status will change to the Reserve ordered.
