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)

Error posting transfer order using X++ code

(0) ShareShare
ReportReport
Posted on by 11,633

Hi,

I am using the code from the following link to post the transfer order using X++ code:

blog.slcconsulting.us/.../posting-a-transfer-order-using-x

I have a scenario to post a transfer order after the purchase order invoice is posted. I am taking the information from vendinvoicejour and vendinvoiceTrans tables to fill the transfer order header and line tables. But when I am calling the InventTransferUpd.Run method, I am getting the below error:

No lines for posting. Update has been cancelled.

Can anyone please let me know what I am missing here or if someone can share the exact code to post the transfer orders using code that would be great.

Thanks,

SB.

*This post is locked for comments

I have the same question (0)
  • Denis Macchinetti Profile Picture
    16,444 on at

    Hi Syed

    I think the issue depend from the UpdateType filed.

    E.g., if it's set to PickingList, you have to create the Picking of the Transfer order before.

  • syed baber Profile Picture
    11,633 on at

    Hi Denis

    I have set the update type to shipment. Sorry forgot to mention this.

  • syed baber Profile Picture
    11,633 on at

    Hi Denis,

    I am using the following code to post the transfer order:

           inventTransferParmTable.TransferId      = inventTransferTable.TransferId;

           inventTransferParmTable.EditLines       = true;

           inventTransferParmTable.AutoReceiveQty  = true;

           inventTransferParmTable.ExplodeLines    = true;

           inventTransferParmTable.UpdateType      = InventTransferUpdateType::Shipment;

           inventTransferParmTable.TransDate       = systemDateGet();

           inventTransferParmTable.ShipUpdateQty   = InventTransferShipUpdateQty::All;      

           inventTransferUpd = InventTransferUpdShip::newParmBuffer(inventTransferParmTable);

           inventTransferUpd.run();

  • Suggested answer
    Community Member Profile Picture
    on at

    For me it seems issue may because the Trasfer order is not getting save before posting it.

    Please validate if you are doing all the process (creating and posting Transfer order ) in single ttsbegin and ttscommit

    if yes i suggest you to have it in two different transaction.

    Please verify and update us with your findings

  • syed baber Profile Picture
    11,633 on at

    Hi Nitesh,

    I was creating the transfer with Transfer status shipped, so when I changed it to Created, I am no longer getting this error now. But now I am getting below errors:

    Inventory dimension Site is mandatory and must be specified.

    Inventory dimension Warehouse is mandatory and must be specified.

    I have already set the InventDimId for InventTransferLine, but still getting this error. Do you have any idea what might be causing this error?

  • Suggested answer
    Community Member Profile Picture
    on at

    please verify if - InventDimId is updated with appropriate value or not.

    If not then may be you need to review your logic the way you are creating Transfer order line

  • Verified answer
    syed baber Profile Picture
    11,633 on at

    I was missing to set the transit warehouse on transfer order header. After setting this, the error is gone and transfer order posted successfully. But the error was very misleading and didn't specify that the transit warehouse is missing, even through it is mandatory on InventTransferTable.

  • Community Member Profile Picture
    on at

    This helped me to solve an issue like this. In my warehouse settings for a new set of warehouses the transit warehouse was missing... needless to say that the posting error didn't say so :(

  • Community Member Profile Picture
    on at

    Hi Baber owais

    I also facing same problem will posting transfer order using X++ code and i used same blog . so please help me out in these issue regarding how to solve the error

    Your telling on set the transit warehouse on transfer order header. how to set that its through code or manually

    please advice in as early as possible

    Thanks in advance  

  • Community Member Profile Picture
    on at

    Hi all

    write below code in job you will get output

    InventTransferParmTable   inventTransferParmTable;

       InventTransferTable       inventTransferTable;

       InventTransferUpdShip     inventTransferUpdShip;

       InventTransferLine        inventTransferLine;

       InventTransferParmUpdate  inventTransferParmUpdate;

       InventTransferUpd    invTranUpd;

       select * from inventTransferTable where inventTransferTable.TransferId == "[TransferId]";

               //Update transfer order as shipped

               //Generate ParmId

              // parmId = RunBaseMultiParm::getSysParmId();

               //inventTransferMultiShip

               inventTransferParmUpdate.ParmId = RunBaseMultiParm::getSysParmId();

               inventTransferParmUpdate.insert();

               inventTransferParmTable.initValue();

               inventTransferParmTable.ParmId = inventTransferParmUpdate.ParmId;

               inventTransferParmTable.TransferId = inventTransferTable.TransferId;

               inventTransferParmTable.ShipUpdateQty = InventTransferShipUpdateQty::All;

               inventTransferParmTable.EditLines = NoYes::Yes;

               inventTransferParmTable.AutoReceiveQty = NoYes::No;

               inventTransferParmTable.UpdateType = InventTransferUpdateType::Shipment;

               inventTransferParmTable.insert();

               //Transfer Order created above should have status as shipped

               //inventTransferMultiShip.runUpdate(inventTransferParmTable);

               //InventTransferUpd::PostTransferOrder(inventTransferParmTable);

               invTranUpd = InventTransferUpdShip::newParmBuffer(inventTransferParmTable);

               invTranUpd.run();

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
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Ali Zaidi Profile Picture

Ali Zaidi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans