Problem with primary key field that needs updating on commit

Taking on someone else's form and trying to tidy it up as it has no primary key on tha table.
The only primary key i can apply is (invoice number, line number)
This has to be displayed on the form as a provisional number when the user enters the form. So it need to show for example inv number 1000 with each line on the invoice being 1,2,3,4 etc.
The form then has a linked table for the lines per invoice that inserts invnumber and line number into a seperate table on PRE INSERT trigger. This means that if they put on various lines i need to do a post.
My problem comes because more than one person can use the form at the same time so user a will go into the form and see inv number 1000, user b will also see 1000. The original form was making these null and updating to correct number on commit but i wanted to add a primary key.
Im jusat wodering the best way to do this as if user a does not save before user b. there is a potential for a lock to occur on the post. Also they must be updated to a new number if someone else saves before them

either you create a sequence for this by create sequence command and populate the sequence value. but in this case if the form is cancelled the sequence is missed and the next sequence will appear. Another way to do is to generate the invoice number when the user press save button and then assign that value to text item. It is the best way to do. So the user will see invoice number only when they save and it happens in milli seconds so there is no question of overlapping invoice number.
Hope this helps.

Similar Messages

  • Help Needed..... Problems with Primary Key.

    Hello all.
    ive been trying to do this for a while but not luck, im after some advice on ive got a java program connected to mysql database and i want to create a copy of a table, then be able to delete records from the new table. it seems like you cannot update copied tables because it doesnt copy the primary keys because i get
    SQLException: Result Set not updatable (referenced table has no primary keys)
    is there a way around this?
    heres what i have:
    public void createTemporyTables(){
    try{
    Statement stmt5 = conn.createStatement();
    int rows1 = stmt5.executeUpdate("CREATE TABLE tempAnimals SELECT * FROM animals");
    Statement stmt6 = conn.createStatement();
    int rows2 = stmt6.executeUpdate("CREATE TABLE tempAnimalsQuestions SELECT * FROM animalsquestions");
    if (rows1 == 0){
    System.out.println("Don't add any row!");
    else{
    System.out.println(rows1 + " row(s)affected.");
    if (rows2 == 0){
    System.out.println("Don't add any row!");
    else{
    System.out.println(rows2 + " row(s)affected.");
    catch(Exception e)
    System.out.println("SQLException: " + e.getMessage());
    System.out.println("Method = createTemporyDatabase Error");
    public void remove(){
    try{
    Statement stmt13 = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    ResultSet yesItems = stmt13.executeQuery("SELECT * FROM tempanimals WHERE Q5 =\"y\"");
    Statement stmt14 = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    ResultSet yesQuestions = stmt14.executeQuery("SELECT * FROM tempanimalsquestions WHERE question = '5'");
    while(yesItems.next())
    yesItems.deleteRow();
    while(yesQuestions.next())
    yesQuestions.deleteRow();
    catch(Exception e)
    System.out.println("SQLException: " + e.getMessage());
    System.out.println("Method = removeYes Error");
    any help will be much appreciated..
    Ben

    Hi,
    Your temperary table has no primary key. Mention primary key field, when creating temperary table. See below statement change primary key field according to you.
    int rows1 = stmt5.executeUpdate("CREATE TABLE tempAnimals (primary key(animalid)) SELECT * FROM animals");
    int rows2 = stmt6.executeUpdate("CREATE TABLE tempAnimalsQuestions (primary key(questionid)) SELECT * FROM animalsquestions");Regards,
    Ram.

  • Insert row with datapages/bc4j  problem with primary key

    Hi everybody,
    i tryed to insert a new row into a table with primary key (id) and therfore used a datapage, where there is a html-form and the data tag set attribute to get the data into the BC.
    I also want to use a sequence for the primary key and made a trigger to insert the key-value before insert. but in this case it doesnt work. I also tryed to get the sequence to the BC -Layer (so that i can set the PK in the View OBJ already) with a View Object but I dont know how.
    so what schould i do??
    thanxx
    Martin

    There's a know issue, when creating a record with blob, the blob content won't show until committing. The blob is added too late, which means you're in trouble with not-null fields...
    Sue, is this logged as a bug? And the dialog captions?
    K.

  • Problem with S001 - Key field Sequence in table

    Hi,
    We want to use the extractor 2LIS_01_S001 with Delta. But delta is not working with these extractor. When I checked LBW0, I am getting error "The LIS environment is setup incorrectly".
    According to note 115192, the key fields in tables S001, S001BIW1 and S001BIW2 have to be in the same sequence.
    But we are on 4.7 with following Support Packs:
    SAP_APPL 470 0025 SAPKH47025 Logistics and Accounting
    PI 2004_1_470 0007 SAPKIPZI57 R/3 Plug-In (PI) 2004.1 for
    R/3 Enterpri
    PI_BASIS 2004_1_620 0010 SAPKIPYI5A Basis Plug-In
    (PI_BASIS) 2004_1_620
    And according to this note, solution is delivered with this Support Packs.
    Can you please tell me that if this note is mandatory for all the releases..?
    Did any one encounter this issue before..?
    Thanks & Regards,
    Samay Mehta

    I changed my entity: unchecked the X column to be primary key added RowID as a primary key. Now it works.
    What's wrong with my CHAR(1) as a primary key ?
    I also tried to add a Refresh button:
      <af:commandButton text="Refresh" id="cb3"/>and in the table add a partialTarget to the button. Now when I add new row and press the Refresh button - then it works.
    So it seems that the problem is when I add new row and enter data, the table is not refreshed and the row is missing it's primary key.
    Any solutions?
    Edited by: a.gruev on Nov 26, 2009 4:18 PM

  • Problem with primary key violation in master-detail screens

    Hi,
    I found a problem/bug in master-detail screens in which the PK of the detail table consist of the PK of the master table and an additional column. E.g. a manually entered sequence 'in parent'.
    I will use the following simple scenario to explain the problem (it's easy to reproduce):
    PROJECT table
    # id (PK)
    * name
    PROJECT REQUIREMENTS table
    # prj_id (PK)
    # sequence_id (PK)
    * description
    Just create the BC EO, VO and AM and set both display properties of the prj_id attribute of the project requirements VO to hidden.
    Create a new screen in the application structure file in which you can select a project (table-form layout) and display the details (table layout) on the same page.
    With this basic setup you can generate the app to enter, update and delete projects and their requirements.
    The problem occurs if you have a project with a least 1 requirements stored in the database and you try to enter a second requirement with an existing sequence_id within the project. This is an use case in which a end-user enters wrong data.
    So assume we have in the database:
    prj_id sequence_id description
    ====== =========== ===========
    1 1 req1
    and the end-user enters (prj_id is entered automatically as it's not displayed):
    1 1 req2 >> user should have enterd sequence_id 2...
    Step 1. If you try to save an error will be displayed:
    JBO-25013: Too many objects match the primary key oracle.jbo.Key[227300 1 ].
    And the sequnece_id is emptied automatically.
    Step 2. So the end-user re-enters the sequence_id but fills in 2 now and saves.
    Another error is displayed: JBO-27014 sequence_id in AppModule is required
    How strange? Everything is filled in already.
    Step 3. If you just hit save again (without changing anything) you got a transaction completed successfully.
    I checked the logfiles and noticed an exception during after executing step 2.
    oracle.jbo.AttrValException: JBO-27014: Attribute SequenceId in AppModule.ProjectRequirementsView2 is required     at oracle.jbo.AttrValException.<init>(AttrValException.java)     at oracle.jbo.server.JboMandatoryAttributesValidator.validate(JboMandatoryAttributesValidator.java)     at oracle.jbo.server.EntityDefImpl.validate(EntityDefImpl.java:2051)     at oracle.jbo.server.EntityImpl.validateEntity(EntityImpl.java:1373)     at mypackage1.ProjectRequirementsImpl.validateEntity(JwTekeningnummerImpl.java:273)     at oracle.jbo.server.EntityImpl.validate(EntityImpl.java:1508)     at oracle.jbo.server.EntityImpl.validateChildren(EntityImpl.java:1232)     at oracle.jbo.server.EntityImpl.validateEntity(EntityImpl.java:1339)     at oracle.jbo.server.EntityImpl.validate(EntityImpl.java:1508)     at oracle.jbo.server.DBTransactionImpl.validate(DBTransactionImpl.java:3965)     at oracle.adf.model.bc4j.DCJboDataControl.validate(DCJboDataControl.java:967)     at oracle.adf.model.binding.DCBindingContainer.validateInputValues(DCBindingContainer.java:1683)     at oracle.jheadstart.view.adfuix.JhsInitModelListener.validateInputValues(JhsInitModelListener.java:193)     at oracle.jheadstart.view.adfuix.JhsInitModelListener._doModelUpdate(JhsInitModelListener.java:166)     at oracle.jheadstart.view.adfuix.JhsInitModelListener.eventStarted(JhsInitModelListener.java:92)     at oracle.cabo.servlet.AbstractPageBroker._fireUIXRequestEvent(Unknown Source)     at oracle.cabo.servlet.AbstractPageBroker.handleRequest(Unknown Source)     at oracle.cabo.servlet.ui.BaseUIPageBroker.handleRequest(Unknown Source)     at oracle.adf.controller.struts.actions.StrutsUixLifecycle$NonRenderingPageBroker.handleRequest(StrutsUixLifecycle.java:325)     at oracle.cabo.servlet.PageBrokerHandler.handleRequest(Unknown Source)     at oracle.adf.controller.struts.actions.StrutsUixLifecycle._runUixController(StrutsUixLifecycle.java:215)     at oracle.adf.controller.struts.actions.StrutsUixLifecycle.processUpdateModel(StrutsUixLifecycle.java:106)     at oracle.jheadstart.controller.strutsadf.action.JhsStrutsUixLifecycle.processUpdateModel(JhsStrutsUixLifecycle.java:140)     at oracle.adf.controller.struts.actions.DataAction.processUpdateModel(DataAction.java:317)     at oracle.jheadstart.controller.strutsadf.action.JhsDataAction.processUpdateModel(JhsDataAction.java:622)     at oracle.adf.controller.struts.actions.DataAction.processUpdateModel(DataAction.java:508)     at oracle.adf.controller.lifecycle.PageLifecycle.handleLifecycle(PageLifecycle.java:112)     at oracle.adf.controller.struts.actions.StrutsUixLifecycle.handleLifecycle(StrutsUixLifecycle.java:70)     at oracle.adf.controller.struts.actions.DataAction.handleLifecycle(DataAction.java:223)     at oracle.jheadstart.controller.strutsadf.action.JhsDataAction.handleLifecycle(JhsDataAction.java:389)     at oracle.adf.controller.struts.actions.DataAction.execute(DataAction.java:155)     at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)     at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)     at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1485)     at oracle.jheadstart.controller.strutsadf.JhsActionServlet.process(JhsActionServlet.java:127)     at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:527)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:765)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)     at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)     at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)     at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)     at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:239)     at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20)     at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:239)     at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20)     at oracle.jheadstart.controller.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java)     at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:645)     at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)     at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)     at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)     at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)     at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)     at java.lang.Thread.run(Thread.java:534)
    This also explains why I got a error message within the application at step 2, but not an expected error message!
    From the logfile I can see something is going wrong in the oracle.jbo.server.EntityImpl.validateEntity method.
    To get more insight what was goning on I overridden the validateEntity method in my VO Impl class:
    protected void validateEntity()
    System.out.println("MARCEL>> sequenceId=" + getSequenceId());
    System.out.println("MARCEL>> description=" + getDescription());
    super.validateEntity();
    In step 1 the validateEntity is not called.
    In step 2 the sequeceId = null (and description = reg2)
    I expected the sequeceId to be 2 now as I entered this. Furthermore if I look at the (JhsActionServlet) request parameters in the log, I can see that the value of the sequenceId was 2. I guess something is going wrong at this point in converting the request parametes to the EO.
    In step 3 the sequeceId = 2 (as expected)
    Note that I'm using the evaluation copy version of JHeadstart 10.1.2.
    If this was patched in any later build, could you please tell which changes I have to make to the JHS sources to solve this problem.
    Regards,
    Marcel

    Marcel,
    I cannot reproduce this in version 10.1.2.2. We did not "fix" this, although changes in the runtime might have fixed this "silently". I suggest you upgrade to 10.1.2.2 and see whether you still get the error.
    Steven Davelaar,
    JHeadstart Team.

  • Problem with primary key

    Hi,
    I have written this small code. When I try to create my enterprise bean with deploytool, I set container-managed persistant (2.0) but I can't see my primary key and Find/Select methods :
    Note that when I set container-managed persistant (1.0), I see my primary key but I can connect to ejb/Cloudscape in order to gen the sql commands. it complains about j2ee server running and UI and PW while everything look ok to me...
    Any ideas?
    TNX,
    SS
    Here is my small code :
    =================================================
    package Connect;
    import javax.ejb.*;
    import java.rmi.*;
    public interface ConnectEC extends EJBObject {
    public String getMessage() throws RemoteException;
    ====================================================
    package Connect;
    import javax.ejb.*;
    import java.rmi.*;
    public interface ConnectECHome extends EJBHome {
    public ConnectEC create(String message) throws CreateException, RemoteException;
    public ConnectEC findByPrimaryKey(String message) throws FinderException, RemoteException;
    ===================================================================
    package Connect;
    import javax.ejb.*;
    import java.rmi.*;
    public class ConnectECBean implements EntityBean {
    public String message;
    private EntityContext ctx;
    public String ejbCreate(String message) throws CreateException {
    this.message = message;
    return null;
    public String getMessage(){
    return this.message;
    private String setMessage(String message){
    return this.message = message;
    public void ejbActivate() {}
    public void ejbLoad() {}
    public void ejbPassivate() {}
    public void ejbPostCreate(String message) {}
    public void ejbRemove() throws RemoteException {}
    public void ejbStore() {}
    public void setEntityContext(EntityContext ctx) {}
    public void unsetEntityContext() {}

    in cmp 2.0, you must declare your bean class as abstract class, use setter/getter to access the fields like the following:
    package Connect;
    import javax.ejb.*;
    import java.rmi.*;
    public abstract class ConnectECBean implements EntityBean {
    private EntityContext ctx;
    //cmp fields
    public abstract String getMessage();
    public abstract void setMessage(String msg);
    public String ejbCreate(String message) throws CreateException {
    setMessage(message);
    return null;
    public void ejbActivate() {}
    public void ejbLoad() {}
    public void ejbPassivate() {}
    public void ejbPostCreate(String message) {}
    public void ejbRemove() throws RemoteException {}
    public void ejbStore() {}
    public void setEntityContext(EntityContext ctx) {}
    public void unsetEntityContext() {}

  • UIX BC4J Problem with primary key

    Hello
    I use Business Components (Entity and Views) and the backend is a postgresql; it works with BC4J-JSP perfectly;
    i switched to use uix; but have strange problem:
    I have defined in the entity a create-Method to set the primary key of the current row to a defined value. If i test
    it in the component browser it works all; but when i switch to my application, i receive allways a "1" in the rendered field which should have the current primary key.
    Just to see if it works with Oracle right i tested also against Oracle 8.1.7! It works as it should.
    Has anybody an idea how i can solve the problem.

    Marcel,
    I cannot reproduce this in version 10.1.2.2. We did not "fix" this, although changes in the runtime might have fixed this "silently". I suggest you upgrade to 10.1.2.2 and see whether you still get the error.
    Steven Davelaar,
    JHeadstart Team.

  • JPA - How to map relation with NON-KEY field.

    Hello.
    Problem with mapping is NullPointerException when calling EntityManager em.createNativeQuery:
    Table1 (Bm_Treeassoc):
    MY_ID (Primary Key)
    BOOKMARKID (-> MY_ID in Table2)
    Text
    Table2 (Bm_Bookmark):
    MY_ID ( Primary Key)
    Text
    //CLASS BmTreeassoc
    @OneToMany(targetEntity=BmBookmark.class, mappedBy="treeMaster", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
         private BmTreeassoc treeMaster = null ;
    //CLASS BmBookmark
    @ManyToOne(targetEntity=BmTreeassoc.class, fetch = FetchType.LAZY, cascade = CascadeType.ALL, optional = true)
         @JoinColumn(name="MY_ID", referencedColumnName="BOOKMARKID", unique=true)     
         private ArrayList<BmBookmark> bookmarks = new ArrayList<BmBookmark>() ;
    This Leads to the exception.
    Mapping form MY_ID to MY_ID instead BOOKMARKID will not throw the exception,
    so I assume I have a problem with the KEY Field?
    Any ideas?
    Kind regards
    Frank

    OK,
    after reflecting (after maniacally trying for days).
    Here is the answer by myself:
    I do not use the mapping stuff at all no more.
    I solved my join by using a view:
    CREATE VIEW SAPDEMO.VTree
         AS SELECT t.TreeID, b.MY_ID, b.CLIENTID, b.Nickname, u.URL
         FROM SAPDEMO.BM_TreeAssoc as t
              JOIN SAPDEMO.BM_BOOKMARK as B ON t.BookmarkID = b.MY_ID
              JOIN SAPDEMO.BM_URL as U ON b.URL = u.MY_ID
    Create the entity and then do a:
    select * from VTREE where clientid=1 and treeid=446
    Works great, simple, fast.

  • 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

  • Problems with BC4J input select tag when its bounded to a primary key field

    HI..
    I have an jsp BC4J edit form. This form uses a BC4J input select tag. This component is mapping one of the primary key Entity fields.
    When im working with this component and it doesnt map a primary key field it shows the default "none" value when im inserting a record(thats Ok). but when it maps a primary key field the default value is a database value so it is not advisable.. How can i do in order to fix that?
    Thank you

    The none value is only shown when the field accepts null values.

  • Mapping problem with compressed key update record

    Hi, could you please advise?
    I'm getting the following problem:
    About a week ago replicat abened with "Error in mapping" error. I found in discard file some record looking like:
    filed1 = NULL
    field2 =
    field3 =
    field4 =
    field5 =
    datefield = -04-09 00:00:00
    field6 =
    field8 =
    field9 = NULL
    field10 =
    Where filed9 = @GETENV("GGHEADER", "COMMITTIMESTAM"), field10 = = @GETENV("GGHEADER", "COMMITTIMESTAM"), others are table fields mapped by USEDEFAULTS
    So I got Mapping problem with compressed key update record at 2012-06-01 15:44
    I guess I need to mention that extract failed in 5 minuts before it with: VAM function VAMRead returned unexpected result: error 600 - VAM Client Report <[CFileInfo::Read] Timeout expired after 10 retries with 1000 ms delay, waiting to read transaction log or backup files. To increase the number of retries, use SETENV (GGS_CacheRetryCount = n) in Extract parameter file. To control retry delay time, use SETENV (GGS_CacheRetryDelay = n). handle: 0000000000000398 ReadFile GetLastError:997 Wait GetLastError:997>.
    I don't know if it has ther same source as data corruption, could you tell me if it is?
    Well, I created new extract, starting 2012-06-01 15:30 to check if there was something with extract at the time, but got the same error.
    If I run extract beging at 15:52 it starts and works.
    But well, I got another one today. Data didn't look that bad, but yet one column came with null value:( And I'm using it as a key column, so I got Mapping problem with compressed key update record again:(
    I'm replicating from SQL Server 2008 to Oracle 11g.
    I'm actually using NOCOMPRESSUPDATES in Extract.
    CDC is enabled for all tables replicated. The only thing is that it is enabled not by ADD TRANDATA command, but by SQL Server sys.sp_cdc_enable_table, does it matter?
    Could you please advise why does it happen?

    Well, the problem begins somewhere in extract or before extract, may be in transaction log, I don't know:(
    Here are extract parameters:
    EXTRACT ETCHECK
    TRANLOGOPTIONS MANAGESECONDARYTRUNCATIONPOINT
    SOURCEDB TEST, USERID **, PASSWORD *****
    exttrail ./dirdat/ec
    NOCOMPRESSUPDATES
    NOCOMPRESSDELETES
    TABLE tst.table1, COLS (field1, field2, field3, field4, field5, field6, field7, field8 );
    TABLE tst.table2, COLS (field1, field2, field3, field4 );
    Data pump:
    EXTRACT DTCHECK
    SOURCEDB TEST, USERID **, PASSWORD *****
    RMTHOST ***, MGRPORT 7809
    RMTTRAIL ./dirdat/dc
    TABLE tst.table1;
    TABLE tst.table2;
    Replicat:
    REPLICAT rtcheck
    USERID tst, PASSWORD ***
    DISCARDFILE ./dirrpt/rtcheck.txt, PURGE
    SOURCEDEFS ./dirdef/sourcei.def
    HANDLECOLLISIONS
    UPDATEDELETES
    MAP tst.table1, t.table1, COLMAP (USEDEFAULTS , filed9 = @GETENV("GGHEADER", "COMMITTIMESTAMP"), filed10= @CASE(@GETENV("GGHEADER", "OPTYPE"), "SQL COMPUPDATE", "U", "PK UPDATE", "U",@GETENV("GGHEADER", "OPTYPE")) ), KEYCOLS (field3);
    MAP dbo.TPROCPERIODCONFIRMSTAV, TARGET R_019_000001.TPROCPERIODCONFIRMSTAV, COLMAP (USEDEFAULTS , field5 = @GETENV("GGHEADER", "COMMITTIMESTAMP"), filed6= @CASE(@GETENV("GGHEADER", "OPTYPE"), "SQL COMPUPDATE", "U", "PK UPDATE", "U",@GETENV("GGHEADER", "OPTYPE")) ), KEYCOLS (filed1, field2, field3);
    Rpt file for replicat:
    Oracle GoldenGate Delivery for Oracle
    Version 11.1.1.1 OGGCORE_11.1.1_PLATFORMS_110421.2040
    Windows x64 (optimized), Oracle 11g on Apr 22 2011 00:34:07
    Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
    Starting at 2012-06-05 12:49:38
    Operating System Version:
    Microsoft Windows Server 2008 R2 , on x64
    Version 6.1 (Build 7601: Service Pack 1)
    Process id: 2264
    Description:
    ** Running with the following parameters **
    REPLICAT rtcheck
    USERID tst, PASSWORD ***
    DISCARDFILE ./dirrpt/rtcheck.txt, PURGE
    SOURCEDEFS ./dirdef/sourcei.def
    HANDLECOLLISIONS
    UPDATEDELETES
    MAP tst.table1, t.table1, COLMAP (USEDEFAULTS , filed9 = @GETENV("GGHEADER", "COMMITTIMESTAMP"), filed10= @CASE(@GETENV("GGHEADER", "OPTYPE"), "SQL COMPUPDATE", "U", "PK UPDATE", "U",@GETENV("GGHEADER", "OPTYPE")) ), KEYCOLS (field3);
    MAP dbo.TPROCPERIODCONFIRMSTAV, TARGET R_019_000001.TPROCPERIODCONFIRMSTAV, COLMAP (USEDEFAULTS , field5 = @GETENV("GGHEADER", "COMMITTIMESTAMP"), filed6= @CASE(@GETENV("GGHEADER", "OPTYPE"), "SQL COMPUPDATE", "U", "PK UPDATE", "U",@GETENV("GGHEADER", "OPTYPE")) ), KEYCOLS (filed1, field2, field3);
    CACHEMGR virtual memory values (may have been adjusted)
    CACHEBUFFERSIZE: 64K
    CACHESIZE: 512M
    CACHEBUFFERSIZE (soft max): 4M
    CACHEPAGEOUTSIZE (normal): 4M
    PROCESS VM AVAIL FROM OS (min): 1G
    CACHESIZEMAX (strict force to disk): 881M
    Database Version:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE     11.2.0.1.0     Production
    TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    Database Language and Character Set:
    NLS_LANG = "AMERICAN_AMERICA.CL8MSWIN1251"
    NLS_LANGUAGE = "AMERICAN"
    NLS_TERRITORY = "AMERICA"
    NLS_CHARACTERSET = "CL8MSWIN1251"
    For further information on character set settings, please refer to user manual.
    ** Run Time Messages **
    Opened trail file ./dirdat/dc000000 at 2012-06-05 12:49:39
    2012-06-05 12:58:14 INFO OGG-01020 Processed extract process RESTART_ABEND record at seq 0, rba 925 (aborted 0 records).
    MAP resolved (entry tst.table1):
    MAP tst.table1, t.table1, COLMAP (USEDEFAULTS , filed9 = @GETENV("GGHEADER", "COMMITTIMESTAMP"), filed10= @CASE(@GETENV("GGHEADER", "OPTYPE"), "SQL COMPUPDATE", "U", "PK UPDATE", "U",@GETENV("GGHEADER", "OPTYPE")) ), KEYCOLS (field3);
    2012-06-05 12:58:14 WARNING OGG-00869 No unique key is defined for table table1. All viable columns will be used to represent the key, but may not guarantee uniqueness. KEYCOLS may be used to define the key.
    Using the following default columns with matching names:
    field1=field1, field2=field2, field3=field3, field4=field4, field5=field5, field6=field6, field7=field7, field8=field8
    Using the following key columns for target table R_019_000001.TCALCULATE: field3.
    2012-06-05 12:58:14 WARNING OGG-01431 Aborted grouped transaction on 'tst.table1', Mapping error.
    2012-06-05 12:58:14 WARNING OGG-01003 Repositioning to rba 987 in seqno 0.
    2012-06-05 12:58:14 WARNING OGG-01151 Error mapping from tst.table1 to tst.table1.
    2012-06-05 12:58:14 WARNING OGG-01003 Repositioning to rba 987 in seqno 0.
    Source Context :
    SourceModule : [er.main]
    SourceID : [er/rep.c]
    SourceFunction : [take_rep_err_action]
    SourceLine : [16064]
    ThreadBacktrace : [8] elements
    : [C:\App\OGG\replicat.exe(ERCALLBACK+0x143034) [0x00000001402192B4]]
    : [C:\App\OGG\replicat.exe(ERCALLBACK+0x11dd44) [0x00000001401F3FC4]]
    : [C:\App\OGG\replicat.exe(<RCALLBACK+0x11dd44) [0x000000014009F102]]
    : [C:\App\OGG\replicat.exe(<RCALLBACK+0x11dd44) [0x00000001400B29CC]]
    : [C:\App\OGG\replicat.exe(<RCALLBACK+0x11dd44) [0x00000001400B8887]]
    : [C:\App\OGG\replicat.exe(releaseCProcessManagerInstance+0x25250) [0x000000014028F200]]
    : [C:\Windows\system32\kernel32.dll(BaseThreadInitThunk+0xd) [0x000000007720652D]]
    : [C:\Windows\SYSTEM32\ntdll.dll(RtlUserThreadStart+0x21) [0x000000007733C521]]
    2012-06-05 12:58:14 ERROR OGG-01296 Error mapping from tst.table1 to tst.table1.
    * ** Run Time Statistics ** *
    Last record for the last committed transaction is the following:
    Trail name : ./dirdat/dc000000
    Hdr-Ind : E (x45) Partition : . (x04)
    UndoFlag : . (x00) BeforeAfter: A (x41)
    RecLength : 249 (x00f9) IO Time : 2012-06-01 15:48:56.285333
    IOType : 115 (x73) OrigNode : 255 (xff)
    TransInd : . (x03) FormatType : R (x52)
    SyskeyLen : 0 (x00) Incomplete : . (x00)
    AuditRBA : 44 AuditPos : 71176199289771
    Continued : N (x00) RecCount : 1 (x01)
    2012-06-01 15:48:56.285333 GGSKeyFieldComp Len 249 RBA 987
    Name: DBO.TCALCULATE
    Reading ./dirdat/dc000000, current RBA 987, 0 records
    Report at 2012-06-05 12:58:14 (activity since 2012-06-05 12:58:14)
    From Table tst.table1 to tst.table1:
    # inserts: 0
    # updates: 0
    # deletes: 0
    # discards: 1
    Last log location read:
    FILE: ./dirdat/dc000000
    SEQNO: 0
    RBA: 987
    TIMESTAMP: 2012-06-01 15:48:56.285333
    EOF: NO
    READERR: 0
    2012-06-05 12:58:14 ERROR OGG-01668 PROCESS ABENDING.
    Discard file:
    Oracle GoldenGate Delivery for Oracle process started, group RTCHECK discard file opened: 2012-06-05 12:49:39
    Key column filed3 (0) is missing from update on table tst.table1
    Missing 1 key columns in update for table tst.table1.
    Current time: 2012-06-05 12:58:14
    Discarded record from action ABEND on error 0
    Aborting transaction on ./dirdat/dc beginning at seqno 0 rba 987
    error at seqno 0 rba 987
    Problem replicating tst.table1 to tst.table1
    Mapping problem with compressed key update record (target format)...
    filed1 = NULL
    field2 =
    field3 =
    field4 =
    field5 =
    datefield = -04-09 00:00:00
    field6 =
    field8 =
    field9 = NULL
    field10 =
    Process Abending : 2012-06-05 12:58:14

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

  • 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

  • Mapping problem with compressed key update record (target format)...

    Hi Guys,
    Getting below error while replication from Source to target. Source table is having NOT NULL Column, but on target replicat process giving error about some NULL value ??
    How to overcome this issue, any idea...
    2011-08-04 10:35:04 INFO OGG-00995 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: REPLICAT RMASTRK starting.
    2011-08-04 10:35:05 INFO OGG-00996 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: REPLICAT RMASTRK started.
    2011-08-04 10:35:06 WARNING OGG-00869 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: OCI Error ORA-01407: cannot update ("INFRA"."CUST"."CODE") to NULL (status = 1407), SQL <UPDATE "INFRA"."CUST" SET "ORD_ID" = :a2,"DP_ID" = :a3,"EXCHNG_CODE" = :a4,"ORD_QTY" = :a5,"ORD_PRICE" = :a6,"CODE" = :a7,"MKRT_CODE" = :a8,"CHANN>.
    2011-08-04 10:35:06 WARNING OGG-01004 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: Aborted grouped transaction on 'INFRA.CUST', Database error 1407 (ORA-01407: cannot update ("INFRA"."CUST"."SCRP_CODE") to NULL).
    2011-08-04 10:35:06 WARNING OGG-01003 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: Repositioning to rba 44132192 in seqno 68708.
    2011-08-04 10:35:06 *WARNING OGG-01154 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: SQL error 1407 mapping INFRA.CUST to INFRA.CUST OCI Error ORA-01407:* *cannot update ("INFRA"."CUST"."SCRP_CODE") to NULL (status = 1407), SQL <UPDATE "INFRA"."CUST" SET "ORD_ID" = :a2,"DP_ID" = :a3,"EXCHNG_CODE"=:a4,"ORD_QTY"*
    *= :a5,"ORD_PRICE" = :a6,"SCRP_CODE" = :a7,"MKRT_CODE" = :a8,"CHANN>.*
    2011-08-04 10:35:06 WARNING OGG-01003 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: Repositioning to rba 44132192 in seqno 68708.
    2011-08-04 10:35:06 ERROR OGG-01296 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: Error mapping from INFRA.CUST to INFRA.CUST.
    2011-08-04 10:35:06 ERROR OGG-01668 Oracle GoldenGate Delivery for Oracle, rmastrk.prm: PROCESS ABENDING.
    Oracle GoldenGate Delivery for Oracle process started, group RMASTRK discard file opened: 2011-08-04 10:35:05
    Current time: 2011-08-04 10:35:06
    Discarded record from action ABEND on error 1407
    OCI Error ORA-01407: cannot update ("INFRA"."CUST"."SCRP_CODE") to NULL
    (status = 1407), SQL <UPDATE "INFRA"."CUST" SET "ORD_ID" = :a2,"MKRT_CODE" = :a8,"CHANN>
    Aborting transaction on ./dirdat/pm beginning at seqno 68708 rba 44132192
    error at seqno 68708 rba 44132192
    Problem replicating INFRA.CUST to INFRA.CUST
    *Mapping problem with compressed key update record (target format)...*
    ORD_QTY = 500
    ORD_PRICE = 37430
    SCRP_CODE =
    MKRT_CODE = N
    Oracle GoldenGate Delivery for Oracle process started, group RMASTRK discard file opened: 2011-08-
    04 10:35:05
    Current time: 2011-08-04 10:35:06
    Discarded record from action ABEND on error 1407
    OCI Error ORA-01407: cannot update ("INFRA"."CUST"."SCRP_CODE") to NULL
    (status = 1407), SQL <UPDATE "INFRA"."CUST" SET "ORD_ID" = :a2,"MKRT_CODE" = :a8,"CHANN>
    Aborting transaction on ./dirdat/pm beginning at seqno 68708 rba 44132192
    error at seqno 68708 rba 44132192
    Problem replicating INFRA.CUST to INFRA.CUST
    Mapping problem with compressed key update record (target format)...
    ORD_QTY = 500
    ORD_PRICE = 37430
    SCRP_CODE =
    MKRT_CODE = N
    Any inputs / help would be appreciated.
    Regards,
    Manish

    The SCRP_CODE column has a NOT NULL constraint. The ORA-01407 error is telling you that you cannot update or set a value for this column to null because of the constraint. This has absolutely nothing to do with an index. You can use a marker/sentinel value in lieu of using NULL. For a numeric field, where everything is positive, a negative value (-1) can be decoded as meaning null. For a character field, a code such as NA can represent NULL.
    This also has nothing to do (directly) with GoldenGate failing because of this error. The underlying SQL statement will fail everywhere, regardless of the tool or application. It is not a case of failing only in GoldenGate.

  • 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

Maybe you are looking for

  • I cannot install iTunes on my computer, Winows 7. Error code -45075

    I cannot install iTunes on my computer. Error code -45075

  • Initialize values in ANLC

    Hi all, We reseted a company using : -function "reset company code" ( line items only) (tcode OABL) for FIAA -function "delete transaction date" (tcode OBR1) for FI and CO We used AFAR to recalculate values for ANLC. The problem is that some assets s

  • Combining Projects in RoboHelp v5

    I have two projects in RoboHelp 5 that I need to combine, in order to move them into Flare as one project. Can that be done in RH5? The help only refers to merging projects when compiling and that's not what I need. I actually need to combine the sou

  • GR for Sub con SA

    hi when am taking Gr for sub con SA its showing document does not have any selecatable items even i maintained 1.GR date is after Sch lines date 2.No confirmation control is there 3 SA released when am searching open SA in MB01 with ref to mat, vendo

  • IPhone freeze at Logo after Reseting.

    I decided to reset my iPhone after getting it back from my dad. I reseted all its contents VIA iPhone settings, but after its done reseting, it turns on but stops at the Apple Logo screen. After the first minute it shows the little circle loading ico