on 12-19-2013 7:19 AM
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
Dear All,
Any comment regarding this problem.
Thanks & Regards
Ankit Chauhan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
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
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
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
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.