Quantcast
Channel: AX Developer Forum
Viewing all articles
Browse latest Browse all 9880

Decreasing Physical Reserve for a SalesLine

$
0
0

Hi.

I'm experiencing some problems with physical reservation.

Scenario:

I have a production order generated through MRP from a sales line. When i post the reportfinished journal the qty in the journal gets reserved physically for the salesline that originated that production order (standard func).

What i need is to unreserve that qty (mostly it's not the total of the production order) and transfer it with a transfer journal. So i'm trying  BUT i have two problems:

1. if  i put the unreserve call in the same ttebegin-ttscommit block (that's how i need it) the transfer journal seems to not know that the unreserve took effect and tells me there is 0 available.

    If i put the unreserve code outside the same transaction than the tranfer journal it does that ok. 

2. When its not the total of the production order i'm posting in the reportfinished journal, the unreserve code is unreserving the "ordered reserve" instead of the physically reserved which is the one i want to unreserve so i can transfer it.

 

I don't know if its my code the one causing this problems or if there's no way i can put the reserve code in the same transaction block than the transfer. And if there's a way to unreserve physycal insted of oredered.

 

Im using this code for reserving and unreserving, i pass a negative qty to unreserve (or decrease the reserve for that matter).

static server void reserveSalesLine(SalesLine _salesLine,Qty  _qtyReserv  = _salesLine.QtyOrdered)
{
    InventUpd_Reservation   reservation;
    InventDimParm           inventDimParmFixed;
    ;
     inventDimParmFixed.initFromInventDim(_salesline.inventDim());
    reservation = InventUpd_Reservation::newParameters(
                                                    InventMovement::construct(_salesLine),
                                                    _salesLine.inventDim(),
                                                    inventDimParmFixed,
                                                    InventDimFixedClass::inventDimParm2InventDimFixed(inventDimParmFixed),
                                                    -_qtyReserv,
                                                    true);

    reservation.parmAllowAutoReserveDim(false);
    reservation.updateNow();

 }

 

Thanks.

 


Viewing all articles
Browse latest Browse all 9880

Trending Articles