Reserve and Un-reserve an item

Dear All,

Below is the code which I’m using to reserve / un-reserve an item, but when I’m executing this code through a job I’m getting the info message as "The cursor is invalid for instantiating recordViewCache. "

inventMovement = InventMovement::constructNoThrow(_buffer,_inventMovSubType);

if (inventMovement)

{

reservation = InventUpd_Reservation::newMovement(inventMovement,_reserveQty,true);

reservation.updateNow();

}

Is any one knows the reason? Please help me!!!