cancel
Showing results for 
Search instead for 
Did you mean: 

DI API : user table and code primary key

Former Member
0 Kudos

Hello,

When a user table is created SAP add 2 fields ( Code and Name ) automatically. Code seems to be the primary key. But when filling the table does it exist a way to have an automatically id for this code field.

Do I have to generate by code an id ?

( I thought it would be easy but code is 8 characters type not enough for me !)

Thanks,

Romeo.

Accepted Solutions (1)

Accepted Solutions (1)

jacintha_murphy
Explorer
0 Kudos

Hi,

the field length of the udf code field will be changed from 8 to 20 characters in version 6.7. This should help with development.

kind regards

Jacintha Murphy

Business One SDK Support

Answers (2)

Answers (2)

Former Member
0 Kudos

yes those fields are required and must be unique, what we have done in the past was just either have the code you are writing manage the autoincrementing of them or use some hybrid number off of a datetimestamp. and then put another userfield on the table and manage your true key on that field. not the best way but it works, not really sure what the sap guys were thinking when the made it function that way, maybe if they are reading they can post how they envisioned it to work.

Former Member
0 Kudos

Hi,

Are you talking about filling the table from inside SBO?

I don´t think is possible the ID to be filled automatically.

Have you try to use a formated search? I think would be possible to get previous ID from the matrix and define next value, all of it in the select clause.

It´s only an idea, but could work.

Regards,

Ibai Peñ

Former Member
0 Kudos

Hi,

Code should be numeric as far as I know.

I agree that these two automated fields do not make much sense for professional use.

However, by these fields SAP makes sure that the average user always has to use a primary key with a table.

I just wished that the name field was longer that 8 characters.

;(

Lutz Morrien

Former Member
0 Kudos

Hi again,

I have made some tries to change this functionallity, but no way.

1- I have try to add a user table created outside SBO, by adding a register in the OUTB table. It shows the table in SBO, but is not posible to add values, gives an error.

2- I have try to change the code field type from a user table created inside SBO, using SQL Server. I try with an autonumeric integer, but although shows all fields, gives an error when I try to insert data(or insert an empty value.)

3- I have finally try to change the size of Code field. The field length is verified in the client, so gives an error (no more than 8 characters allowed).

4- I cease

As Lutz said, this 2 fields makes no sense for developer.

Regards,

Ibai Peñ