X++ to update sales line reserve physical qty

thank you now my code is working good . below is the code if any one need it

/*
this methos is used for update the reserve Physical qty
take 3 paramater
RecId = this is sales line recid
reservePhysical = this is the qty we get from deliver now
reservedPhysical = this is the qty we get from previously reserved qty
*/

public static void updateReservedPhysical(RecId _recId,Qty reservePhysical,Qty reservedPhysical)
{
InventTrans inventTrans;
InventTransOrigin inventTransOrigin;
InventMovement inventMovement;
InventUpd_Reservation reservation ;
SalesLine salesLine;
Qty qty;

/*
here we check the condetion
and set the qty to add or deduct for physical reserver qty
*/
if (reservePhysical < reservedPhysical)
{
qty = reservedPhysical - reservePhysical;
}
else if(reservePhysical > reservedPhysical)
{
qty = reservedPhysical - reservePhysical;
}

// find the record on sales line base on recid
salesLine = SalesLine::findRecId(_recId);
select inventTransOrigin
where inventTransOrigin.InventTransId == salesLine.InventTransId
join inventTrans
where inventTrans.InventTransOrigin == inventTransOrigin.RecId
&& inventTrans.StatusReceipt == StatusReceipt::None;

//if inventTrans.RecId is not 0 then we continue
if(inventTrans.RecId)
{
inventMovement = inventTrans.inventmovement(true);
// here we set the paramater for InventUpd_Reservation check class InventUpd_Reservation for more info
reservation = InventUpd_Reservation::newInventDim(inventmovement,inventTrans.inventDim(),qty, false);
reservation.updatenow();

}

//info(strFmt("%1",salesLine.reservedPhysicalSalesUnit()));

}