Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Error posting transfer order using X++ code

Posted on by 11,627

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

  • Suggested answer
    RE: Error posting transfer order using X++ code

    In my case this issue was caused by the fact that transfer orders require you to fill out line details.

    So I solved it by filling in a "Ship now" quantity in the line details for shipment.

    And filling in a  "Receive now" quantity in the line details for receiving the items.

  • Suggested answer
    Nik_2015 Profile Picture
    Nik_2015 70 on at
    RE: Error posting transfer order using X++ code

    Hi,

    Might be little late, but worth to share.

    I had a similar issue where i was unable to post shipment for the transfer order which has been picked manually and using x++ i was trying to post the shipment.

    I realized the Table/WMSPickingRoute/finishMulti gets called when we manually do picking list registration.

    In such scenario, add a logic to check the expeditionStatus of this table and if its set to activated, call the above method(finishMulti) to set the status.

    An example would look like below-

    private void updateWMSStatus(InventTransferId _transferOrderId)

    {

       WMSPickingRoute     wmsPickingRoute;

       List                wmsPickingRouteList = new List(Types::String);

       select firstOnly RecId, expeditionStatus, PickingRouteID from wmsPickingRoute

           index ParmIdx

               where wmsPickingRoute.transRefId == _transferOrderId

                  && wmsPickingRoute.transType == InventTransType::TransferOrderShip;

       if (wmsPickingRoute.RecId && (wmsPickingRoute.expeditionStatus == WMSExpeditionStatus::Activated))

       {

           wmsPickingRouteList.addEnd(wmsPickingRoute.PickingRouteID);

           WMSPickingRoute::finishMulti(wmsPickingRouteList.pack());

       }

    }

    Hope it helps!

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error posting transfer order using X++ code

    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();

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error posting transfer order using X++ code

    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
    Community Member Microsoft Employee on at
    RE: Error posting transfer order using X++ code

    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 :(

  • Verified answer
    syed baber Profile Picture
    syed baber 11,627 on at
    RE: Error posting transfer order using X++ code

    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.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error posting transfer order using X++ code

    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

  • syed baber Profile Picture
    syed baber 11,627 on at
    RE: Error posting transfer order using X++ code

    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
    Community Member Microsoft Employee on at
    RE: Error posting transfer order using X++ code

    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
    syed baber 11,627 on at
    RE: Error posting transfer order using X++ code

    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();

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans