Who can I update primary key field in master block

Hi,
I want to update the primary key field in master block when there are some records are present in detail block, when I edit the primary key filed there is an error FRM-40509 unable to update record. The primary key is also referred by the detail table.
So kindly give me the solution who can I update the primary key in master block when there is child records exists in detail block?.
Best regard,
shahzad

pls tell us a little more about, why you want to update a PK in a master block.
I haven't done that my whole time. Maybe you need something different.
The problem is, that your child-data references to the master-pk, so there is the point you have to go deep into the codings. But better don't do it. Tell us first why. I think there are other solutions for that.
try it
Gerd

Similar Messages

  • Change primary key field in Master-Detail Form (Urgent)

    Hi,
    Can some experts share your valuable experience on the problem below?
    We have created a form Master-Detail relation. For some reasons, we have to allow the primary key field to be editable. But we couln't achieve it in Form 6i. It gives update error during commit.
    Your kind help will be highly appreciated.
    Regards,
    YM

    Hi there,
    I think the problem is because u are updating the primary key in the master block but since it is a master detail block u need to update it in the detail block as well.so what i suggest u to do is in the pre-insert trigger assign the value of master primarykey to the detail primary key....
    just check this out hopefully this shud help u.
    Bye
    Atul

  • Display property of key field in master block effects detail blk refreshing

    Can anyone throw light on why a screen with the detail block in a straightforward master detail block does not refresh correctly unless one of the two key fields in the master block is displayed? The key field did (of course) exist in the master block - it just was not displaying. As soon as this key field was displayed, then when ever the problem screen was opened or the master block records were paged through, then the detail block refreshes nicely. Disable the display property again and the detail block does not refresh nicely. Found problem in forms 6i. (note, usage of the synchronize function did not change anything)
    Did I see similar problem some six or so years ago in forms 4? Ideas anyone?

    re rebuild from scratch.
    yes, we did rebuild the form from scratch. Original form was generated. Carefully made the same blocks, block relationships etc etc etc and then copied code from old forms triggers and so on carefully over.
    re being reproducable
    yep, tis so. We are both long term experienced Oracle developers - but this is a weirdy. Got any ideas? If we work anything out we shall certainly update this.

  • Updation of Primary Key field in HR Tables (PA2001 and PA2002) - Urgent

    Can anyone please tell me how to update a primary key field in HR Tables (PA2001 and PA2002).
    I need to update sprps field in both the tables. I used HR_Infotype_Operation function module, but still it is not updating the field.
    Pls find the following code snippet for the table PA2001 and let me know if any discrepancies :
    TABLES: pa2001.
    DATA: it_pa2001 TYPE TABLE OF pa2001,
    wa_pa2001 LIKE LINE OF it_pa2001,
    DATA: date TYPE d.
    date = sy-datum - 100.
    SELECT pernr sprps begda endda FROM PA2001 INTO CORRESPONDING FIELDS OF TABLE it_pa2001
    WHERE begda BETWEEN date and sy-datum.
    WRITE:/.
    WRITE:/ 'PA 2001 Records'.
    if sy-subrc <> 0.
    WRITE:/ 'No Data Exists'.
    else.
    LOOP AT it_pa2001 INTO wa_pa2001.
    WRITE:/ wa_pa2001-pernr, wa_pa2001-sprps, wa_pa2001-begda, wa_pa2001-endda.
    ENDLOOP.
    endif.
    LOOP AT it_pa2001 INTO wa_pa2001.
    wa_pa2001-sprps = 'X'.
    CALL FUNCTION 'HR_INFOTYPE_OPERATION'
    EXPORTING
    infty = '2001'
    number = wa_pa2001-pernr
    SUBTYPE =
    OBJECTID =
    LOCKINDICATOR =
    VALIDITYEND =
    VALIDITYBEGIN =
    RECORDNUMBER =
    record = wa_pa2001
    operation = 'MOD'
    TCLAS = 'A'
    DIALOG_MODE = '0'
    NOCOMMIT =
    VIEW_IDENTIFIER =
    SECONDARY_RECORD =
    IMPORTING
    RETURN =
    KEY =
    ENDLOOP.
    if sy-subrc = 0.
    write:/ 'SY-subrc is zero'.
    write:/ ' Rows modified = ', sy-dbcnt.
    else.
    write:/ 'No Record(s) updated'.
    endif.
    commit work.
    WRITE: / 'Updated Records in the Internal Table IT_PA2001'.
    SELECT pernr sprps begda endda FROM PA2001 INTO CORRESPONDING FIELDS OF TABLE it_pa2001
    WHERE begda BETWEEN date AND sy-datum..
    LOOP AT it_pa2001 INTO wa_pa2001.
    WRITE:/ wa_pa2001-pernr, wa_pa2001-sprps, wa_pa2001-begda, wa_pa2001-endda.
    ENDLOOP.

    Thanks Kiran.
    But I need to change this field as we need to lock the records, as soon as the employee fills his/her time sheets which will be sent for HR Payroll, later on.
    When I am updating directly the field the database table PA2001, its not updating but for table PA2002, only few records are being updated.
    Is there any other alternative for this problem?
    Pls reply.
    Thanks,
    Harish

  • Prob with Updation of Primary Key field '' SPRPS '' in PA2001. Plz HELP

    Can anyone please tell me how to update a primary key field in HR Tables (PA2001 and PA2002).
    I need to update sprps field in both the tables. I used HR_Infotype_Operation function module, but still it is not updating the field.
    Pls find the following code snippet for the table PA2001 and let me know if any discrepancies :
    TABLES: pa2001.
    DATA: it_pa2001 TYPE TABLE OF pa2001,
    wa_pa2001 LIKE LINE OF it_pa2001,
    DATA: date TYPE d.
    date = sy-datum - 100.
    SELECT pernr sprps begda endda FROM PA2001 INTO CORRESPONDING FIELDS OF TABLE it_pa2001
    WHERE begda BETWEEN date and sy-datum.
    WRITE:/.
    WRITE:/ 'PA 2001 Records'.
    if sy-subrc <> 0.
    WRITE:/ 'No Data Exists'.
    else.
    LOOP AT it_pa2001 INTO wa_pa2001.
    WRITE:/ wa_pa2001-pernr, wa_pa2001-sprps, wa_pa2001-begda, wa_pa2001-endda.
    ENDLOOP.
    endif.
    LOOP AT it_pa2001 INTO wa_pa2001.
    wa_pa2001-sprps = 'X'.
    CALL FUNCTION 'HR_INFOTYPE_OPERATION'
    EXPORTING
    infty = '2001'
    number = wa_pa2001-pernr
    SUBTYPE =
    OBJECTID =
    LOCKINDICATOR =
    VALIDITYEND =
    VALIDITYBEGIN =
    RECORDNUMBER =
    record = wa_pa2001
    operation = 'MOD'
    TCLAS = 'A'
    DIALOG_MODE = '0'
    NOCOMMIT =
    VIEW_IDENTIFIER =
    SECONDARY_RECORD =
    IMPORTING
    RETURN =
    KEY =
    ENDLOOP.
    if sy-subrc = 0.
    write:/ 'SY-subrc is zero'.
    write:/ ' Rows modified = ', sy-dbcnt.
    else.
    write:/ 'No Record(s) updated'.
    endif.
    commit work.
    WRITE: / 'Updated Records in the Internal Table IT_PA2001'.
    SELECT pernr sprps begda endda FROM PA2001 INTO CORRESPONDING FIELDS OF TABLE it_pa2001
    WHERE begda BETWEEN date AND sy-datum..
    LOOP AT it_pa2001 INTO wa_pa2001.
    WRITE:/ wa_pa2001-pernr, wa_pa2001-sprps, wa_pa2001-begda, wa_pa2001-endda.
    ENDLOOP.

    Thanks Kiran.
    But I need to change this field as we need to lock the records, as soon as the employee fills his/her time sheets which will be sent for HR Payroll, later on.
    When I am updating directly the field the database table PA2001, its not updating but for table PA2002, only few records are being updated.
    Is there any other alternative for this problem?
    Pls reply.
    Thanks,
    Harish

  • Cannot modify value of primary key field after lookup.

    I realize this could be a WebSphere problem, but I don't know if it is an EJB problem or what? So I'm posting anyway, and adding Duke Dollars in the hopes someone out there has encountered this.
    Okay, I'm using WebSphere Studio Application Developer 4.0.3.
    I am using an EJB that has three primary key fields.
    I use the primary keys to lookup the bean.
    I then want to update the value of one of the primary keys.
    So I create a setter and getter method for that primary key field.
    I then can call the set method, but it does nothing.
    I get no errors.
    It compiles.
    I rebuild, regenerate access beans, and redeploy and rmic.
    I can use ctrl-space to see the functions in the JSP editor.
    However, the set function never gets called for some reason, and I get no runtime exception either.
    For example, if I do this in my code:
    MyBeanFactory myBean = new MyBeanFactory();
    MyBeanKey myBeanKey = new MyBean(name,age,city);
    MyBean myBean = myBeanFactory.findByPrimaryKey(myBeanKey);
    // this function doesn't do anything, because it's a primary key field
    // but it does compile and I get no runtime errors
    myBean.setCity("Orlando");
    // this function works fine, presumably because it isn't a primary key
    myBean.setState("Florida");Questions;
    Is there a restriction that says I can't update the value of a field if it is marked as a primary key?
    If not, what could I be doing wrong?

    Looks like your appserver is working as per the specification.
    Check this out:
    Question
    How can I update the primary key field in a CMP Entity Bean?
    Derived from
    A question posed by Shanks75 shanks75
    Topics
    Java:API:EJB:EntityBean:CMP, Java:API:EJB:2.0
    Author
    Tim Duggan
    Created
    Oct 9, 2001
    Answer
    You cannot change the primary key field of an Entity bean. Refer to page 130 of the EJB 2.0 specification, it states "Once the
    primary key for an entity bean has been set, the Bean Provider must not attempt to change it by use of set accessor methods
    on the primary key cmp-fields. The Bean provider should therefore not expose the set accessor methods for the primary key
    cmp-fields in the component interface of the entity bean."
    A work around to update a primary key field, would be to remove and then an re-create the bean.
    taken from here:
    http://www.jguru.com/faq/view.jsp?EID=515864

  • Default Primary Key Field of any database table

    hi,
    I am working on a database in which the data in the tables is generated from some other modules. I have to add, view and update functionalities to this table in the database. Unfortunately there is no primary key field for the table i am working on and as some existing modules are using this table i am not allowed to change the design of the table at this stage.
    Without primary i think its not possible to do updates. Because if all fields can have their values changed, then there will be a breakdown if the field value changes in the mid time when i had already retrieved the data to show on the screen, but not yet updated the value in the database. I hope you understood my problem.
    Please suggest solutions. I am not sure, but i think i read somewhere that every table created has a default primary associated whose value is always incresing with a new addtion of recored and its value never decreases. But i am unable to recollect the field name...i think it is some thing like[b] OID .... But i checked there is no such field name by OID. So please help me with some alternative solution...or by telling the default primary key field name.
    Thanx

    All the databases I know (namely Informix, PostgreSQL, SQL Server, even Access) have a row id column generated automatically.
    PostgreSQL example
    There is a way to read the value of this column; for example with PostgreSQL let�s say you have the following:
    CREATE TABLE no_id_column (
    column_one varchar(80),
    column_two varchar(80)
    INSERT INTO no_id_column(column_one, column_two) VALUES (�red�, �pink�);
    INSERT INTO no_id_column(column_one, column_two) VALUES (�yellow�, �orange�);Certainly, if we executed:
    SELECT * FROM no_id_column;Would obtain:
    column_one          column_two
    red               pink
    yellow               orangeBut if we modify the query
    SELECT  oid, * FROM no_id_column;We magically obtain a row identificator
    oid          column_one          column_two
    21569          red               pink
    21570          yellow               orangeThe data in the oid column is generated automatically by the database manager. Every time we insert a row we�ll have a different one. Just take into account that if the database contains a large amount of data, the oid could cycle.

  • Primary key field problem in DBSchema Wizard

    Hi,
    I am using Sun ONE studio 4 update 1, EE.
    I have generated schema using the Database Schema Wizard.
    The generated table representations does not recognise the primary key fields so I can not map my CMP to any table :-(
    Is this a bug?
    because I have generated schemas from 3 different databases (IBM, MySQL, SAP) and the tables have primary key fields.
    When I get a connection in Runtime Pane under Database node, I can see the primary fields are highlighted with red color.
    However, when I obtain the schema using, New->Database->Database Schema, there are no primary key fields generated.
    Anyone have any ideas, work around?
    Thanks
    Tex...

    First, thanks for posting the code that lets us reproduce your test. That is essential for issues like this.
    Because the primary key is global you will not be able to use
    INCLUDING INDEXES
    WITH VALIDATION;And you will need to add the primary key to the temp table
    ALTER TABLE DEMO_INTERVAL_DATA_LOAD_Y ADD CONSTRAINT IDX_DEMO_ROLL_Y PRIMARY KEY (ROLL_NUM);The the exchange will work. You will need to rebuild the primary key after the exchange.

  • Exception: non-read-only mapping defined for the primary key field

    Hello.
    I'm new to Oracle and I created Java EE Web Project.
    And I created entities from tableA, tableB, tableC from my database.
    tableA has foreign key to tableB and has unidirectional Many-to-One relationship. tableC has two primary keys and one of these is foreign key to primary key in tableA. tableC also has unidirection Many-to-One relationship to tableA.
    Then I created session bean and data control from it, in design window, created read-only table from tableA.
    And I selected columns in tableA and also in tableB.
    I ran the application and saw the following exception in log window.
    Local Exception Stack:
    Exception [EclipseLink-46] (Eclipse Persistence Services - 2.1.3.v20110304-r9073): org.eclipse.persistence.exceptions.DescriptorException
    Exception Description: There should be one non-read-only mapping defined for the primary key field [tableC.tableA_ID].
    Descriptor: RelationalDescriptor(mypack.tableC --> [DatabaseTable(tableC)])
    tableA_ID is a primary key in tableA.
    How can I solve this error?
    Please help me.
    Edited by: 900471 on 2011. 12. 3 오전 5:32
    Edited by: 900471 on 2011. 12. 3 오전 5:33
    Edited by: 900471 on 2011. 12. 3 오전 5:33
    Edited by: 900471 on 2011. 12. 3 오전 5:34

    There are not enough details to be sure since you have not provided the mappings. From just the error, it looks like you are using the tableC.tableA_ID field as the foreign key in the ManyToOne relationship to A, but have marked it as insertable=false, writeable=false, meaning that it cannot be updated or used for inserts.
    Either make it writable (set the settings to true), or add another basic mapping/attribute in the entity for TableC that maps to the field which you can use to set when you insert a new tableC entity. A simple example is available at
    http://wiki.eclipse.org/EclipseLink/Examples/JPA/2.0/DerivedIdentifiers
    Best Regards,
    Chris

  • Update primary key

    Hi
    I am using weblogic 7.0 and ejb 2.0
    I have a requirement where i would want to update my primary key. If i understand right , In ejb you are not allowed to update one of the primary key column of composite primary key.
    Now if i have to update this what are the work arounds. Aslo say if i update that row through stored proc, will my ejb state in cache be in sync with latest data. Is ejb load called for sure beofre any method is called on bean.
    Please give me some inputs on this
    Thanks

    Your problem lies within your database (datasource)structure. You need to have two primary keys for that particular entity. The first primay key is internal meaning it is the true key for any specific record in the table. The second "primary key" is external meaning it is not truely a primary key with regards to the formal contstraints of your database. Instead, this is the key your users will see. It is the responsibilty of the application layer to ensure that the external id is unique. This way, you always have a lasting primary key (the internal key), yet your users can change their "primary key" whenever they like.
    As an example, I'm writing a J2EE application that provides our clients with a unique ID to access their records. My table definition would look something like:
    CREATE TABLE Client (
    clientId BIGINT AUTO_INCREMENT NOT NULL,
    externalClientId VARCHAR(15) UNIQUE NOT NULL,
    ... another field,
    ... another field,
    CONSTRAINT pk_foo PRIMARY KEY (clientId)
    The unique constraint isn't really necessary because the application layer should check for this, but it's a good safety precaution.
    On the application side, you would only expose the 'externalClientId' to the clients. This might force you to use BMP, but it keeps the user from ever changing the true Id and is fairly clean.
    Hope this helps.

  • Update primary key/delete and reinsert records

    Hi, I have been told to update some fields. The database is new to me, and now I see the field is the primary key (and it has child tables with that as foreign key). The person who told me isn't reachable until next week...
    ...wasn't a bad idea to update pk's? I see it's possible, deferring constraints...
    update primary key
    Re: Update Primary Key
    ...but it's better/safer the script deletes and later re-insert the records, right?
    Thanks

    Always is better be able to undo any change .
    But ¡, why would you update pk's? it's possible but you colud find few problems like:
    - many levels of foreign keys exists.
    - not validate pk
    Look at:
    Re: Novalidate primary key

  • How to add a new data element for existing table filed(Primary key field)

    Hi Experts,
    How to add a new data element for existing table field(Primary key field)
    For this filed ther is no foreign key relation ships and even check table.
    while activating table it is giving message like below.
    can you help any one to solve this and wil steps to add new dataelement for existing primary key filed of a table.
    Check table (NAMING SPACE/TABLE NAME(EX:/TC/VENDOR)) (username/19.02.10/03:29)           
    Primary key change not permitted for value table /TC/VENDOR
    Check on table  /TC/VENDOR resulted in errors              
    Thanks
    Ravi

    Hi,
    Easiest way is to download the table eg into an Excel table (if possible) or text table. Drop the table from the database. Build your table with the new key field. Build the database table again and fill it.
    You can do it also over the database into a new table. Drop the old one. Build the enhanced one and fill it. Afterwards drop your (temporary) table.
    Maybe there are other ways, but this works.
    Success,
    Rob

  • Problems deleting a primary key field in a table.

    Hello Guys,
    I deleted a primary key field in a custom table by clicking 'delete row' icon and then tried activating it through se14 - database utility. It is throwing an error saying 'Primary key change not permited for the value table zxxxx'. What is the problem???
    How can I delete a primary key in a table??
    Please help.
    Thanks,
    Naren

    I am pasting the detail explaination over that error.
    Primary key change not permitted for value table ZTV_RANGE_NUMBER
    Message no. AD 300
    Diagnosis
    This table is defined as a check table. For reasons of consistency, changes to the primary key of the table are not allowed.
    Procedure
    If it is essential that you change the primary key, you must delete the relevant foreign keys. Refer to the where-used list to find all tables containing a field that is checked against this table. Delete the foreign keys for these fields.
    If necessary, maintain the deleted foreign keys again.

  • Adding 2 new fields as Primary Key field in a Z Table which is existing PRD

    Hi Friends,
    I have to add two new fields as primary key fields in a Z TABLE, which is existing in Quality and Production Systems with Data.
    If I incorporate these two new fields (Primary Key fields) in development and if the TR is moved to Quality and Production sytems, is there any possibility of loss in data will happen at Quality and Prd systems?
    At present, Table is having 20 fields with 2 primary key fields and i have to add 2 more primary key fields.
    I have checked in SCN and not find relevant threads.
    Please help me out.
    Regards,
    Suresh.

    NO . It wont be a problem .
    For ex :
    If you have VBELN  , POSNR are key fields now , you have an unique reord with that combination .
    If you add one other field in it  fo ex  VKBUR  then records will be like this
    VBELN     POSNR     VKBUR   MATERIAL   QTY
    10020      10                            abcxyz      1
    10020      10            1234        abcxyz     1
    So your previous records before adding new primary keys , will have new fields balnk , and the new records will have data filled up in all primary key fields .
    However , if you try to update the existing records that will be in existing PRIMARYKEY combination only .
    for example if you try update record 1 above with VKBUR value 85858 , it creates a new record , it wont be updated in existing record.
    Hope this helps , Pls let me know if u have any more doubts.

  • Setting primary key field value in jdoPrestore() not flushed to database ?BUG?

    Hello,
    When I set value of primary key field of a new instance in jdoPrestore() new
    value does not get flushed to database - old (default) value get stored
    instead. All other fields assigned in jdoPrestore() get successfully
    flushed except primary key one.
    Alex

    Abe,
    You fixed only part of the problem. Right now if I assign value to a PK
    field in jdoPreStore() it does get flushed but there is another issue - all
    other instances which referenced the one I assigned PK to will not get this
    PK value. Example A references B, in B.jdoPreStore() I generate id for B -
    b.id = 100. When A gets flushed it would not get 100 in its b_id field.
    Specs says:
    This method is called ***before the values are stored from the instance to
    the StateManager***.
    Data store fields that might have been affected by modified non-persistent
    fields should
    be updated in this method. This method is modified by the enhancer so that
    changes to
    persistent fields will be reflected in the data store.
    The context in which this call is made allows access to the
    PersistenceManager and
    other persistent JDO instances.
    I read it as callbacks should be invoked on ALL instances before they get
    stored to StateManager. Does Kodo invoke callbacks for all istances first
    and then store them to instance manager? Based on the problem I am having it
    does not look like it
    Alex
    "Abe White" <[email protected]> wrote in message
    news:[email protected]..
    I just confirmed this as a bug and fixed it. We should be able to post
    the new jars for you soon. Hang in there.

Maybe you are looking for

  • Cooling fan issues

    Hi I just turned on my computer and i got a message saying "cooling fan not operating properly, computer will shut down in 15 sec-don not recommend using computer it can damange files or corupt harddrive.  Do i just have another cooling fan installed

  • Internal oder and Cost Center

    Hi, i need to know , how many internal oder is in a center ? Please advise if you can pull list of internal oder which assigned to cost center> thanks a bunch peace

  • Find/change in book

    Hi there Is it possible to perform a Find/Change search on a whole book, without having to open all the documents at once or make a PDF? I'm using CS3 on a Mac.

  • Possible to use RMI to upload client side image files?

    Is it possible to use RMI to upload client side image files? My intent is to allow remote clients to upload a number of small image files (jpg & gif) to a central server DBMS, by modifying a "Customer" object (eg adding a new Image object to a vector

  • Configuration information

    Hi, We are going to use AT-MIO-16E-10 and PCI-DIO-32SH in RTX subsystem, a real-time extention for Windows NT. I need detail information about the port addresses for all analog and digital I/O for development of device drivers in RTX. Does anyone kno