cancel
Showing results for 
Search instead for 
Did you mean: 

I can not write puchase width and length while adding Item in SDK?

mucipilbuga
Participant
0 Kudos

Hi,

I can create Item with SDK without any problem. But I can not write purchase sizes (width, length, height). Please check below code.

vItem = vCmp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems)
'Set value to mandatory fields:
vItem.ItemCode = TBStokKod.Text
'Set Value to other fields
vItem.ItemName = TBStokAd.Text
vItem.WhsInfo.WarehouseCode = "01"
'Bunu ben ekledim. https://answers.sap.com/questions/4699942/add-items-using-di-api.html
vItem.ItemType = SAPbobsCOM.ItemTypeEnum.itItems
vItem.ItemsGroupCode = 101 ' Yarımamül
vItem.UoMGroupEntry = 1 ' Adet
vItem.InventoryItem = SAPbobsCOM.BoYesNoEnum.tYES
'Satınalma Ölçü birimleri I can not write below informations unfortunatelly!
vItem.PurchaseUnitHeight = 12 'TBKalinlik.Text.Replace(".", ",")
vItem.PurchaseUnitWidth = 13 ' TBEn.Text.Replace(".", ",")
vItem.PurchaseUnitLength = 14 ' TBBoy.Text.Replace(".", ",")
vItem.PurchaseUnitWeight = 15 ' takas


vItem.UserFields.Fields.Item("U_BE1_DOSYA_BAG").Value = Form1.swModelTakas.GetPathName
vItem.UserFields.Fields.Item("U_BE1_JPG_YOL").Value = "\\192.168.2.245\Resimler\jpg\" & BaseFilename(Form1.swModelTakas.GetPathName) + ".jpg"


'Adding the Item
RetVal = vItem.Add

Regards,

Mucip:)

Accepted Solutions (0)

Answers (3)

Answers (3)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert

Hi mucipilbuga,

If you want to update data of default sales/purchasing uom, please update the data of Items.UnitOfMeasurements first. You can refer to the following code:

 

SAPbobsCOM.Items oItemMD = (SAPbobsCOM.Items)oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems);
            if (oItemMD.GetByKey("UNL00005"))
            {
                ItemUnitOfMeasurements uoms = oItemMD.UnitOfMeasurements;
                for (int index = 0; index < uoms.Count; index++)
                {
                    uoms.SetCurrentLine(index);
                    if (uoms.UoMType == ItemUoMTypeEnum.iutPurchasing
                        && uoms.UoMEntry == oItemMD.DefaultPurchasingUoMEntry)
                    {
                        uoms.Length1 = 0.11;
                        uoms.Length1Unit = 2;
                        uoms.Width1 = 0.22;
                        uoms.Width2Unit = 2;
                        uoms.Height1 = 0.33;
                        uoms.Height1Unit = 2;
                        break;
                    }
                }

                int UITM = oItemMD.Update();
          }

 

Hope it helps!

Kind regards,

ANKIT CHAUHAN

SAP Business One Support

mucipilbuga
Participant
0 Kudos

Dear Ankit CHAUHAN,

I just see your message. Sorry. But I don't know why? I could chenge the values by below code.

'Satınalma Ölçü birimleri
            vItem.PurchaseUnitHeight = TBKalinlik.Text.Replace(".", ",")
            vItem.PurchaseUnitWidth = TBEn.Text.Replace(".", ",")
            vItem.PurchaseUnitLength = TBBoy.Text.Replace(".", ",")
            vItem.PurchaseUnitWeight = TBAgirlik.Text.Replace(".", ",")
            '-------------------------
            'Satış Ölçü birimleri
            vItem.SalesUnitHeight = TBKalinlik.Text.Replace(".", ",")
            vItem.SalesUnitWidth = TBEn.Text.Replace(".", ",")
            vItem.SalesUnitLength = TBBoy.Text.Replace(".", ",")
            vItem.SalesUnitWeight = TBAgirlik.Text.Replace(".", ",")

Regards,

Mucip:)

mucipilbuga
Participant
0 Kudos

Dear All,

There isn't any feedback still?!

Any help please?

Regards,

Mucip:)

mucipilbuga
Participant
0 Kudos

Dear All,

Any feedback please?...

Regards,

Mucip:)