Skip to Content
author's profile photo Former Member
Former Member

DI API : user table and code primary key

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.

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    Posted on Jul 05, 2004 at 10:52 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 25, 2004 at 08:59 AM

    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ñ

    Add a comment
    10|10000 characters needed characters exceeded

    • 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ñ

  • author's profile photo Former Member
    Former Member
    Posted on Jul 04, 2004 at 01:24 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.