web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Post TO shipment with X++

(0) ShareShare
ReportReport
Posted on by

Hello everyone,

I'm hoping someone has done this before and will be able to help. I am trying to post a shipment against a Transfer Order in Dynamics 365 for Operations and am not sure the correct way to do so. For PO's & SO's you have the formLetter classes that you can leverage but I do not see that same structure for TO's. 

I am receiving lines from an external 3PL system when they ship the product out, storing those in a staging table and then processing those lines with a job. I need to be able to create a TO shipment and  apply the appropriate lines and post.

Any advice would be greatly appreciated.

*This post is locked for comments

I have the same question (0)
  • kelby.turk Profile Picture
    on at

    I have followed the links and structured my code very similarly but am receiving an interesting error. I have plenty of inventory on-hand but am still receiving the following error:

    TOshipmentError0208.PNG

    My code is included below for reference:

    select firstonly shipTable

                       where shipTable.DocumentId == shipTable2.DocumentId;

                   // Update QtyShipNow on the TO line for each line on generated id

                   while select * from shipTable3

                       where shipTable3.DocumentId      == shipTable.DocumentId

                       && shipTable3.GeneratedId        == shipTable.GeneratedId

                       && shipTable3.ProcessingStatus   == stagingStatus::Pending

                   {

                       select forupdate inventTransferLine

                           where inventTransferLine.TransferId == shipTable3.DocumentId

                           && inventTransferLine.ItemId        == InventTable::getItemIdFromLogisticsId(shipTable3.ItemId)

                           && inventTransferLine.LineNum       == str2Num(shipTable3.PickLineNum);

                       if(inventTransferLine.QtyRemainShip != 0)

                       {

                           //inventTransferLineLocal = null;

                           //select forUpdate inventTransferLineLocal

                           //    where inventTransferLineLocal.RecId == inventTransferLine.RecId;

                           inventTransferLine.QtyShipNow = str2Num(shipTable3.QtyShipped);

                           inventTransferLine.update();

                           //inventTransferLine.reread();

                       }

                   }

                   // Select TO that we are posting a shipment to.

                   select firstonly inventTransferTable

                       where inventTransferTable.TransferId == shipTable.DocumentId;

                   inventTransParmUpdate.ParmId = RunBaseMultiParm::getSysParmId();

                   inventTransParmUpdate.insert();

                   // Create parm table and lines for posting

                   invTransParmTable.clear();

                   invTransParmTable.ParmId = inventTransParmUpdate.ParmId;

                   invTransParmTable.TransferId = inventTransferTable.TransferId;

                   invTransParmTable.EditLines = true;

                   invTransParmTable.AutoReceiveQty = false;

                   invTransParmTable.UpdateType = InventTransferUpdateType::Shipment;

                   invTransParmTable.ShipUpdateQty = InventTransferShipUpdateQty::ShipNow;

                   invTransParmTable.TransDate = str2Date(shipTable.ShipDate,321);

                   invTransParmTable.insert(true);

                   // Post parm table and lines that were just created.

                   invTranUpd = InventTransferUpdShip::newParmBuffer(invTransParmTable);

                   invTranUpd.run();

  • kelby.turk Profile Picture
    on at

    I figured it out after I posted this. I was missing the following:

    invTransParmTable.initValue();

  • kelby.turk Profile Picture
    on at

    All works well.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans