on 06-08-2017 11:00 AM
hi
I am trying to Insert Data into User defined Table in Database.
I wrote like this
SAPbobsCOM.UserTable oUserTable; oUserTable = Ocompany.UserTables.Item("U_Registrations"); oUserTable.UserFields.Fields.Item("RowId").Value = 1; oUserTable.UserFields.Fields.Item("Name").Value = txtName.Text; oUserTable.UserFields.Fields.Item("ContactNo").Value = txtContactNo.Text; oUserTable.UserFields.Fields.Item("DOB").Value = txtDOB.Text; oUserTable.UserFields.Fields.Item("Age").Value = txtAge.Text;
oUserTable.Add();
I am getting error : Invalid field name error in this line
SAPbobsCOM.UserTable oUserTable; oUserTable = Ocompany.UserTables.Item("U_Registrations");
how to resolve this.can any one suggest me?
User tables (UDT) need to be created via DI or client app. Manually created tables cannot be accessed in this way.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
yes Ankit.It's correct.I created "U_Registrations" table manullay in Sqlserver SBODemoIN Database.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
What do you mean by manually? You should create the table from SAP Business One Client or using DI API having following types:
1. No Object Type
2. Master Data
3. Master Data Rows
4. Documents
5. Documents Rows.
Only after that you will be able to use the above mentioned code. Also creating the tables manually from SQL Server can cause the Database Upgrade Failure.
Hope it helps!
Kind regards,
ANKIT CHAUHAN
SAP SME Support
Hi,
I think you are providing the TableName or FieldName incorrect. You have provided the TableName as "U_Registrations". Is it correct?
Kind regards,
ANKIT CHAUHAN
SAP SME Support
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prasanna,
I believe that Ankit's answer will solve your problem, all user tables starts with @ not with U_.
But I would like to suggest you read this blog and see an option how to abstract your actions on user defined tables "https://blogs.sap.com/2016/01/23/building-your-framework-to-work-with-sap-b1-part-1/"
Kind Regards,
Diego Lother
User | Count |
---|---|
85 | |
7 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.