cancel
Showing results for 
Search instead for 
Did you mean: 

Update Item PurchaseUnitWeight

Former Member
0 Kudos

I want to Update PurchaseUnitWeight of an Item with DI API. The SourceCode works on all Items with the UoM-Group is set to Manual. But it doesn't work with other UoM-Groups. Even that I can update the Weight in SBO manually.

Here the simple Code that creates the problem:

SAPbobsCOM.Items item = WUD_Standard.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems);

item.GetByKey("00000001");

item.PurchaseUnitWeight = 15.0;

int ret = item.Update();

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Solution from SAP Support:

SAPbobsCOM.Items item = WUD_Standard.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems);

item.GetByKey("00000001");

item.UnitOfMeasurements.SetCurrentLine(1); // Purchase

item.UnitOfMeasurements.Weight1 = 15;

item.UnitOfMeasurements.Weight1Unit = 3; // kg

item.UnitOfMeasurements.SetCurrentLine(5); // Sale

item.UnitOfMeasurements.Weight1 = 15;

item.UnitOfMeasurements.Weight1Unit = 3; // kg

item.Update();

Answers (2)

Answers (2)

maik_delly
Active Contributor
0 Kudos

Hi Thomas,

I can reproduce this faulty behavior in SBO 9.0 PL 12. Which PL are you using  ( they changed some problems with item/uom in recent PL ) ?

regards,

Maik

Former Member
0 Kudos

Hi Maik,

I have tested it on SBO 9.0 PL 10.

I will now update SBO and try it again.

Former Member
0 Kudos

Now I tested on PL 14 but it is still not updating.

Former Member
0 Kudos

try to set also

            oItms.PurchaseUnit =

            oItms.PurchaseItemsPerUnit =

            oItms.PurchasePackagingUnit =

            oItms.PurchaseQtyPerPackUnit =

            oItms.PurchaseUnitVolume =

            oItms.PurchaseUnitWeight1 =15.0

maybe the object need one of these field.

Regards alessandro

Former Member
0 Kudos
       

Same Problem with this Code:

SAPbobsCOM.Items item = WUD_Standard.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems);

        item.GetByKey("00000001");
        item.PurchaseUnitWeight = 15.0;
        item.PurchaseUnit = "Stk";
        item.PurchaseItemsPerUnit = 1;
        item.PurchasePackagingUnit = "Stk";
        item.PurchaseQtyPerPackUnit = 1;
        item.PurchaseUnitVolume = 1;
        item.PurchaseUnitWeight1 = 1.0;
        int ret = item.Update();
Former Member
0 Kudos

hi,

do you have some error when run your code?

Former Member
0 Kudos

No Error and nothing. It Returns always 0.

Former Member
0 Kudos

hi,

strange, you may try to set

Item.PurchaseItem = SAPbobsCOM.BoYesNoEnum.tYES


then set


item.PurchaseUnitWeight = 15.0


regards alessandro


Former Member
0 Kudos

No, still not Updating and no Error.

SAPbobsCOM.Items item = WUD_Standard.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems);

item.GetByKey("00000001");

item.PurchaseItem = SAPbobsCOM.BoYesNoEnum.tYES;

item.PurchaseUnitWeight = 15.0;

int ret = item.Update();

Former Member
0 Kudos

the last try is to check if there is other error in your configuration.

after update item put this code

nErr as integer

errMsg as string

oCompany.GetLastError(nErr, errMsg)

                        If (0 <> nErr) Then

                            SBO_Application.MessageBox("Found error: " + Str(nErr) + ", " + errMsg)

                        End If

Former Member
0 Kudos

nErr is 0 and errMsg is "".

So I don't think there is an Error.

Former Member
0 Kudos

Yes, your code it's ok, maybe there is some standard configuration or sap rule.

Former Member
0 Kudos

Yes, maybe.

But where can I find which one is blocking the update?

I also tried to set other item atributs, but no success.

It still works fine with UI API.