on 02-22-2006 9:50 AM
I don't see how to update the UDF I added to the ITM1 table. I added two Fields: "U_I001" and "U_I002"
I have an Items object to update ITM1/Price which works perfectly,
I can't acces my UDF from that table, which object am I supposed to use?
here is my code:
oItems = (SAPbobsCOM.Items)B1Connections.diCompany.GetBusinessObject(BoObjectTypes.oItems);
oItems.GetByKey("A001");
oItems.PriceList.SetCurrentLine(0);
//This line works ok
oItems.PriceList.Price = 'MyUpdatedPrice;
//These lines don't seem to refer to the right fields
oItems.PriceList.UserFields.Fields.Item("U_I001").Value = 'MyNEwValue1;
oItems.PriceList.UserFields.Fields.Item("U_I002").Value = 'MyNewValue2;
oItems.Update();
Hi Emmanuel,
How did you add UDF to the ITM1 table? If you add UDFs to the price list object it is added to the OPLN table and not the ITM1 table. Add the following error checking to your code to find out what error you receive:
If oItems.Update <> 0 Then
oApplication.MessageBox(oCompany.GetLastErrorDescription)
End If
Hope it helps,
Adele
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes but the thing is I am not trying to write in that field at all.
I am trying to write in my user defined field and I get this error as if I was trying to write to the 'Overwritten' field.
thanks,
Emmanuel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes I am doing it already.
The price is well updated according to the PriceList line I set, but the UDF aren't.
I added an enumerator on these userfields with:
IEnumerator FieldsEnum = oItems.PriceList.UserFields.Fields.GetEnumerator();
string sFields = "";
while (FieldsEnum.MoveNext())
{
SAPbobsCOM.Field oField = (SAPbobsCOM.Field)FieldsEnum.Current;
sFields += oField.Name + ", ";
}
B1Connections.theAppl.MessageBox(sFields,0,"","","");
and here is what is displayed in the message box?!:
<i>IsCommited, OnHand, SellItem, VATLiable, VatGourpSa, CstGrpCode, ItmsGrpCode,</i>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<i>On update I get the following error:
'1' is not a valid value for field 'overwritten'. The valid values are 'Y'-'Yes', 'N'-'No'</i>
If you look in the SDK it will tell you that it use tYes and tNo instead of 1,0 or Y,N or Yes, No... Would recommend trying it using tYes and tNo.. That might fix it...
Yes nothing in the SBO GUI refers to this table. I also noticed it as a tried to remove the field to re-create them...
But when I look at the database structure with SQL Server entreprise manager, I can see that the fields have been created properly in ITM1 Table...
thank you for helping me
Emmanuel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Emmanuel,
I have tried to reproduce your problem and I have noticed strange things.
If I try to see the values for
oItem.PriceList.Count
and
oItem.PriceList.UserFields.Fields.Count
the values are correct.
But when I try to see for example the name of my first user field inside PriceList by doing
oItem.PriceList.UserFields.Fields.Item(0).Name
I obtain a value that does not correspond with the user field name I just added (in the DB it is correct)
I recomend you to open a CSN message for it and ask why does it happen.
I also don't know why inside B1 application we have no possibility to add a user field to the PriceList inside the Items. Maybe you can ask for it at the same time to support.
Please let us know what do they answer you.
Regards
Trinidad.
My Fields are created at my addon startup:
Columns = new B1DbColumnEBS[] {
new B1DbColumnEBS("ITM1", "I001", "Description1", BoFieldTypes.db_Float, BoFldSubTypes.st_Rate, 9, new B1WizardBase.B1DbValidValue[0], "1",""),
new B1DbColumnEBS("ITM1", "I002", "Description2", BoFieldTypes.db_Float, BoFldSubTypes.st_Price, 9, new B1WizardBase.B1DbValidValue[0], "0","")};
On update I get the following error:
'1' is not a valid value for field 'overwritten'. The valid values are 'Y'-'Yes', 'N'-'No'
This error makes me think I am not targeting the right fields...
Am I using the right object to access these fields (oItems.PriceList)?
Rgds,
Emmanuel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
7 | |
6 | |
3 | |
3 | |
3 | |
3 | |
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.