on 10-18-2018 6:40 PM
Good morning experts,
I have a no object table named D_OGDR with several fields, one of them is called CAINumber
I tried on demo databases and gives no error, I tried on many scenarios on my client's database and sometimes gives the error Invalid Field Type, and sometimes it doesn't.
My SAP version is 9.20.190 PL:09
Here is my code
SAPbobsCOM.UserTable GdrTable = RefCompany.UserTables.Item("D_OGDR");
GdrTable.Code = LastNum.ToString();
GdrTable.Name = LastNum.ToString();
GdrTable.UserFields.Fields.Item("U_CAIDate").Value = MyDate;
GdrTable.UserFields.Fields.Item("U_CAINumber").Value = MyNumber;
Res = GdrTable.Add();
if (Res == 0)
{
//Success
}
I have checked
SELECT * FROM CUFD WHERE TableID = '@D_OGDR' and the fields seem to be good, also
select * from [@D_OGDR]
shows me the records the my code insert when it doesn't give the invalid field message
My SQL version is 2014
Hi Alfredo,
Usually with this error it will be thrown on the line that causes the error, before you even get to the add method. You may use debug step-through or a Try block to determine which field specifically is causing the error.
What is the data type of the MyDate variable, and what is the data type of the U_CAIDate field?
What is the data type of the MyNumber variable, and what is the data type of the U_CAINumber field?
Do the data types of the variables and their respective fields match?
If you have used alphanumeric for either field, the error may be thrown because of existing values of a different data type in either field. This is less likely in a demo database, so that might explain why it works there.
Regards,
Johan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It seems at some point variables start to lose their reference, so I had to call the function again that retrieves the values. Thanks for your help
User | Count |
---|---|
92 | |
11 | |
10 | |
6 | |
5 | |
5 | |
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.