Single Transfer order shipped in d 365 with multi lines

 Hi today we have requirement for shipped transfer order 


public void shipTransferOrder()

    {

        //// ship a transfer order

        InventTransferMultiShip multiShip = InventTransferMultiShip::construct();

       

        // // Id of transfer order to ship

       // InventTransferId            shipTransferId =;

        InventTransferLine          inventTransferLine;

        InventTransferParmTable     inventTransferParmTable;


        ttsbegin;

        while select inventTransferLine

            where inventTransferLine.TransferId == transferID

        {


            //framework stuff to set parmId

            RunBaseMultiParm::initParm(multiShip);


            //get general values related to shipping set

            // InventTransferParmTable inventTransferParmTable;

            inventTransferParmTable.TransferId = transferID;

            inventTransferParmTable.ParmId = multiShip.parmId();

            multiShip.initParmBuffer(inventTransferParmTable);

           

            inventTransferParmTable.UpdateType = InventTransferUpdateType::Shipment;

            inventTransferParmTable.ShipUpdateQty = InventTransferShipUpdateQty::All;


            inventTransferParmTable.EditLines = NoYes::Yes;

            inventTransferParmTable.ExplodeLines = NoYes::No;

            inventTransferParmTable.TransDate = today(); //shipment date

            inventTransferParmTable.InventDimFixedReceiveList = 0;


            InventTransferParmLine inventTransferParmLine;

        

            inventTransferParmLine.initFromInventTransferLine(inventTransferLine);

            inventTransferParmLine.ParmId               = inventTransferParmTable.ParmId;

            inventTransferParmLine.TransferId           = inventTransferLine.TransferId;

            inventTransferParmLine.InventTransId        = inventTransferLine.InventTransId;

            inventTransferParmLine.LineNum              = InventTransferParmTable::lastLineNum(inventTransferParmTable.ParmId) + 1;

            inventTransferParmLine.InventTransIdTransit = inventTransferLine.InventTransIdTransitFrom;

            inventTransferParmLine.QtyShipNow           = inventTransferLine.QtyRemainShip;

            inventTransferParmLine.insert();

        


            inventTransferParmTable.insert(false); //will create parmLines by default


            //now do the update

            multiShip.runUpdate(inventTransferParmTable);

            

        }


        if(InventTransferTable::find(transferID).TransferStatus == InventTransferStatus::Shipped)

        {

            message = "Transfer order is Shipped ";


            localOutput = strFmt("%1, %2",message,transferID);

            this.parmOutput(localOutput);

        }

        ttscommit;


    }

Comments

Popular posts from this blog

Customization on Sales invoice Report in D365 F&O

75) COC - Create a coc of the table modified method

46) D365 FO: SHAREPOINT FILE UPLOAD USING X++