Skip to Content

UOM Price Update Code Help

Hi I need to update itm9 table for UOM and price however its not updating it their is a price in the system for every itm9 item So my code is as follows.

  public void UpdateUom(string ItemCode,int PriceListToUpdate,double amountToAdd)
        {
            SAPbobsCOM.Items oMM = null;
            oMM = (SAPbobsCOM.Items)company.GetBusinessObject(BoObjectTypes.oItems);
            int lretcode = 0;
            if (oMM.GetByKey(ItemCode))
            {
                bool need2update = false;
                for (int p = 0; p < oMM.PriceList.Count; p++)
                {
                    oMM.PriceList.SetCurrentLine(p);
                    if (oMM.PriceList.PriceList == PriceListToUpdate)
                    {
                        amountToAdd = oMM.PriceList.Price + amountToAdd;
                        oMM.PriceList.UoMPrices.PriceList = PriceListToUpdate;
                        oMM.PriceList.UoMPrices.Price = amountToAdd;
                        oMM.PriceList.UoMPrices.UoMEntry = 52;
                        oMM.PriceList.UoMPrices.Auto = BoYesNoEnum.tNO;
                        oMM.PriceList.Currency = "GBP";
                        need2update = true;
                        break;
                    }
                }
                if (need2update)
                {
                    lretcode = oMM.Update();
                    if (lretcode != 0)
                        log.Debug(string.Format("(pricelist){0}-{1}", company.GetLastErrorCode(), company.GetLastErrorDescription()));
                }
            }


        }
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

0 Answers