Automatically generate sequential record number field for Z table

Hi Experts,
I have a Z table that I would like to add a "record_number" field to, because we are having an issue with duplicate entries not being created in the table.  Is there a way to add that field to the z table and have the system automatically assign a value when the insert statement is made?
Thanks
Shane

Hi Shane,
You can use the transaction SNUM to create a number range for your custom table. You can assign your invervals to whatever limit you would like. Once you create this range you can then call the function module below to get the next number before the insert (lv_object is the name of your number range and lv_number will export the next sequential number)
  CALL FUNCTION 'NUMBER_GET_NEXT'
    EXPORTING
      nr_range_nr                      = '01'
      object                                = lv_object
    IMPORTING
      number                              = lv_number
    EXCEPTIONS
      interval_not_found            = 1
      number_range_not_intern = 2
      object_not_found              = 3
      quantity_is_0                     = 4
      quantity_is_not_1              = 5
      interval_overflow              = 6
      buffer_overflow                = 7
      OTHERS                             = 8.
  IF sy-subrc <> 0.
  ENDIF.
Six

Similar Messages

  • How to set a field that automatically generates a unique 'code'/'ID'  for fillable PDF form?

    Hi,
    I'm trying to create a PDF fillable form with Acrobat X Pro.
    Can Acrobat allow a function, so that it can automatically generate a 'number'/'code' which I could use as an 'identifier'?
    eg.  A hidden field named:  'DOC ID' and provide 100001 when added to response file as it's submitted and '100002' to another file when it another is submitted/added onto the response file etc...
    I am aware that Response files, if submitted correctly, could automatically generate numbers like 001, 002 etc...
    But I'd like to see if I could create a field, that 'numbers' the document for me automatically and uniquely.
    Any help and/or suggestions would be appreciated.
    Winnie

    Hi,
    to do this you need kind of interactivity in your form.
    You can achieve this either by:
    1) using JavaScript onchange-events on forename and surname items, or
    2) use the AJAX Computations option of ApexLib, see: http://www.oracle-and-apex.com/ajax-computations-rich-client-feeling/
    brgds,
    Peter
    Blog: http://www.oracle-and-apex.com

  • Data Record Number Field in PSA

    Hi,
    There is a field " Data Record Number" in every PSA. This field is howeven not part of the DataSource.I need to bring a counter like this into the Cube that counts all unique records (i need to setup a COUNTER using a unique key). Is there a way of doing that?
    Thanks

    Hi davy,
    To get counter of records,
    you have to write a routine.
    so for this make an infoobject of name counter and add this field to your cube.
    then go to update rule and write update routine for the above infoobject like
    if condition is true
    result = 1
    else
    result = 0.
    the sum of all 1s will give the no. of records.
    Hope this will help you.
    thanks.
    Saurabh Jain.

  • Offset for Vendor Account Number(field VENDR) in table BSED

    Hello experts,
    I need to know the Offset where i can find the Vendor Account Number in field VENDR in the table BSED.
    This field is used for Localisation for TURKY in Reports like RFIDTRBOE1, RFIDTRBOE2.
    Thanks in advance!
    Regards,
    Sandeep

    Hi,
    Table LFA1 and ADR6 are right but in query, these tables will not be linled by system authomatically.
    You have to link these table manually by using field ADRNR in table LFA1 and field ADDRNUMBER in table ADR6.
    I hope it will resolve the issue.
    Regards,
    Vinod

  • Create Store Procedure to Count Number of records in Database for each table

    Hello,
    I have created the code which counts the number of records for each table in database. However, I want create store procedure for this code this code that when ever use execute the Store Procedure can provide the database name to execute it and as a result
    table will display number of records in each table.
    Below you will find the code its working:
    CREATE
    TABLE #TEMPCOUNT
    (TABLENAME
    NVARCHAR(128),
    RECORD_COUNT BIGINT)
    -- Creating a TEMP table
    EXEC
    sp_msforeachtable
    'insert #tempcount select ''?'', count(*) from ? with (nolock)'
    SELECT
    * FROM
    #TEMPCOUNT
    ORDER
    BY TABLENAME
    DROP
    TABLE #TEMPCOUNT
    This code need to be convert in store procedure and user can give database name when execute the procedure in order to count the records.
    Looking forward for your support.
    Thanks.
    SharePoint_Consultant_EMEA

    Something like:
    set quoted_identifier off
    go
    create procedure usp_TableCounts
    @DBName as varchar(1000)
    as
    set nocount on
    declare @SQLToExecute varchar(1000)
    CREATE TABLE #TEMPCOUNT (TABLENAME NVARCHAR(128), RECORD_COUNT BIGINT) -- Creating a TEMP table
    set @SQLToExecute = @DBName + ".dbo.sp_msforeachtable 'insert into #tempcount select ''?'', count(*) from ? with (nolock)'"
    print @SQLToExecute
    exec (@SQLToExecute)
    SELECT * FROM #TEMPCOUNT
    ORDER BY TABLENAME
    DROP TABLE #TEMPCOUNT
    GO
    Satish Kartan www.sqlfood.com

  • Using number field for date

    Hi,
    I have a number field that contain a date (YYYYMMDD). In my report I must show the date in the format DDMMYYY.
    Please, help me.
    TIA, Alex
    null

    Hi,
    You can also change your query...
    Instead of the column you are using, use
    to_char(
    to_date(
    ltrim(
    to_char(<date_field>)
    , 'YYYYMMDD'
    , 'DDMMYYYY'
    Hope this helps

  • Custom fields for FV50 table control

    Hello,
    The customer has a requirement to add 3 text fields to the table control in Transaction FV50. These fields are currently not available in the table control at all (I checked the Table settings Administrator). Further, no Screen/Transaction Variant has been implemented either to prevent these fields from being displayed. Which is why I'd like to find a way to add these custom fields to this table control. These fields are the text descrptions for the numeric fields Cost Center, Fund and Business Area.
    I've read many posts on this forum regarding potential solutions including the link below which details the SAP std solution. Only problem is this approach adds these fields to the data dictionary tables underlying the screen. The customer says about 1 million records are being generated a month so they would rather not have all that extra data at the line item level.
    Custom column for FB60
    If anybody has done this sort of thing via a user exit I'd much appreciate your input.
    Thanks,
    Tarun

    Hi Rob,
    Yes, I checked IMG configuration and found that Txn OXK3 allows us to extend the underlying tables and customize the generic fields in the table control. However, the client  has nearly 1 million postings to table BSEG each month and I'm guessing this approach will entail adding the custom fields to table BSEG, which won't work for them. I haven't actually tried this approach because the SAP documentation has some dire warnings about proceeding. But if you have any insight as to whether this can be achieved without extending BSEG (possibly just extend VBSEGS??) that would be very valuable.
    Thanks,
    Tarun

  • Generate different Supplier Number Sequence for One Operating unit!

    R12.1.2
    Dear Gurus,
    We run multiple operating units under one Business Group and each of them are independent entities of their own with separate ledgers and currencies based on the territories.
    We generate Supplier numbers automatically for all territories.
    But, now we have a requirement from one of the territories that we need to generate supplier numbers in a different sequence (starting from 40000000000 onwards) just for that territory. We still would like to generate supplier numbers for the other operating units (territories) using the standard sequence.
    Is this possible? If yes, please give details.
    Thanks,
    -Venkat

    Hi Venkat,
    Supplier Numbering configuration is not operating unit specific, hence the same numbering would continue to happen in the environment/application instance ...
    The workaround would be turn off Automatic and switch to Manual numbering and check with the feasibility of having a customization and Personalization for meeting the requirement ....
    Reference:
    How is Supplier Number assigned in R12? [ID 1252934.1]
    Regards,
    Ivruksha

  • Multiple address number fields on a table

    Hi.  I have a Z table which had an address field ADRNR data element AD_ADDRNUM.  When maintaining the table via SM30, there is a function button "Address" to maintain this field.  I have just added a second address field ZCRED_ADRNR data element AD_ADDRNUM.  Now every time I try to maintain these addresses via the function button in SM30, I get a message "Address for object ... not found.  Do you want to create a new address?"  If I choose to create a new address, the address number in ADRNR is changed (eg from 0700264579 to 0700264580) and the address number in ZCRED_ADRNR appears as @NEW000000 - even though I only got one "Edit Address" popup.  If I look on table ADRC there is a record for the old address from field ADRNR (0700264579) is there, plus the new one (0700264580) but there is no record for ZCRED_ADRNR (@NEW000000).
    Could anybody tell me what I've done wrong?

    Looks like somebody created some sort of check in your table maintenance via the predefined events for table maintenance. So try to find out in which event this check is triggered and why.

  • How not to consider a missing field for external tables

    My Oracle vers. is 10gR2
    I've created an external table using this syntax:
    create table ext_table
    (a number(5),
    b number(5),
    c varchar2(1000))
    organization external
    (type ORACLE_LOADER
    default directory FLAISTD
    access parameters (records delimited by newline
    fields terminated by "#"
    (a char(5),
    b char(5),
    c char(1000)))
    location ('file.csv')
    My problem is this. I've got a file.XLS that I save as file.CSV Sometimes any row of the file.XLS misses of the last column and so in my file.CSV I can have something like this:
    123#123#xxx
    456#456
    and when I try to perform a select * from ext_table I get an error because it expects a missing field.
    How can I do? Can I "say" in the create table above something for warning that the last field might miss?
    Thanks in advance!

    Solomon Yakobson wrote:
    Use TRAILING NULLCOLS:Oops, it is external table not SQL*Loader. So it should be MISSING FIELD VALUES ARE NULL:
    create table ext_table
    (a number(5),
    b number(5),
    c varchar2(1000))
    organization external
    (type ORACLE_LOADER
    default directory TEMP
    access parameters (records delimited by newline
    fields terminated by "#" missing field values are null
    (a char(5),
    b char(5),
    c char(1000)))
    location ('file.csv')
    Table created.
    SQL> select  *
      2    from  ext_table
      3  /
             A          B C
           123        123 xxx
           456        456
    SQL>SY.

  • Best way to generate one record per day from a table with eff/exp dates

    Hi,
    Have a table which has various attributes and an eff and exp date. e.g attributea, 01/05/2012, 16/05/2012
    We wish to create another table from this table to have one record per day. e.g 16 records.
    What is best way to achieve this in OWB ?
    Thanks

    Hi,
    Example if have table
    with following contents
    conversion_rate number(6,4)
    EFFEcTIVE_DATE DATE
    expiration_date date
    example record 1.43, 01/05/2012,16/05/2012
    If want to have another table which instead has 16 records one for each day
    e.g
    1.43, 01/05/2012
    1.43,02/05/2012
    1.43,16/05/2012
    Thoughts on best way to do this.
    Thanks

  • Reg : delta field for vbbe table while creating generic extractor

    hi
    i want to know which field should i use to do delta from vbbe table.
    do i have to ask my functional consultant for what field should ibe using or
    should i decide on my own
    your answer would be defintely rewarded
    thanks a lot
    pallavi

    Hi,
    I would suggest you to create a new sales document and try to find out how does it the new entry is entered in VBUK, VBUP, VBEP and VBBE tables. Also, try to change / modify and delete existing record and see the changes in the table. You need to check which date fields or any deletion indicator is set / modified or not. Do all this one by one and see the changes in the tables. Also, all these changes will be logged in change log table such as CDHDR and CDPOS. This will have all the history of changes for one sales document. Once you identify all this then it will be very easy for you to identify the delta fields. The other way is to speak to functional consultant and ask him how all these tables are affected when you change / modify / add / delete records.
    Hope this helps.
    PB

  • BAPIs: Determine Required fields for Structure/Table

    I understand how to determine if a structure or table is a mandatory import parameter, but how can I determine which fields are mandatory inside the  structure or table?
    Thanks for the help

    Hi David
       I imagine that you are calling a BAPI by Java and you want to know what fields you need to fill to call a BAPI correctly , for check what fields are mandatory, entry to R3 and call se11 transaction in table textbox fill the name of your table and click enter, so appear in the screen the table definition there is a column that is CLV or KEY, depence of your language is the the second column, all the fields that are checked are mandatories.
    Regards is helps you
    Josue

  • How to Populate a Dropdown field for a table control with different keys

    Hi All,
    I have Table control with abt eight columns (fields). Out of these eight field one field is with dropdown list. In table control Project ID is Primary key column. Depending upon this Project ID value, i have different values which is to be populated in dropdown boxes. In table control if there is only one project ID value say 'P000715' i can populate it but when i have more than one project ID (P000715, p000716, P000717.....) in display in rows of table control i want to have different values in my dropdown field corresponding to that row of project id. Experts please tell me how to achieve this functionality.
    Thankx in Advance
    Rizwan Ahmad Siddiqui

    The only way you may be able to do this is using
    MODULE PROCESS ON VALUE-REQUEST. User-programmer F4 help
    in your PAI routine.
    In this routine you would build the list and get the returned value to update the field.
    Something like this.
      DATA: BEGIN OF value_tab OCCURS 0,
        field1 TYPE zlmltype,
        field2 TYPE zltypex,
      END OF value_tab.
    * Drop down values
      REFRESH it_return_tab. CLEAR it_return_tab.
      REFRESH value_tab. CLEAR value_tab.
      SELECT ltype ltypex
        INTO TABLE value_tab
        FROM zlmltyp
        WHERE auth NE '9'.    "System Only
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
           EXPORTING
                retfield   = 'FIELD1'
                value_org  = 'S'
           TABLES
                value_tab  = value_tab[]
                return_tab = it_return_tab.
      READ TABLE it_return_tab INDEX 1 INTO wa_return_tab.
      CHECK sy-subrc EQ 0.
      p_pleadtyp = wa_return_tab-fieldval.

  • Creating selection field for a table

    hi all,
    i want to create a table with n numbr of fields and it is mentioned that i need to create selection parameters with some fileds, how can i do this?
    thanks,
    Poonam

    Poonam Naik wrote :
    what is SCN?
    SAP COMMUNITY NETWORK

Maybe you are looking for