New Ship Detail

Hi Guys,

someone can help me?
I get the error when create new ship detail in shipment.
please check error and code below
#error

#code

        var myShipVia = (from ShipVia_row in ttShipHead
                  where ShipVia_row.PackNum == 4206
                 select ShipVia_row).FirstOrDefault();
                 
        PackNum = myShipVia.PackNum;
        
        Erp.Contracts.CustShipSvcContract csSvc = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.CustShipSvcContract>();
        
        Erp.Tablesets.CustShipTableset shipdtl = new Erp.Tablesets.CustShipTableset();
        using (var txscope = IceDataContext.CreateDefaultTransactionScope())
        {
            // Create
           csSvc.GetNewShipDtl(ref shipdtl, PackNum);  
           shipdtl.ShipDtl[0]["OrderNum"] = OrderNUm;
           shipdtl.ShipDtl[0]["OrderLine"] = OrderLine;
           shipdtl.ShipDtl[0]["OrderRelNum"] = RelNum;
           shipdtl.ShipDtl[0]["LineDesc"] = Desc;
           shipdtl.ShipDtl[0]["CustNum"] = Customer;
           
           csSvc.Update(ref shipdtl);

           Db.Validate();
           txscope.Complete();
        }

Thank You & Warn Regards,

Are you sure the pack no. 4206 exists in your system ? I would get rid of that.

sure bro,
Please see a picture below
image

Ok, if there aren’t any changes in the ShipHead dataset, then the ttShipHead will be empty. Which is what I think happens here. Not sure why you need that first piece with myShipVia but if you still want to do that I would get the val from the DB instead of the temp table. Like replace ttShipHead with Db.ShipHead

ok dude, I will try it
I tired after try many ways to resolve it use BPM, but I do some trigger in customizations to pass the parameter and it worked.
thanks a lot.