Editing or creating a record for primary Key of a table in FORM

Hi,
i have to create a form using 10columns out of a 25column table...
one of the columns of this 10 is PRIMARY KEY.....
in the process of creating the form ...it is asking me for a primary key....when i select a column(out of 10) as primary key , i am not getting that primary key in the form.....
i am a newbie....please send some solutions to add primary key in a form so that it can be inserted or modified....
Thanks
raj

Hi,
When you create a form, you get a region and several items. If you look at your page definition, you will see these listed - the region will be called whatever name you gave it (eg, "Employee") and the items will be listed as Pnn_EMPNO, Pnn_NAME, Pnn_SALARY and Pnn_DEPT (nn = page number). The Pnn_EMPNO item will be shown as "Hidden and Protected". This means that the field is on the page but the user can not see it nor edit it.
When you create a new record, this field will be empty. When you edit an existing record, this field will contain the EMPNO value for that record. When you save a new record, this field is given a primary key value based on whatever method you specified when you created the form.
If you don't see the Pnn_EMPNO item, then the form has not been created correctly. Do you see this item on your page definition?
Andy

Similar Messages

  • Autonumber for Primary Key in Z Table

    Hi,
      I want to use an auto generated number as primary key for a Z table that i want to create. Is there some exiting data element tht I can use, so that I dont have to explicitly enter the primary key everytime i enter a record in SM30

    Hi,
    There is no automatically way of generating number...
    But You can create a number range object in the transaction SNRO.
    Then use the FM NUMBER_GET_NEXT to get the next number....
    Then assign that number using the event 05 "new entries" which you can set in the view TVIMF.
    Thanks,
    Naren

  • What is the best practice for creating primary key on fact table?

    what is the best practice for primary key on fact table?
    1. Using composite key
    2. Create a surrogate key
    3. No primary key
    In document, i can only find "From a modeling standpoint, the primary key of the fact table is usually a composite key that is made up of all of its foreign keys."
    http://download.oracle.com/docs/cd/E11882_01/server.112/e16579/logical.htm#i1006423
    I also found a relevant thread states that primary key on fact table is necessary.
    Primary Key on Fact Table.
    But, if no business requires the uniqueness of the records and there is no materilized view, do we still need primary key? is there any other bad affect if there is no primary key on fact table? and any benifits from not creating primary key?

    Well, natural combination of dimensions connected to the fact would be a natural primary key and it would be composite.
    Having an artificial PK might simplify things a bit.
    Having no PK leads to a major mess. Fact should represent a business transaction, or some general event. If you're loading data you want to be able to identify the records that are processed. Also without PK if you forget to make an unique key the access to this fact table will be slow. Plus, having no PK will mean that if you want to used different tools, like Data Modeller in Jbuilder or OWB insert / update functionality it won't function, since there's no PK. Defining a PK for every table is a good practice. Not defining PK is asking for a load of problems, from performance to functionality and data quality.
    Edited by: Cortanamo on 16.12.2010 07:12

  • Two Primary keys on one table

    We are at the end of completing a project and we ran into a last minute bug. We are using two primary keys on a table to form a unique key. The problem we have is the program hangs up and gives us the following error,
    ORA-20001: Error in DML: p_rowid=CUA, p_alt_rowid=SIT_ID, p_rowid2=, p_alt_rowid2=. ORA-01422: exact fetch returns more than requested number of rows,
    probably meaning we only have one key setup in the DML
    processing when our table has two.
    we created a process with the Primary key set up in the DML but how does the secondary key column value work and is that what it's used for,because we tryed with no success. Is there a way around this problem without having to change our table by inserting only one primary key.
    Thanks in advance.
    Garry

    I am facing a similar problem , I used the two primary keys for navigating to the form page (forms with reports) so that the form page may display distinct records.
    Its not posing any error but its not showing the value of other columns associated with that record.
    Only the columns contained in the page item in the form page , that's are used as primary keys or that have been specified in the navigation part of the report page, are being shown ,
    Like for example I have got 5 columns
    a,b,c,d,e out of which a and b are my primary keys .
    I am using these to fetch values in the form page of forms with reports.
    We can specify three keys at the most , in my case I am having two , if in place of the third key I specify some column then in the form page it displays the correct record details of the three columns specified( 2 keys and one simple column), and it doesn't displays the value of other columns.
    Please help me out of this .

  • How do I add a record's primary key to a query string and add that to an .xml catalog?

    Hello everyone,
    I am using Dreamweaver CS3 on a MacBook Pro Leopard 10.5.6 and MAMP 1.7. I am also teaching myself how to work with PHP and MySQL, using David Powers book The Essential Guide to Dreamweaver CS3.
    I am trying to create a wedding photography web site, with a personal page after login, which will display the photographs of the customers wedding.
    The same page will also be a catalog/shopping cart, so the customer can choose which photo's they want, and pay for them. (I am aware that there are instructions in The Essential Guide in chapter 15 page 515, on how to redirect to a personal page, but it doesn't fully cover what I am asking).
    I have already created the login success page, which greets users by name, as per the instructions in The Essential Guide. I have also created a catalog page. However my catalog page is not calling information from the database, instead it is taking information from an XML page using PHP.
    I would like to insert a list menu on the login success page, which lists the customers name, and when they select their name they will then select a link that will take them to a personal page with just their wedding photographs.
    I am unsure of how to pass the customer_id, in what will be the username list menu, to the page which will contain the customers set of wedding images.
    Is it the same process used in chapter 14 where you add a record's primary key to a query string?
    I am asking because when I set up a recordset from the MySQL database it lists the images as witten names not actual images, I have tried calling the images with PHP code but it just doesn't work.
    The catalog page I have set up at the moment is not calling the images from the database, but directly from the image folder.
    Is what I am trying to do possible?
    If so how do I pass the customer_id and username to a recordset and link that recordset to the xml catalog so the customers personal wedding images are displayed on the catalog page for the shopping cart?  I need step by step instructions, or maybe a link to a good tutorial.
    Can somebody help me please?
    Thankyou.

    QuickTime 7 can set the poster frame, but I've not had much success with it. This is what QuickTime 7 Help says about this topic:
    +A "poster frame" is a still image of a movie that represents the movie in places like the Finder. The default poster frame is the first frame in the movie. You can change the poster frame.+
    +To change a movie's poster frame:+
    +In QuickTime Player 7, drag the playhead (or use the arrow keys to move the playhead) to the desired frame.+
    +Choose View > Set Poster Frame.+
    +To view a movie's poster frame, choose View > "Go to Poster Frame."+
    If you don't have QuickTime 7 (version 7.6.6) it can be installed from your Snow Leopard disc using a custom install. Otherwise download it from this Apple site: http://support.apple.com/kb/DL923
    John

  • Propagate Properties option for Primary Keys?

    Hi,
    I have a physical model Oracle Database 11g created. I would like to change Using Index option from one value to another for most of primary keys in the model. Is there a way to do it? Additionally I would like to assign all primary key indexes to one tablespace.
    Now, I have to:
    1. Double click on one of the primary keys.
    2. Change Using Index option on General tab.
    3. Go to Using Index tab and select proper tablespace.
    All these steps have to be repeated for each primary key.
    Is there a way to do it once and propagate the change for all? There is similar option on indexes but I don't see it for primary keys.
    Arek

    Hi Arek,
    unfortunately there is no "Propagate Properties" functionality for primary keys.
    Philip

  • Creating a snapshot without primary keys

    Hi,
    I would like to create a snapshot for a table that does not have a primary key. I've read the thread
    "Re: creating snapshots without a primary key??"
    from Mar 24, 2003, which seems to indicate that this is allowed if the snapshot is not updatable. However, even when I disable the "Updatable?" option, I still get the following error:
    WTG-20502 Packaging Wizard Failed. 500
    CONS-10032: Publication item: WTGPI_10012 cannot
    be updatable, primary keys for xyz.abc not found.
    BTW, the Oracle9i Lite Developer's Guide for Windows 32 is really thin in this area. In particular, the description of the Updatable feature is the following:
    This check box defines the snapshot to be created
    as updatable.
    That description has a lot of unmet potential.
    Thanks,
    Tim

    Hello,
    If you create a snapshot that has no primary key, you have to check the option "complete refresh".
    Oracle uses the primary key to track changes for the "partial refresh" option (only send changes back and forth).
    -Antti Virkkunen, www.vilant.com

  • How can I obtain the primary key of a table for an entity relation?

    hello everybody
    I am doing a consultation to a table in my data base, good this table has alone two fields, the first one is the code or pk and the second one is the description, to be presisos they are names of city and code.
    From the beginning!!: This method this one in another class that is a Dialog that is going to call to the class SelecPlace ();
      SelecPlace sl = new SelecPlace();
    public void capturarLugar(){  //  Simple void method in the mentioned class
            String place = txtProcedencia.getText() ;  //  a JTextField
            sl.executeStatement(place) ;                  
        }ok, now we see part of the code of the class SelectPlace
    public class SelecPlace extends AbstractTableModel{
        Connection con = null;
        Statement sentencia = null ;
        ResultSet rs = null;
        ResultSetMetaData rsmd = null ;
        String[] nameColum = {} ;
        Vector datos = new Vector() ;
        public SelecPlace() { }
        public void executeStatement(String query){
          try{
             con = DBManager.getConnection() ;
             sentencia = con.createStatement(rs.TYPE_SCROLL_INSENSITIVE,
                                                                          rs.CONCUR_UPDATABLE) ;
             String sql = "select * from Place where descripcion like %"+query+"%'";
              rs = sentencia.executeQuery(sql) ;
              rsmd = rs.getMetaData();
              int nroColumnas = rsmd.getColumnCount() ;
              nameColum = new String[nroColumnas] ;
              //obtengo los nombres de columnas en cache
               for(int colum = 0; colum < nroColumnas; columna++){
                    nameColum[colum] = rsmd.getColumnLabel(columna + 1) ;
               datos = new Vector();
                while(rs.next()){
                    Vector newRow = new Vector();
                    for(int i = 0; i < getColumnCount(); i++){
                    newRow.addElement(rs.getObject("place_ID"));
                    newRow.addElement(rs.getObject("description"));
                    datos.addElement(nuevaFila);
                fireTableChanged(null);
            }catch(SQLException e){
                System.err.println(e);
                e.printStackTrace(System.err);
                System.out.println("error in statement");
            }catch(ClassNotFoundException cnfe){
                System.err.println(cnfe);
        }Ok, this code me works and I obtain in this case the field description of the table Place
    Now my question is, how can I obtain the primary field of my table?
    I need this value of this field that in the base of information in a bigint, and to take it to the first class before mentioned, for that I am working with a data base related

    Certain duffymo and everyone!!, good I give you my scheme:
    And generalizing my question, I want to obtain the value of the primary key of a table in the database, I obtain more values of the same row, but I need the primary key, and you see one with the primary key I want to turn a Long and it to insert with code java in foreign clave in another table of the database
    Good of this form I believe that it would not be breaking the integrity relacional of the tables

  • How to create a record for table PLAF with order type 'NB'.

    How to create a record for table PLAF with order type 'NB'(standard purchase order).
    who can tell me the T-code or some usefull information?
    Thanks.

    Hi
    This will be updated automatically when generate planned orders thru MRP. (MD02)
    regards
    Srinivas

  • If I have an EntityBean that mappes to two tables within one database, when I create that EJB, whoes reponsibilty to generate the primary key in database table? The RDBMS or EJB?

    If I have an EntityBean that mappes to two tables within one database, when I create
    that EJB, whoes reponsibilty to generate the primary key in database table? The
    RDBMS or EJB?
    Thanks,
    JW

    Refer to http://e-docs.bea.com/wls/docs81/faq/ejb.html/#257430
    "Jingwei Zhang" <[email protected]> wrote:
    >
    If I have an EntityBean that mappes to two tables within one database,
    when I create
    that EJB, whoes reponsibilty to generate the primary key in database
    table? The
    RDBMS or EJB?
    Thanks,
    JW

  • DB_GET_BOTH_RANGE fails when there is only one record for a key

    Using the DB_GET_BOTH_RANGE flag doesn't seem to work when there is a
    single record for a key.
    Here's a sample Python program that illustrates the problem. If you
    don't know Python, then consider this to be pseudo code. :)
    from bsddb3 import db
    import os
    env = db.DBEnv()
    os.mkdir('t')
    env.open('t',
    db.DB_INIT_LOCK | db.DB_INIT_LOG | db.DB_INIT_MPOOL |
    db.DB_INIT_TXN | db.DB_RECOVER | db.DB_THREAD |
    db.DB_CREATE | db.DB_AUTO_COMMIT)
    data = db.DB(env)
    data.set_flags(db.DB_DUPSORT)
    data.open('data', dbtype=db.DB_HASH,
    flags=(db.DB_CREATE | db.DB_THREAD | db.DB_AUTO_COMMIT |
    db.DB_MULTIVERSION),
    txn = env.txn_begin()
    #data.put('0', '6ob 0 rev 6', txn)
    data.put('0', '7ob 0 rev 7', txn)
    #data.put('0', '8ob 0 rev 8', txn)
    data.put('1', '9ob 1 rev 9', txn)
    txn.commit()
    cursor = data.cursor()
    print cursor.get('0', '7', flags=db.DB_GET_BOTH_RANGE)
    cursor.close()
    data.close()
    env.close()
    This prints None, indicating that the record who's key is '0' and
    who's data begins with '7' couldn't be found. If I uncomment wither of
    the commented out puts, so that there is more than one record for the
    key, then the get with DB_GET_BOTH_RANGE works.
    Is this expected behavior? or a bug?

    You can use the DB_SET flag which will look for an exact key match. If
    you use it with the DB_MULTIPLE_KEY flag, it will return multiple keys
    after the point it gets a match. If you can post here how all your
    LIKE QUERIES look, I may be able to provide you with the suited
    combination of the flags you can use for them.I'm not doing like queries. I'm using BDB as a back end for an object
    database. In the object database, I keep multiple versions of object
    records tagged by timestamp. The most common query is to get the
    current (most recent version) for an object, but sometimes I want the
    version for a specific timestamp or the latest version before some
    timestamp.
    I'm leveraging duplicate keys to implement a nested mapping:
    {oid -> {timestamp -> data}}
    I'm using a hash access method for mapping object ids to a collection
    of time stamps and data. The mapping of timestamps to data is
    implemented as duplicate records for the oid key, where each record is
    an 8-byte inverse timestamp concatenated with the data. The inverse
    timestamps are constructed in such a way that they sort
    lexicographically in inverse chronological order. So there are
    basically 3 kinds of query:
    A. Get the most recent data for an object id.
    B. Get the data for an object id and timestamp.
    C. Get the most recent data for an object id who's timestamp is before
    a given timestamp.
    For query A, I can use DB->get.
    For query B, I want to do a prefix match on the values. This can be
    thought of as a like query: "like <inverse-time-stamp>%", but it can
    also be modelled as a range search: "get the smallest record that is >=
    a given inverse time stamp". Of course, after such a range search,
    I'd have to check whether the inverse time stamp matches.
    For query C, I really want to do a range search on the inverse time
    stamp prefixes. This cannot be modelled as a like query.
    I could model this instead as {oid+timestamp -> data}, but then I'd
    have to use the btree access method, and I don't expect that to scale
    as I'll have hundreds of millions of objects.
    We tried using BDB as a back end for our database (ZODB) several years
    ago and it didn't scale well. I think there were 2 reasons for
    this. First, we used the btree access method for all of our
    databases. Second, we used too many tables. This time, I'm hoping that
    the hash access method and a leaner design will provide better
    scalability. We'll see. :)
    If you want to start
    on a key partial match you should use the DB_SET_RANGE flag instead of
    the DB_SET flag.I don't want to do a key partial match.
    Indeed, with DB_GET_BOTH_RANGE you can do partial
    matches in the duplicate data set and this should be used only if you
    look for duplicate data sets.I can't know ahead of time whether there will be duplicates for an
    object. So, that means I have to potentially do the query 2 ways,
    which is quite inconvenient.
    As you saw, the flags you can use with cursor.get are described in
    detailed here.But it wasn't at all clear from the documentation that
    DB_GET_BOTH_RANGE wouldn't work unless there were duplicates. As I
    mentioned earlier, I think if this was documented more clearly and
    especially of there was an example of how one would work around the
    behavior, someone would figure out that behavior wasn't very useful.
    What you should know is that the usual piece of
    information after which the flags are accessing the records, is the
    key. What I advice you is to look over Secondary indexes and Foreign
    key indexes, as you may need them in implementing your queries.I don't see how secondary indexes help in this situation.
    BDB is
    used as the storage engine underneath RDBMS. In fact, BDB was the
    first "generic data storage library" implemented underneath MySQL. As
    such, BDB has API calls and access methods that can support any RDBMS
    query. However, since BDB is just a storage engine, your application
    has to provide the code that accesses the data store with an
    appropriate sequence of steps that will implement the behavior that
    you want.Yup.
    Sometimes you may find it unsatisfying, but it may be more
    efficient than you think.Sure, I just think the notion that DB_GET_BOTH_RANGE should fail if
    the number of records for a key is 1 is rather silly. It's hard for me
    to imagine that it would be less efficient to handle the non duplicate
    case. It is certainly less efficient to handle this at the application
    level, as I'm likely to have to implement this with multiple database
    queries. Hopefully, BDB's cache will mitigate this.
    Thanks again for digging into this.
    Jim

  • Create BDC recording for position,job,role

    hi all,
    i want to create BDC recording for position,job,role . what is the transaction for creating postion,job, role?/??
    and i have to check wheather for one job , role is there or not? if not i have to create that role.. similiarly i have to check for position that there is corresponding job is there or not.. if not i have to create the job???
    how would i do that??
    thanks
    SAchin

    Hi Sachin,
    1) Creating BDC is an ABAP-ers job and being functional its not ur responsibility. If u really want to do that then u can do it through T.Code - SHDB.
             While creating BDC for Position u have to go through T.Cdoe - SHDB and in that give PP01 in the TRANSACTION CODE feild. Then go on for recording.  After that ask the help of an ABAP-er.
    2) To Check if a POSITION or a JOB is there, then Go to T.Code - PP01, under Obj Abbr. feild put S for POSITION and C for JOB and press enter after entering the POSITION and JOB id. U'll get the result. OK
    3) To check for ROLE, u have go to T.Code - PFCG and there check for the particular ROLE u r looking for. Here in this T.Code u can actually create, change and delete the ROLES.OK
    Hope this helps,
    ARNAV...

  • Primary key issue with adf Entry Form.

    Hi All,
    i'm using jdev version 11.1.1.5.0
    use case: i have create simple entry form based on Eo and Vo using database table like student(enrollment no,name address)
    where enrollment no is primary key.
    so when i have create a record i have set enrollment no in entity impl class of this eo create method using some logic based on my need like(20130001)
    for that i have read highest no from database field and assign to enrollment no field when user create record.
    so when user create record second time then enrollment no is 20130002. and other detail like name and address user fill and commit record. and it is fine.
    but problem is that when two user access same form at a time and create record so both have get same primary key like 20130003 because in current time in database maximum value is 20130002.
    so which user  commit record first it record will save on database and second user get error message because of primary key violation.
    so my question is that where we generate primary key value for record so when multiple user access form have get different primary key value. and in my use case i can't use sequence and any autoincrement no
    because i have patter for primary key.
    Thanks in Advance
    Manish

    Hi,
    Dimitar and Frank
    thank for reply.
    How can i apply non-concurrent DB lock can you please explain.(because lock method on entity impl not work when user create new row as per documentation)
    http://docs.oracle.com/cd/B14099_19/web.1012/b14022/oracle/jbo/server/EntityImpl.html#lock__
    i have write following line of code in entity impl class to set primary key value(reqid)-
        @Override
        protected void prepareForDML(int i, TransactionEvent transactionEvent) {
             super.prepareForDML(i, transactionEvent);
            this.setReqid(genReqid());
        public String genReqid() {
            String reqby = this.getReqby();
            String qry =
                "SELECT nvl(MAX(TO_NUMBER(SUBSTR(REQID,7))),0)+1  FROM STM_REQHDR WHERE REQBY=? AND REQTYPE<>'M' and substr(reqid,1,2)<>'MT' AND SUBSTR(REQID,1,3)<>'PAY'";
            PreparedStatement ps = null;
            String no = "";
            try {
                ps = getDBTransaction().createPreparedStatement(qry, 0);
                ps.setString(1, reqby);
                ResultSet rs = ps.executeQuery();
                if (rs.next()) {
                    no = rs.getString(1);
                ps.close();
            } catch (Exception e) {
                System.out.println("Exception in Gen req id ==>" + e);
            String reqno = reqby + String.format("%6s", no).replace(' ', '0');
            return reqno;
    but when i run form in debug mode and two user commit concurrent manner only one time code block is executed who first commit. and second user got error message.
    thanks
    Manish

  • How to get the PRIMARY KEY of a table at runtime ???

    Hi everybody,
    My requirement is to update a z-table at runtime according to the data given ata runtime. So the main difficulties for me is that whenever I tried to update the table based on the data given in UI many rows are getting updated as these fields are not unique. So I think if I can get the PRIMARY KEY along with these given fields then I can update only one row at a time.
    So Can anyone suggest me how to get PRIMARY KEY of a table based on the data in UI..??
    Any suggestions will be appreciated..
    Thanks,
    Sekhar

    U will get primary keys of transparent tables using FM "REUSE_FIELDCALATLOG_MERGE".
    pass tyour table name and u will get fieldcatalog filled. In tht their is a field called "KEY" if it has 'X' then tht field is a primary key of transparent tables & if it has "space" then it is not a primary key...
    Or else you can try with 'DDIF_TABT_GET'
    Or try this code
    PARAMETERS: p_table TYPE tabname OBLIGATORY.
    DATA: go_strucdescr   TYPE REF TO cl_abap_structdescr,
          gt_tab_fields   TYPE ddfields.
    FIELD-SYMBOLS: <gwa_tab_field> TYPE dfies.
    TRY .
    *   Get the details of the DDIC table
        go_strucdescr ?= cl_abap_elemdescr=>describe_by_name( p_table ).
      CATCH cx_sy_move_cast_error .
        MESSAGE 'Error while casting' TYPE 'S'. RETURN.
    ENDTRY.
    * Check if input is a DDIC table
    CHECK go_strucdescr->is_ddic_type( ) = 'X'.
    * Get the details of the table fields
    gt_tab_fields = go_strucdescr->get_ddic_field_list( ).
    * Display the Key fields of the table
    LOOP AT gt_tab_fields ASSIGNING <gwa_tab_field> WHERE keyflag = 'X'.
      WRITE: / <gwa_tab_field>-fieldname.
    ENDLOOP.

  • Is there any restriction on the length of all Primary keys in a table

    Hi all,
    Is there any restriction on the length of all Primary keys in a data base table?
    i have some 10 fields as primary key in a DB table and length exceeds 120 and getting a warning.
    Please let me know will there be any problems in future with respect to the same?
    With regards,
    Sumanth

    Well actually there are constraints like
    Total of internal lengths of all primary key columns        1024 Bytes
    Number of primary key columns per table                     512
    For other information about SAP database please refer to http://sapdb.org/sap_db_features.htm  
    Thanks & Regards,
    Vivek Gaur
    Alwayz in high spirits

Maybe you are looking for