cancel
Showing results for 
Search instead for 
Did you mean: 

'I' is not a valid value for property 'UoMType'

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Dear All,

I am using following code to update the Item Price against a particular Price List. But I am getting the error as

" 'I' is not a valid value for property 'UoMType'. The valid values are: 'P' - 'Purchasing',  'S' - 'Sales'"

Dim oItem As SAPbobsCOM.Items = objMain.objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems)

If oItem.GetByKey("A") = True Then

     oItem.PriceList.SetCurrentLine(PriceListLineNum)

     oItem.PriceList.Price = 10

     oItem.Update()

End If

Can you please explain what am I doing wrong ? Am I missing a setting or something else in my code ?

Please help me. Any kind of help would be appreciated.

Thanks & Regards

Ankit Chauhan

Accepted Solutions (0)

Answers (1)

Answers (1)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Dear All,

Any comment regarding this problem.

Thanks & Regards

Ankit Chauhan

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Dear All Experts,

I Need your assistance to get this problem sorted out. Please suggest something for this.

Thanks & Regards

Ankit Chauhan

Former Member
0 Kudos

Dear ANkit,

I just saw your question... Both here and in the APplication forum which is a wrong place (so please, close the other thread).

May you emphasis a bit on what you're doing?

Regards,

Eric

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Eric Lapouge,

I have a form where user selects an item, pricelist and enter some amount. I want to update the item price against that selected pricelist using entered amount.

Like the same way we do going to Inventory->Price Lists-> Selecting an price list and update item price using a selected price list.

I hope I am pretty clear. If not, I can describe again. But need solution for this.

Thanks & Regards

Ankit Chauhan

Former Member
0 Kudos

Hi Ankit,

Thru DI API it should work... I can test, but I'm pretty sure.

var item = (Items)GetBusimessObject(oItems);

And you scan the Item_Prices collection until you find the pricelist to update, you update it, then item.Update().

Regards,

Eric

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Eric Lapouge,

Yes. You are right. DIAPI should work. Till now I am using this to update the item price.

Dim oItem As SAPbobsCOM.Items = objMain.objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems)

If oItem.GetByKey("A") = True Then

     oItem.PriceList.SetCurrentLine(PriceListLineNum)

     oItem.PriceList.Price = 10

     oItem.Update()

End If

So can you please provide me a sample or make me correct where am I doing a mistake in the above written code. ?

Your help would be appreciated.

Thank & Regards

Ankit Chauhan

Former Member
0 Kudos

Hi Ankit,

I'm doing a test, but... It sounds, by reading, that their is an error in your code: PriceListNum is the id of the pricelist in OPLN (column ListNum) not the index of the line in PriceList collection in OPLN; so basically, your accessing a not existing member of the list.

If there is an error, what are the code code and description returned by the DI?

Regards,

Eric

Former Member
0 Kudos

Hi Ankit,

static void Main(string[] args)

        {

            var company = new Company

            {

                Server = "192.168.90.105",

                LicenseServer = "192.168.90.105:30000",

                DbServerType = BoDataServerTypes.dst_MSSQL2008,

                CompanyDB = "MyDB",

                UserName = "manager",

                Password = "Password"

            };

            if (0 == company.Connect())

            {

                var item = (IItems)company.GetBusinessObject(BoObjectTypes.oItems);

                if (item.GetByKey("10024"))

                {

                    for (int priceList = 0, priceListCount = item.PriceList.Count;

                        priceList < priceListCount;

                        priceList++)

                    {

                        item.PriceList.SetCurrentLine(priceList);

                        if (2 == item.PriceList.PriceList)

                        {

                            item.PriceList.Price = 987.0;

                            if (0 != item.Update())

                            {

                                var errorCode = company.GetLastErrorCode();

                                var description = company.GetLastErrorDescription();

                            }

                            break;

                        }

                    }

                }

            }

            else

            {

                var errorCode = company.GetLastErrorCode();

                var description = company.GetLastErrorDescription();

            }

        }

Works perfectly... So I guess the error is on the indexed access to the pricelist, but until you provide the error code and description...

Regards,

Eric

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi ERIC,

Thanks for your timely reply.

The interesting thing is that my code is working fine for some items but it is giving me an error for a particular item.

You please test it at your side and please reply me. I am stuck with this problem already.

Thanks & Regards

Ankit Chauhan

Former Member
0 Kudos

Hi Ankit,

I provided a working sample and I'm expecting from you the error code and description returned by the DI-API.

Besides this, check the way you access a given line in the Items.PriceList collection... I'm pretty sure by reading your code that the error is here.

Without these info, I cannot do more.

Regards,

Eric

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi ERIC LAPOUGE,

Thank you so much for your reply. I will try this as you described but tell me one more thing please. In the following line if (2 == item.PriceList.PriceList)

What this line will do ? For which purpose this line is used ? Or please explain from the FOR loop you are using in your code ?

Thanks & Regards

Ankit Chauhan

Former Member
0 Kudos

Hi Ankit,

If(2 == is a sample from my test database. This is where is your mistake: ListNum from OPLN aren't id in Items.PriceList collection...

Regards,

Eric

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Eric,

Thanks for the reply.

But what I am supposed to use at this line ? How can I update Item Price against a particular price list ?

Thanks & Regards

Ankit Chauhan

Former Member
0 Kudos

Hi Ankit,

You're supposed to scan the PriceList collection to find the correct pricelist to update, nothing else.

Regards,

Eric