D365FO – AX – Create Planned Transfer Order in X++

This is a simple job to create a planned Transfer order througth X++

static void PlannedTransferOrder(Args _args)

{

   ReqPo       ReqPo;

   InventDim   inventDim;

   InventDim   inventDimLocal;

   ReqPlan                                 reqPlan;

   ReqPlanData     reqPlanData;

   ReqPlanId       reqPlanId = ‘Piano Generale’; //Here you put your preferred ReqPlanId

   reqPlanData = ReqPlanData::newReqPlanId(reqPlanId);

   ReqPo.clear();

   ReqPo.initValue();

   ReqPo.initReqPOType(reqPlanData.parmReqPlanVersionRefRecId(),reqPoType::Transfer);

   ReqPo.initFromItemId (“440440”); //Here you put your ItemId

   ReqPo.Qty = 11; //Here you put your Qty

   reqPO.PlanVersion = reqPlanData.parmReqPlanVersionRefRecId();

   inventDim.InventLocationId = ‘AllBlank’; //InventDimId must be AllBlank

   inventDim.InventSiteId = InventLocation::find(‘AllBlank’).InventSiteId;

   inventDimLocal = inventDim::findOrCreate(inventDim);

   ReqPlannedOrder::construct().insertFromForm(ReqPo,inventDimLocal, ‘300’, ‘311’ ); //Here you put your Location From and Location To

}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s