Auto Increment of Primary Field in Table Maintainance

Hi,
We want to give an Auto increment to the Primary Key, when ever the table is updated/inserted with a new record. How to get the value updated????
For Eg,
Table ZTEST Contains     MANDT, ITEM,   EBELN.
It should have the values 800    001   000977
And when the next record is created, the ITEM value should be Automatically get the value 002.. and so on for every Record.
Pls do let me know if any other details is reqd.
Thanx in Advance.
Ajaz

Dear Syed,
   You can do many things in table maintenance screen like validation of some field, making some field required or displayed etc.
   For auto increment you have to use Number-Ranges. FM NUMBER_GET_NEXT is helpful in this case.
   Where to write the code??? The Function-Group you have made. There will be includes. You can easily locate the place to write these codes.
   Caution point is that if you re-generate the table maintenance then all code will be gone.
Regards,
Deva.

Similar Messages

  • How to get the auto increment integer primary key value of a new record

    I have a DB table that has a auto increment integer primary key, if I insert a new record into it by SQL statement "INSERT INTO...", how can I get the integer primary key value of that newly created record?

    Well maybe someone knows a better method, but one workaround would be to add a dummy field to your table. When a new record is inserted this dummy field will be null. Then you can select your record with SELECT keyField FROM yourTable WHERE dummyField IS NULL. Once you've got the key number, you then update the record with a non-null value in the dummyField. Bit of a bodge, but it should work...
    Another alternative is, instead of using an Autonumbered key field, you could assign your own number by getting the MAX value of the existing keys (with SELECT MAX(keyField) FROM yourTable) and using that number + 1 for your new key. Might be a problem if you have lots of records and frequent deletions though.

  • Auto Increment of primary key value in jdeveloper.

    hi all,
    i have one table with one primary key.
    i want to increment that primary key when ever i go for CreateInsert or create operation in JSF page.
    i have tried with db sequence value type, but i was not able to achieve my condition. in DB Sequence i got error like cannot convert java.class.string to java.class.dbsequence.
    can any one suggest me in this to achieve my condition.
    regards,
    M vijayalakshmi.

    hi all,
    from this i found the simple method to achive the auto increment of primary key.
    http://www.techartifact.com/blogs/2012/10/adding-number-for-primary-key-in-oracle-adf-using-groovy-by-sequence.html#ixzz2EeU9CWo6
    in this am facing an one small issue.
    intial value of the primary key is 1.
    for this value i have entered the row of data.
    again i have clicked on the create button.
    then the value of the primary key has increased to 2.
    for this value i didnt entered the row of data to databse.
    just i closed the browser.
    if i run the run page again, the value of primary key is 3.
    my requirment is i shd get the value of primary key is "2".
    the increment shd happen the maxi value present in the primary key of the table.
    can any one help me in this how to achive this.
    thanks in advance.
    regards,
    M vijayalakshmi.

  • Auto Incrementing in Text Field

    I imported a tab file and one column was the city, state and zip code. For some reason, the Zip code auto increments. It just so happened that the first cell was Durham, NC 27701. All subsequent cells incremented the Zip code by one, so the second cell became Durham, NC 27702. I have tried making the column a text field, and that did not work. I do not find any formula in the field, so am at a loss as to how to prevent the auto-incrementing from hapening.

    rha3675 wrote:
    Which Vallauris is your home city? Provence, or Pyrenees?
    None, Vallauris is not in Provence but in 'Provence-Alpes-Côte-d'Azur'
    At this time there is a great discussion about this name.
    Some wish to change it because they think that thge acronym PACA is not their cup of tea.
    Given that, inhabitants of "Provence" refuse to drop "Provence",
    inhabitants of "Alpes" refuse to drop "Alpes",
    inhabitants of "Cote d'Azur" refuse to drop "Cote d'Azur".
    My own advice is simply : don't use an acronym !
    I searched heavily and din't find a Vallauris in Pyrénées.
    The only town whose name approach is :
    I just found :
    Valaurie
    Code postal: 26230
    Département: Drôme
    Région: Rhône-Alpes
    Vallauris sits between Cannes and Antibes.
    Yvan KOENIG (VALLAURIS, France) mardi 2 février 2010 17:45:21

  • Drop down list for a field in table maintainance

    Hi,
    I have created a table maintainance for ztable. I need a drop down list for field so that user can select values present in the list while giving entries.
    I can not use fixed values in domain, because feild length is more and it wont fit into fixed values.
    I am trying to use VRM_SET_VALUES FM but not getting output. Can any one help me on this.
    Thank you,
    Regards,
    Kusuma K.

    TYPE-POOLS: vrm.        Include this in your program
    DATA: l_name  TYPE vrm_id,
          l_list  TYPE vrm_values,
          l_value LIKE LINE OF l_list.
      LOOP AT it_paym INTO w_paym.
        l_value-key = w_paym-pay_method.
        l_value-text = w_paym-text.
        APPEND l_value TO l_list.
      ENDLOOP.
      l_name = 'Table-field'.   change it as per your requirement this has to be perfect
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = l_name
          values          = l_list
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Hope it helps you,
    Abhijit G. Borkar

  • Auto Increment Sequence Custom Field

    Hi All,
    I was wondering if it is possible
    to have a custom field defined as an auto incrementing sequence number?  E.g. Let’s say I go in and create a project for the first time, this field will show the value 1.  The next project I go to create, the field shows the value 2 etc. etc. 
    If possible, how can this be implemented using customization?  Can it be done in Project Online?  Any help would be greatly appreciated.  thank you!

    Hi JSimoni1,
    You can generate a project unique ID using a webpart, even with Project Online.
    Please find below the procedure in EpmExpert blog:
    http://epmxperts.wordpress.com/2012/05/21/generate-unique-id-for-project-using-a-webpart/
    Note that the code might need some adjustments to stick to your business need.
    Hope this helps,
    Guillaume Rouyre, MBA, MCP, MCTS |

  • Creating auto increment custom metadata field in UCM

    Hello,
    Can anyone tell how to create a metadata Integer field with Auto Increment option?
    Also while creating users, I have a custom Department field. I want this field to be displayed in my profile. How can i achieve this?
    Richa

    SHort of paying someone else to do the work for you I am afraid there is no shortcut.
    However writing a component need not be difficult or complex if you take a sensible approach.
    There are some excellent blogs out there, at least one comprehensive book and even the documentation will get you started
    http://download.oracle.com/docs/cd/E10316_01/cs/cs_doc_10/documentation/developer/sdk_getting_started_10en.pdf
    I recommend you get Bex's book and you should be able to get a new component like this up and running in a day or two.
    Tim

  • Populating Quantity fields in Table Maintainance generator Events.

    Hi all,
    I have a custom table, in that i have to check the material number and the quantity of the previously present entries and current entry which i am adding in the before save event.
    However in the total table.... The value of material is getting populated correctly but the value of the quantity is not the actual one which i have entered, It is taking the value 0.00 at runtime.
    Please suggest me the approach when we have to deal with the Quantity fields in the table events.
    Thanks in advance for your help.
    Regards,
    Anuja

    Hi,
    The reference for the Quantity field is provided in the Custom table. However the value of the Quantity is taken as 0.00 at run time.
    Please refer to the below code.
    LOOP AT total.
        IF <action> EQ space.
          l_wa_temp-matnr = total+3(18).
        l_wa_temp-bmenge = total+95(13).
          APPEND  l_wa_temp TO l_i_temp.
          CLEAR l_wa_temp .
        ENDIF.
      ENDLOOP.
    however the  l_wa_temp-bmenge is getting populated as 0.00 however the actual value entered for it is 10
    Regards,
    Anuja

  • Searching non-key fields in table maintainance

    Hi..
    How to find non-key fields or how can we enble the FIND button in maintaince table ?
    Please reply....
    Thanks ...

    Hi,
    When you are on the table maintenance screen, you can :
    1. Goto menu options. Selection-->By Content
    2. Choose the fields you want to search data on and Press enter
    3. Enter the operator and the value  (you can append or insert a new field here as well )
    4. Click on the choose button.
    regards,
    Advait

  • Does all RDBMS support auto-increment field?

    Hi,
    I am designing a java application in which I have to write some logic to auto-increment one database field. Can anyone tell me that all the databases support the auto-increment fields.
    Thanks in advance.
    Chris

    There seem to be two kinds of facility for this in databases. One kind has an auto-increment field. Unfortunately they aren't consistent about how you obtain the value just created after an insert (which you almost invariably require to know). Generally you use a select statement to pick up the value of some kind of last row index function, but the name and syntax varies.
    The other kind uses a separate object in the database called a SEQUENCE. You create this with a CREATE SEQUENCE statment, and generally you reference nextval(sequence_name) in the default attribute of the database field.
    To get the last allocated sequence number you use select currval(sequence_name)
    Again the syntax is a bit inconsistent. You should also probably use transaction isolation if someone else might be incrementing the same sequence.

  • Auto increment with collection is not working

    I am using KODO 3.0 with MYSQL 4.0.16. I have created two JDO object as
    follows
    BankAccount contains a collection of Contacts object. My metadata looks
    like this
    <class name="BankAccount">
    <field name="contacts">
    <collection element-type="Contacts"/>
    <extension vendor-name="kodo" key="element-dependent"
    value="true"/>
    </field>
    </class>
    <class name="Contacts" objectid-class="Contacts$contactId">
    <field name="contactId" primary-key="true">
    <extension vendor-name="kodo" key="jdbc-auto-increment"
    value="true"/>
    </field>
    </class>
    There is no problem in the persisting of BankAccount object and adding
    Contacts to it, but Contacts collation is not retrieved along with parent
    object. In the database join table, the contact Id value it is always set
    to null.
    Things are working well with out contact id in Contacts.
    Can anyone help?
    Regards,
    dharmi

    Set the following property:
    kodo.jdbc.AutoIncrementConstraints: true
    Described here:
    http://www.solarmetric.com/Software/Documentation/latest/docs/ref_guide_pc_oid.html#ref_guide_pc_oid_pkgen_autoinc

  • How to auto increment a NUMBER(10) datatype

    Anyone know the syntax on how to auto increment a number field every time a new row comes in?
    TIA
    CREATE TABLE loc_color_group_values(
         ID number(10) NOT NULL auto_increment, <----------------
         COLOR_CODE_ID number(10) default 0,
         PROD_LOC_ID number(10) default 0,
         COLOR_GROUP_CODE_ID number(10) default 0,
         PRIMARY KEY(ID)
    );

    Here is an example:
    CREATE OR REPLACE TRIGGER "EXAMPLE_TRIG" BEFORE
    INSERT ON "loc_color_group_values" FOR EACH ROW BEGIN
      IF :NEW.id IS NULL THEN
        SELECT loc_color_group_values_seq.nextval INTO :NEW.id FROM dual ;
      END IF;
    END ;This allows you to overide the sequence without having to disable the trigger.

  • HSQL DB Identity & Auto Increment

    We are trying to write records to this table:
    create table location_groups
    group_id identity
    ,jdoversion integer
    ,jdoclass varchar(255) default 'path.impl.LocationGroup' not null
    ,group_name varchar(100) not null
    ,group_parent_id integer
    Package.jdo is:
    <package name="path">
    <class name="LocationComponent">
    </class>
    </package>
    <package name="path.impl">
    <class name="LocationGroup" persistence-capable-superclass="path.LocationComponent">
    <!--<extension vendor-name="kodo" key="jdbc-field-map" value="one-one"/>-->
    <extension vendor-name="kodo" key="jdbc-auto-increment" value="true"/>
    <field name="children" persistence-modifier="persistent" default-fetch-group="true">
    <collection element-type="path.impl.Location"/>
    </field>
    </class>
    and package.mapping is:
    <package name="path">
    <class name="LocationComponent">
    <jdbc-class-map type="horizontal"/>
    </class>
    </package>
    <package name="path.impl">
    <class name="LocationGroup">
    <jdbc-class-map type="base" pk-column="GROUP_ID" table="LOCATION_GROUPS"/>
    <jdbc-version-ind type="version-number" column="JDOVERSION"/>
    <jdbc-class-ind type="in-class-name" column="JDOCLASS"/>
    <field name="path.LocationComponent.name">
    <jdbc-field-map type="value" column="GROUP_NAME"/>
    </field>
    <field name="children">
    <jdbc-field-map type="one-many" table="LOCATIONS" ref-column.GROUP_ID="GROUP_PARENT_ID"/>
    </field>
    </class>
    </package>
    I have tried all manner of configurations but the error remains the same:
    25-Apr-2008 16:05:24 com.ea.albt.infrastructure.persistence.jdo.JDODataStore BeginTransaction
    CONFIG: Starting transaction
    25-Apr-2008 16:05:24 com.ea.albt.infrastructure.persistence.jdo.JDODataStore updateObjects
    FINE: Updating object ALBT Loc1209135924484 (has not yet been persisted)
    25-Apr-2008 16:05:25 com.ea.albt.infrastructure.persistence.jdo.JDODataStore updateObjects
    WARNING: Failed to persist/update objectALBT Loc1209135924484
    kodo.util.FatalDataStoreException: Attempt to update the sequence table "JDO_SEQUENCE" failed. The sequence table is typically created when you run the mappingtool's refresh action on any datastore identity class. If you have not run the mappingtool but want to create the sequence table, run:
    java kodo.jdbc.schema.DBSequenceFactory -action add
    NestedThrowables:
    Why is Kodo trying to use the jdo_sequence table when we want it to use the HSQLdb identity field ?

    We have many users using single field identity and auto-increment together.

  • Regarding auto increment

    how can i auto increment the number in my table while inserting the data

    Good point. If any error occurs during insertion -
    the sequence will be broken. Bucause, even if your
    transaction failed sequence will generate the new
    sequence number. But, as a result of that error -
    insertion won't be taken into place. Thus, break your
    continous chain.It is probably good point (depending on requirements) irregardless of that.
    Sequences ARE NOT for CONTINUOUS number generation.
    Sequences ARE for UNIQUE number generation.
    Continous chain will break also at least rollback (always) and DB restart as well (unless you haven't specified sequence as nocache which generally is silly idea).
    Gints Plivna
    http://www.gplivna.eu

  • Auto increment option

    Is there any option for auto increment the values in the tables. for example if we are inserting 100 data's for first data i should specify 1 and for second data it should specify 2 and goes on.

    Hi,
    Use Sy-tabix in between loop and endloop.
    or sy-index = sy-index + 1.
    Check this Example.
    TABLES:MARA.
              Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    RANGES:S_MATNR FOR MARA-MATNR.
    SELECTION-SCREEN END OF BLOCK B1.
    INITIALIZATION.
      S_MATNR-LOW = '000000000000000001'.
      S_MATNR-HIGH = '0000000000001000'.
      S_MATNR-SIGN = 'E'.
      S_MATNR-OPTION = 'BT'.
      APPEND S_MATNR.
      CLEAR S_MATNR.
                Internal Table
      DATA:BEGIN OF ITAB OCCURS 0,
           MATNR LIKE MARA-MATNR,
           ERSDA LIKE MARA-ERSDA,
           ERNAM LIKE MARA-ERNAM,
           NTGEW LIKE MARA-NTGEW,
           END OF ITAB.
                Start of Selection
    START-OF-SELECTION.
      SELECT MATNR
             ERSDA
             ERNAM
             NTGEW FROM MARA INTO TABLE ITAB WHERE MATNR IN S_MATNR.
      LOOP AT ITAB.
        WRITE:/ SY-TABIX,ITAB-MATNR.
      ENDLOOP.

Maybe you are looking for

  • Boot up iMac Intel. Kernal Panic can't boot up computer??

    I'm fixing my friend iMac Intel first generation Dual Core 32 bit. Not the lastest one. Since I know more of him with macs. My friend trip off the power cord of his imac by accident one morning and when he put the cord back in to the imac to power up

  • PDF-standard in osx: PDF/  X-4:2008?

    To send print online to my printer-service, they require a pdf-standard called pdf/x-4:2008 (the x stands for exchange they say. does not really say anything ...). I am a typical Mac-user, and don't really like these kind of specs ... To me, exportin

  • Bleed - not sure how to use it

    Hi everybody I would like to use the option to add 3mm bleed to my document. But when I export as pdf the bleed is gone. But my printing company needs the document with the bleed. Until now I just added the 3mm to the document size. That worked fine,

  • Creating a dynamic content link in Eloqua HTML editor

    I'm using dynamic content to populate a link on an HTML landing page. I drag and drop the dynamic content, and the following code shows up: <a href="<span title="Dynamic Content - Member Station Donation Page URL" elqid="18" elqtype="DynamicContent"

  • How to open a link created from a document on my Mac?

    I used the old Page to create a list of recipes in which i inserted links to the files kept in my laptop. So everytime i wanted to cook something, i just opened the listing file and click on the recipe(s) i want and got dirrected to the recipe(s). Bu