Have field map to existing record in table by secondary key

Let's say I have a person table and a code table.
person.datastoreId
person.name
person.foreignKeyToCodeValue
code.datastoreId
code.codeValue
code is a static lookup table. I want to persist a new Person object:
personObject.name = whatever
personObject.code = something
Obviously, person.code is mapped in the mapping XML to the code.codeValue
table.
If I call makePersistent(personObject) it will create a new record in the
code table, right? if codeValue had a unique constraint on it, is there a
way, so that it would automatically associate that person.codeValue with
the existing record instead of creating a new one?
I know I could do a query to get the codeValue object first and assign
personObject.code to that, but I'm wondering if there is a way to avoid
that.
Thanks!
Joel Shellman

Joel-
You will need to implement this sort of singleton pattern yourself.
The most common way would be to do something like:
public class Person
private Code code;
public void setCodeValue (String value)
try
code = (Code)JDOHelper.getPersistenceManager (this).
getObjectById (new CodeValue.ID (value), false);
catch (ObjectNotFoundException none)
// none exists; make a new one with the specified key
code = new Code ();
code.setPrimaryKeyField (value);
In article <bvtod5$nkp$[email protected]>, Joel Shellman wrote:
Let's say I have a person table and a code table.
person.datastoreId
person.name
person.foreignKeyToCodeValue
code.datastoreId
code.codeValue
code is a static lookup table. I want to persist a new Person object:
personObject.name = whatever
personObject.code = something
Obviously, person.code is mapped in the mapping XML to the code.codeValue
table.
If I call makePersistent(personObject) it will create a new record in the
code table, right? if codeValue had a unique constraint on it, is there a
way, so that it would automatically associate that person.codeValue with
the existing record instead of creating a new one?
I know I could do a query to get the codeValue object first and assign
personObject.code to that, but I'm wondering if there is a way to avoid
that.
Thanks!
Joel Shellman--
Marc Prud'hommeaux [email protected]
SolarMetric Inc. http://www.solarmetric.com

Similar Messages

  • BDC for existing record in table control

    Hi,
    I have a requirement to change existing records in table control through BDC. Is there any way I can choose the respective record from Table Control through BDC dynamically.
    Regards
    Akash

    /J4I/015PER, this transaction is used for adding permits to Operation in WEC. It has list of operations in Table Control. Permit can be added for choosing the operation from table control.
    Our custom program is designed to add permits for the operation. So if I have to use the above transaction for adding permits, then first I have to choose the correct operation from the table control and then add permit.

  • Error in ALV : Field Does not exists in Output table .

    Hi All,
    In my ALV report, program get dumped and showing error when i tried to put a col named Distribution channel ion the alv.
    I have put the Distribution cannel field in the IT_FInal table , but still getting folwong errors :
    Error : Field Symbol is not been assigned.
    As Instructed i have passed            I_INTERFACE_CHECK              = 'X'.
    By this i am getting detail error that :
    Field Distribution channel does not exists in Output table & Heading for List is missing .
    But i have maintained the distribition channel in IT_Final table
    Please suggest wheather we have to define dis channel in any other place.
    Thanks in advance.
    Can any one help me regrarding this.
    Thanks in advance.

    Hello,
    You have to populate the same in the fieldcatalog as well, i think you have not maintained this field there.
    BR,
    Suhas
    PS: Also make it a point to follow-up on your previous post: [Error in ALV : Field Symbol not been assigned.|Error in ALV : Field Symbol not been assigned.]

  • Field does not exists Error - INSTALLATION TABLE

    We have applied ML MP9 on system database for our eRecruit Instance. We are getting a "Field does not exists" (for eg., INSTALLATION.GL) error for the components which refers to INSTALLATION table.
    The error gets resolved if we introduce a .value in PeopleCode.
    Note: Our Dev Instance is working fine which has ML MP9 applied on it.
    Please find the PeopleBooks Comments for the .value Property:
    Considerations Using INSTALLATION or OPTIONS Tables
    When using the INSTALLATION or OPTIONS table, you cannot use the Value property. You must use the old style format, not the field object format. For example, the following code is invalid:
    If %Page = Page.GP_RUN_TYPE And
    INSTALLATION.TL.Value = "N" Then
    &RS2.HideAllRows();
    Thanks & Regards
    Sudha

    Hello,
    You have to populate the same in the fieldcatalog as well, i think you have not maintained this field there.
    BR,
    Suhas
    PS: Also make it a point to follow-up on your previous post: [Error in ALV : Field Symbol not been assigned.|Error in ALV : Field Symbol not been assigned.]

  • HOW DO I ADD A FIELD TO "ALL" EXISTING RECORDS IN ADD BOOK

    Just trying to find an easy way to add a field to all my records...a text field....
    Any thoughts or input would be appreciated.
    THKS
    C.R.

    Hi P,
    Assuming that this, being asked in the AppleWorks community, is a question regarding an AppleWorks database document, the answer is, "Quite easily."
    Open the file, go Layout > Layout and choose the layout on which you wish the field to be placed.*
    Go Layout > Define fields (or press shift-command-D to get to the same place)
    Type the name of the new field into the Field Name box.
    Choose the type of field (Text) from the pop-up menu to the right of the box.
    Click Create.
    The new field will be added to the Field list in the dialogue.
    Repeat for each new field you want to add. When finished, click Done.
    The new field(s) will be added to all existing records, and will be placed on the active layout. You can add it/them to other layouts using Layout > Insert fields.
    Regards,
    Barry

  • How to insert a new record to table with foreign key

    I have 3 tables like this :
    CREATE TABLE PERSON (
    PK INTEGER NOT NULL,
    NAME VARCHAR(10),
    SSNUM INTEGER,
    MGR INTEGER);
    ALTER TABLE PERSON ADD CONSTRAINT PK_PERSON PRIMARY KEY (PK);
    ALTER TABLE PERSON ADD CONSTRAINT FK_PERSON FOREIGN KEY (MGR) REFERENCES
    PERSON (PK);
    /* Tables
    CREATE TABLE PROJECT (
    PK INTEGER NOT NULL,
    CODE_NAME INTEGER);
    ALTER TABLE PROJECT ADD CONSTRAINT PK_PROJECT PRIMARY KEY (PK);
    /* Tables
    CREATE TABLE XREF (
    PERSON INTEGER NOT NULL,
    PROJECT INTEGER NOT NULL);
    ALTER TABLE XREF ADD CONSTRAINT PK_XREF PRIMARY KEY (PERSON, PROJECT);
    ALTER TABLE XREF ADD CONSTRAINT FK_XREF1 FOREIGN KEY (PERSON) REFERENCES
    PERSON (PK);
    ALTER TABLE XREF ADD CONSTRAINT FK_XREF2 FOREIGN KEY (PROJECT) REFERENCES
    PROJECT (PK);
    I do like the way of "ReverseTutoral" and the file .jdo here :
    <?xml version="1.0" encoding="UTF-8"?>
    <jdo>
    <package name="reversetutorial">
    <class name="Person" objectid-class="PersonId">
    <extension vendor-name="kodo" key="class-column" value="none"/>
    <extension vendor-name="kodo" key="lock-column" value="none"/>
    <extension vendor-name="kodo" key="table" value="PERSON"/>
    <field name="name">
    <extension vendor-name="kodo" key="data-column"
    value="NAME"/>
    </field>
    <field name="person">
    <extension vendor-name="kodo" key="pk-data-column"
    value="MGR"/>
    </field>
    <field name="persons">
    <collection element-type="Person"/>
    <extension vendor-name="kodo" key="inverse"
    value="person"/>
    <extension vendor-name="kodo" key="inverse-owner"
    value="person"/>
    </field>
    <field name="pk" primary-key="true">
    <extension vendor-name="kodo" key="data-column"
    value="PK"/>
    </field>
    <field name="ssnum">
    <extension vendor-name="kodo" key="data-column"
    value="SSNUM"/>
    </field>
    <field name="xrefs">
    <collection element-type="Xref"/>
    <extension vendor-name="kodo" key="inverse"
    value="person"/>
    <extension vendor-name="kodo" key="inverse-owner"
    value="person"/>
    </field>
    </class>
    <class name="Project" objectid-class="ProjectId">
    <extension vendor-name="kodo" key="class-column" value="none"/>
    <extension vendor-name="kodo" key="lock-column" value="none"/>
    <extension vendor-name="kodo" key="table" value="PROJECT"/>
    <field name="codeName">
    <extension vendor-name="kodo" key="data-column"
    value="CODE_NAME"/>
    </field>
    <field name="pk" primary-key="true">
    <extension vendor-name="kodo" key="data-column"
    value="PK"/>
    </field>
    <field name="xrefs">
    <collection element-type="Xref"/>
    <extension vendor-name="kodo" key="inverse"
    value="project"/>
    <extension vendor-name="kodo" key="inverse-owner"
    value="project"/>
    </field>
    </class>
    <class name="Xref" objectid-class="XrefId">
    <extension vendor-name="kodo" key="class-column" value="none"/>
    <extension vendor-name="kodo" key="lock-column" value="none"/>
    <extension vendor-name="kodo" key="table" value="XREF"/>
    <field name="person">
    <extension vendor-name="kodo" key="pk-data-column"
    value="PERSON"/>
    </field>
    <field name="person2" primary-key="true">
    <extension vendor-name="kodo" key="data-column"
    value="PERSON"/>
    </field>
    <field name="project">
    <extension vendor-name="kodo" key="pk-data-column"
    value="PROJECT"/>
    </field>
    <field name="project2" primary-key="true">
    <extension vendor-name="kodo" key="data-column"
    value="PROJECT"/>
    </field>
    </class>
    </package>
    </jdo>
    Data of those tables are :
    PERSON :
    | PK | NAME | SSNUM | MGR |
    | 1 | ABC | 1 | 1 |
    | 2 | DEF | 5 | 1 |
    PROJECT
    | PK | CODE_NAME |
    | 1 | 12 |
    | 2 | 13 |
    And now I want to add a new record into table XREF : insert into XREF
    values (1,1);
    public void createData() {
    Xref xref = new Xref();
    Person person = new Person(1);
    Project project = new Project(1);
    xref.setPerson(person);
    xref.setProject(project);
    person.getXrefs().add(xref);
    person.getXrefs().add(xref);
    pm.currentTransaction().begin();
    pm.makePersistent(xref);
    pm.currentTransaction().commit();
    I don't know why Kodo automatically insert new record to table PERSON ->
    confilct Primary Key. The errors are :
    0 [main] INFO kodo.Runtime - Starting Kodo JDO version 2.4.1
    (kodojdo-2.4.1-20030126-1556) with capabilities: [Enterprise Edition
    Features, Standard Edition Features, Lite Edition Features, Evaluation
    License, Query Extensions, Datacache Plug-in, Statement Batching, Global
    Transactions, Developer Tools, Custom Database Dictionaries, Enterprise
    Databases, Custom ClassMappings, Custom ResultObjectProviders]
    41 [main] WARN kodo.Runtime - WARNING: Kodo JDO Evaluation expires in 29
    days. Please contact [email protected] for information on extending
    your evaluation period or purchasing a license.
    1627 [main] INFO kodo.MetaData -
    com.solarmetric.kodo.meta.JDOMetaDataParser@e28b9: parsing source:
    file:/D:/AN/Test/classes/reversetutorial/reversetutorial.jdo
    3092 [main] INFO jdbc.JDBC - [ C:23387093; T:19356985; D:10268916 ] open:
    jdbc:firebirdsql:localhost/3050:D:/An/test/temp.gdb (sysdba)
    3325 [main] INFO jdbc.JDBC - [ C:23387093; T:19356985; D:10268916 ]
    close:
    com.solarmetric.datasource.PoolConnection@164dbd5[[requests=0;size=0;max=70;hits=0;created=0;redundant=0;overflow=0;new=0;leaked=0;unavailable=0]]
    3335 [main] INFO jdbc.JDBC - [ C:23387093; T:19356985; D:10268916 ] close
    connection
    3648 [main] INFO jdbc.JDBC - Using dictionary class
    "com.solarmetric.kodo.impl.jdbc.schema.dict.InterbaseDictionary" to
    connect to "Firebird" (version "__WI-V6.2.972 Firebird 1.0.3)WI-V6.2.972
    Firebird 1.0.3/tcp (annm)/P10") with JDBC driver "firebirdsql jca/jdbc
    resource adapter" (version "0.1")
    4032 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ] open:
    jdbc:firebirdsql:localhost/3050:D:/An/test/temp.gdb (sysdba)
    4143 [main] INFO jdbc.SQL - [ C:25657668; T:19356985; D:10268916 ]
    preparing statement <3098834>: INSERT INTO XREF(PERSON, PROJECT) VALUES
    4224 [main] INFO jdbc.SQL - [ C:25657668; T:19356985; D:10268916 ]
    executing statement <3098834>: [reused=1;params={(int)1,(int)1}]
    4244 [main] INFO jdbc.SQL - [ C:25657668; T:19356985; D:10268916 ]
    preparing statement <9090824>: INSERT INTO PERSON(MGR, NAME, PK, SSNUM)
    VALUES (?, ?, ?, ?)
    4315 [main] INFO jdbc.SQL - [ C:25657668; T:19356985; D:10268916 ]
    executing statement <9090824>: [reused=1;params={null,null,(int)1,(int)0}]
    4598 [main] WARN jdbc.JDBC - java.sql.SQLWarning: java.sql.SQLWarning:
    resultSetType or resultSetConcurrency changed
    4598 [main] WARN jdbc.JDBC - java.sql.SQLWarning: java.sql.SQLWarning:
    resultSetType or resultSetConcurrency changed
    4598 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ] begin
    rollback
    4608 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ] end
    rollback 10ms
    4628 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ]
    close:
    com.solarmetric.datasource.PoolConnection@1878144[[requests=2;size=2;max=70;hits=0;created=2;redundant=0;overflow=0;new=2;leaked=0;unavailable=0]]
    4628 [main] INFO jdbc.JDBC - [ C:25657668; T:19356985; D:10268916 ] close
    connection
    javax.jdo.JDOFatalDataStoreException:
    com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
    [SQL=INSERT INTO PERSON(MGR, NAME, PK, SSNUM) VALUES (null, null, 1, 0)]
    [PRE=INSERT INTO PERSON(MGR, NAME, PK, SSNUM) VALUES (?, ?, ?, ?)]
    GDS Exception. violation of PRIMARY or UNIQUE KEY constraint "PK_PERSON"
    on table "PERSON" [code=335544665;state=null]
    NestedThrowables:
    com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
    [SQL=INSERT INTO PERSON(MGR, NAME, PK, SSNUM) VALUES (null, null, 1, 0)]
    [PRE=INSERT INTO PERSON(MGR, NAME, PK, SSNUM) VALUES (?, ?, ?, ?)]
    GDS Exception. violation of PRIMARY or UNIQUE KEY constraint "PK_PERSON"
    on table "PERSON"
    at
    com.solarmetric.kodo.impl.jdbc.runtime.SQLExceptions.throwFatal(SQLExceptions.java:17)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:416)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:575)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:438)
    at reversetutorial.Finder.createData(Finder.java:74)
    at reversetutorial.Finder.main(Finder.java:141)
    NestedThrowablesStackTrace:
    org.firebirdsql.jdbc.FBSQLException: GDS Exception. violation of PRIMARY
    or UNIQUE KEY constraint "PK_PERSON" on table "PERSON"
    at
    org.firebirdsql.jdbc.FBPreparedStatement.internalExecute(FBPreparedStatement.java:425)
    at
    org.firebirdsql.jdbc.FBPreparedStatement.executeUpdate(FBPreparedStatement.java:136)
    at
    com.solarmetric.datasource.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:111)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatementNonBatch(SQLExecutionManagerImpl.java:542)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatement(SQLExecutionManagerImpl.java:511
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeInternal(SQLExecutionManagerImpl.java:405)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.flush(SQLExecutionManagerImpl.java:272
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:411)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:575)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:438)
    at reversetutorial.Finder.createData(Finder.java:74)
    at reversetutorial.Finder.main(Finder.java:141)
    at org.firebirdsql.gds.GDSException: violation of PRIMARY or UNIQUE KEY
    constraint "PK_PERSON" on table "PERSON
    at org.firebirdsql.jgds.GDS_Impl.readStatusVector(GDS_Impl.java:1683)
    at org.firebirdsql.jgds.GDS_Impl.receiveResponse(GDS_Impl.java:1636)
    at org.firebirdsql.jgds.GDS_Impl.isc_dsql_execute2(GDS_Impl.java:865)
    at
    org.firebirdsql.jca.FBManagedConnection.executeStatement(FBManagedConnection.java:782)
    at
    org.firebirdsql.jdbc.FBConnection.executeStatement(FBConnection.java:1072)
    at
    org.firebirdsql.jdbc.FBPreparedStatement.internalExecute(FBPreparedStatement.java:420)
    at
    org.firebirdsql.jdbc.FBPreparedStatement.executeUpdate(FBPreparedStatement.java:136)
    at
    com.solarmetric.datasource.PreparedStatementWrapper.executeUpdate(PreparedStatementWrapper.java:111)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatementNonBatch(SQLExecutionManagerImpl.java:542)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatement(SQLExecutionManagerImpl.java:511)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeInternal(SQLExecutionManagerImpl.java:405)
    at
    com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.flush(SQLExecutionManagerImpl.java:272)
    at
    com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:411)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:575)
    at
    com.solarmetric.kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:438)
    at reversetutorial.Finder.createData(Finder.java:74)
    at reversetutorial.Finder.main(Finder.java:141)
    Exception in thread "main"

    First off, use the '-primaryKeyOnJoin true' flag when running the reverse
    mapping tool so that you can get rid of that useless Xref class and have
    a direct relation between Person and Project. See the documentation on
    reverse mapping tool options here:
    http://www.solarmetric.com/Software/Documentation/latest/docs/ref_guide_pc_reverse.html
    But your real problem is that you are creating new objects, assigning
    primary key values, and expecting them to represent existing objects.
    That's not the way JDO works. If you want to set relations to existing
    objects in JDO, you use the PM to look up those objects. If you try to
    create new objects, JDO will assume you want to insert new records into
    the DB, and you'll get PK conflicts like you see here.
    There are several good books out on JDO; if you're just starting out with
    it, they might save you a lot of time and help you master JDO quickly.

  • Inserting existing records to table and getting new identity ID for each row

    I have an issue that I inherited where I need to insert some data to  12 tables related by FK  for about 40 records to an existing database through TSQL, SSIS is not an option..
    Essentially the situation is that many weeks ago someone deleted a bunch of data and I cant do a restore of the database as new data has been entered so I need to "reconstruct" the data and reinsert it back. I cant just reinsert the data with the
    same Primary keys as they are autogenerated. I restored a backup of the database taken prior to the deletion and have got all of my data I need loaded to temp tables. Now the issue I am running across is how to insert my "Main" table data row by
    row and get the new identity and then update the corresponding row to the source temp table so that it can be used for the next 11 tables that need that Foreign Key.

    How do I loop through the 40 records I am attempting to insert into the "Parent" table though?
    You don't. That is, you don't loop.
    You do:
    MERGE target t
    USING source s ON 1 = 0
    WHEN NOT MATCH BY TARGET THEN
       INSERT (col1, col2, ...)
          VALUES(col1, col2, ...)
    OUTPUT (t.JobId, s.JobId) INTO @idmap(newid, oldid)
    UPDATE source
    SET    newjobdid = i.newid
    FROM   source s
    JOIN   @idmap i ON s.jobid = i.jobid
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Problem in modifying the existing record in table control

    Hi Experts,
    I have one table control.I have entered one record and save it.When I am modifying the same record a duplicate record is created.I need if I modify the same record that record should only modify.How to delete the duplicate record.

    Hi,
    In Flow logic.
    LOOP .                        
      MODULE tbc_modify ON CHAIN-REQUEST.
      MODULE tbc_mark.     
    ENDLOOP.    
    In module.
    MODULE tbc_modify INPUT.
      MODIFY t_data
        FROM fs_data
       INDEX tbc-current_line.
      IF sy-subrc NE 0.
        APPEND fs_data TO t_data.
      ENDIF.                              
    ENDMODULE.                            
    MODULE tbc_mark INPUT.
      DATA: tbc_wa2 LIKE LINE OF t_data.
      IF tbc-line_sel_mode = 1
      AND fs_data-mark = 'X'.
        LOOP AT t_data  INTO tbc_wa2
         WHERE mark = 'X'.
          tbc_wa2-mark = ''.
          MODIFY t_data
            FROM tbc_wa2
            TRANSPORTING mark.
        ENDLOOP.                          .
      ENDIF.                             
      MODIFY t_data  FROM fs_data
        INDEX tbc-current_line
        TRANSPORTING mark.      
    ENDMODULE.
    Edited by: sapabap403 on Aug 31, 2011 9:29 AM

  • How to compare two records of table

    Hi all,
    How to compare new record with all existing records in table.
    In my application i have status column ,which contains the information about
    the record is new or old record .
    thank you

    /*does record 1 have friend*/
    WITH t AS
    (SELECT 1 AS Id, 'a' AS NAME, 'type1' AS Col
      FROM Dual
      UNION ALL
      SELECT 2 AS Id, 'a' AS NAME, 'type1' AS Col
      FROM Dual
      UNION ALL
      SELECT 3 AS Id, 'a' AS NAME, 'type2' AS Col FROM Dual)
    SELECT count(*) as YesNo
    FROM t T1
    WHERE T1.Id = 1
          AND (T1.Name, T1.Col) IN (SELECT T2.Name, T2.Col FROM T t2 where t2.ID != T1.Id);
         1
    /*does record 3 have friend*/
    WITH t AS
    (SELECT 1 AS Id, 'a' AS NAME, 'type1' AS Col
      FROM Dual
      UNION ALL
      SELECT 2 AS Id, 'a' AS NAME, 'type1' AS Col
      FROM Dual
      UNION ALL
      SELECT 3 AS Id, 'a' AS NAME, 'type2' AS Col FROM Dual)
    SELECT count(*) as YesNo
    FROM t T1
    WHERE T1.Id = 3
       AND (T1.Name, T1.Col) IN (SELECT T2.Name, T2.Col FROM T t2 where t2.ID != T1.Id);
         0
    */

  • Add a new field to an existing Condition table

    How can I add a new field to an existing condition table?
    I have table 971 and I want to add INCOTERMS (INCO1) to this existing table but do not see how to add it.
    Thanks

    Hi Vicky,
        I dont think you can add new fields to the condition table once you have activated the condition table.
    SAP says you can only make limited changes to the condition table, like changing the description, fast entry screen, header and footer fields, but not able to add new fields to the table, and I think that is the correct approch or else for the same table you will have two sets of condition records.
    Please refer to the below link:
    http://help.sap.com/saphelp_erp60_sp/helpdata/en/de/7a8534c960a134e10000009b38f83b/frameset.htm
    What you can do is create a new condition table with additional field and assign this table before the currently used table in the access sequence.
    Hope this helps.
    Regards
    Raj

  • How to know the R/3 table field mapped to BW info object!

    Hi,
    I have an extractor which is extracting the data from R/3 using View in generic data source.
    Now i am making a documentaion of each infoobject involved in the extraction of how exactly it is mapped and how is it getting filled.
    In transfer rules i could find the R/3 find easily but i want a table as well as i need to make a screen shots as well for the documentaion.
    Example, the field AUFNR which is order number is existing in three tables namely AFRU,AUFK and AFKO ( all are used in view definition )
    Now how can i ensure that from whcih table the data is getting filled to the BW info object?
    Any suggestions would be appreciated .
    Thanks,
    Ravi

    Hi Ravi,
    Check this blog:
    <a href="/people/sap.user72/blog/2005/09/05/sap-bw-and-business-content-datasources-in-pursuit-of-the-origins BW: In pursuit of the Origins</a>
    Udo

  • OC4j10.1.2CMP bean not updating field after creating a record in the table.

    I have a simple table in Oracle 9i database:
    SQL> desc temp_tbl
    Name Null? Type
    OPER_ID NOT NULL NUMBER(5)
    OPER_STS_TM_DT NOT NULL DATE
    OPER_STS_CD NUMBER(2)
    First 2 fields are the Primary Key. last field is standalone. No FK references.
    I generate a CMP bean using Jdeveloper 10.1.2 for this table.
    Then I try to insert a record into this table and update the oper_sts_cd field.
    Problem: CMP inserts the record correctly, but does not update the field: oper_sts_cd, even though trace indicates that the field has been updated.
    ( shown in pgm below).
    THE SAME CODE WORKED in OC4J9.0.4 Container.
    Since we upgraded to 10g Rel2 ( OC4J10.1.2) , it does not.
    Code:
    Session Bean:
    package model;
    import java.rmi.RemoteException;
    import java.sql.Timestamp;
    import java.util.Calendar;
    import javax.ejb.CreateException;
    import javax.ejb.FinderException;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    public class SessionEJBBean implements SessionBean
    public void ejbCreate()
    public void ejbActivate()
    public void ejbPassivate()
    public void ejbRemove()
    public void setSessionContext(SessionContext ctx)
    private TempTblLocalHome getTempTblLocalHome() throws NamingException
    final InitialContext context = new InitialContext();
    return (TempTblLocalHome)context.lookup("java:comp/env/ejb/local/TempTbl");
    public void createOperation() throws RemoteException
    try
    TempTblLocalHome tempHome = (TempTblLocalHome) this.getTempTblLocalHome();
    System.out.println("Succcess loading Temp Entity EJB");
    Timestamp currDate = new Timestamp(Calendar.getInstance()
    .getTimeInMillis());
    TempTblLocal tempLocal = tempHome.create(new Long("1294"),currDate,new Long("1") );
    System.out.println("created Temp Op=" + tempLocal.getOperId() + " date=" + tempLocal.getOperStsTmDt() );
    //tempLocal.setOperStsCd(new Long("" + 1) );
    Long stsTypeCd = new Long("1");
    System.out.println("Putting long value in db=" + stsTypeCd + "-");
    tempLocal.setOperStsCd(stsTypeCd);
    System.out.println("Stored value in db=" + tempLocal.getOperStsCd() );
    catch( NamingException ne)
    throw new RemoteException(ne.getMessage());
    catch(CreateException ce)
    throw new RemoteException(ce.getMessage());
    ejb-jar (generated)
    <entity>
    <description>Entity Bean ( CMP )</description>
    <display-name>TempTbl</display-name>
    <ejb-name>TempTbl</ejb-name>
    <local-home>model.TempTblLocalHome</local-home>
    <local>model.TempTblLocal</local>
    <ejb-class>model.TempTblBean</ejb-class>
    <persistence-type>Container</persistence-type>
    <prim-key-class>model.TempTblPK</prim-key-class>
    <reentrant>False</reentrant>
    <cmp-version>2.x</cmp-version>
    <abstract-schema-name>TempTbl</abstract-schema-name>
    <cmp-field>
    <field-name>operId</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>operStsTmDt</field-name>
    </cmp-field>
    <cmp-field>
    <field-name>operStsCd</field-name>
    </cmp-field>
    <query>
    <query-method>
    <method-name>findAll</method-name>
    <method-params/>
    </query-method>
    <ejb-ql>select object(o) from TempTbl o</ejb-ql>
    </query>
    </entity>
    <container-transaction>
    <method>
    <ejb-name>TempTbl</ejb-name>
    <method-name>*</method-name>
    </method>
    <trans-attribute>Supports</trans-attribute>
    </container-transaction>
    orion-ejb-jar.xml (generated):
    <entity-deployment name="TempTbl" data-source="jdbc/Marcs_DS" table="MARCS.TEMP_TBL">
    <primkey-mapping>
    <cmp-field-mapping>
    <fields>
    <cmp-field-mapping name="operId" persistence-name="OPER_ID" persistence-type="NUMBER(5)"/>
    <cmp-field-mapping name="operStsTmDt" persistence-name="OPER_STS_TM_DT" persistence-type="DATE"/>
    </fields>
    </cmp-field-mapping>
    </primkey-mapping>
    <cmp-field-mapping name="operId" persistence-name="OPER_ID" persistence-type="NUMBER(5)"/>
    <cmp-field-mapping name="operStsTmDt" persistence-name="OPER_STS_TM_DT" persistence-type="DATE"/>
    <cmp-field-mapping name="operStsCd" persistence-name="OPER_STS_CD" persistence-type="NUMBER(2)"/>
    </entity-deployment>

    >
    Srini.r wrote:
    > I have added a new field in IT0006
    > Srini R
    Have you done this through PM01?
    ~Suresh

  • How to add one more field to an exist internal table

    hi abapers
    i am a very new abap programmer and just started learning it.
    i want to know How to add one more field to an exist internal table.
    lemme me put my question in a very simple way.
    i have a internal table having fields f1,f2,f3 and which also that internal also contains some data.
    now i want to add two more fields (mm & nn) to that internal table now.
    how can i do that.
    and i wanna know the websites names where i can find some brain teasing questions in abap programming.
    eagerly waiting for ur reply
    regards,
    Maqsood A Khan

    Hi, MAQSOOD.
    You can insert more fields in your internal table like this.
    refer this code snippet.
    DATA : BEGIN OF tbl_itab OCCURS 0.
            INCLUDE STRUCTURE zsdtc009.
    DATA :  vkorg   LIKE vbak-vkorg,  "inserted one
            vtweg   LIKE vbak-vtweg,  "inserted one
            vkbur   LIKE vbak-vkbur,  "inserted one
            vkgrp   LIKE vbak-vkgrp,  "inserted one
           END OF tbl_itab.
    you can also read the book "Teach yourself abap in 21 days"
    at http://cma.zdnet.com/book/abap/
    but that book is just about basic concept of abap and report program.
    it doesn't give a lecture for on-line program.
    you can get pdf version books(about abap, sap...things) from sap.
    http://help.sap.com/printdocu/core/Print46c/en/Data/htm/english.htm
    I wish I could help you.
    Regards
    Kyung Woo.

  • Adding new field in an existing condition table

    Dear friends,
    I have an existing condition table for material exclusion with the combination of Plant and material.
    Is it possible to change this table and add a field of division also?
    Regards,
    Ronnie

    Hi,
    The optimzed solution is to better create a new sequence of fields including the division, so that a new condition table is created based on the key combination or access sequence.
    You can add a new field to an existing condition table using APPEND structure facility in Se11. But once on activating the table, how will this division field get populated in the table.
    But whereas if you create a new key combination, the data for this condition tables will automatically gets filled up while creating master data thro VK11.
    So, its better to go for a new access sequence combination
    as a new table is created for this key combinations.
    Regards,
    JLN

  • Specify field mapping when changing table location

    I want to change the tables in a report to refer to database tables with a different schema, and specify the mapping of fields in code.
    I already have code that changes table locations successfully when the schema does not differ, using the RAS API. As far as I can tell, the RAS API doesn't have a way of handling schema differences. Is that true?
    OTOH, the higher-level CR API does appear to have a mechanism to do field mapping, using the FieldMapping event in the ReportDocument class. I've been trying to use this API for the job, but I don't seem to be able to change the location of a table in the report.
    Here's an example scenario:
    The report was created using an ODBC data source Source1 that contains a table Table1
    I have an ODBC data source Source2 that contains Table1 as well as a table Table2 that is identical to Table1 except that the field names are all slightly different
    I want to change the report so that it uses Table2 in Source2
    I've managed to get the report switched to Source2 with code like this:
    report.DataSourceConnections[0].SetConnection("Source2", "", id, pwd);
    Here's the code I'm using to try to change the report table to refer to Table2:
                Table table = report.Database.Tables[0]; // only one table in the report
                TableLogOnInfo logOnInfo = table.LogOnInfo;
                logOnInfo.TableName = "Table2";
                table.ApplyLogOnInfo(logOnInfo);
                report.VerifyDatabase();
    I've also tried the simpler
    table.Location = "Table2";
    Neither approach changes the table location. I know this because when I preview the report I see data. Since the field names are all different, changing the location should have removed all the fields from the report. (Also, the event handler I have hooked up to the FieldMapping event is not called. Yes, I did enable the event in the ReportDocument.)
    So:
    How do you change the location of a table using the high-level API?
    If you change the location using the RAS API, is the FieldMapping event fired? (Haven't tried this, but somehow I doubt it.)
    Is there a way to do field mapping with the RAS API?
    Thanks!
    - rick cameron

    Hi Rick
    This is not considered a bug. It is a limitation that has been discusses extensively in many of our internal meetings. The implementation job proved to be much too massive and with highly limited ROI. E.g.; the number of requests for the feature is just not there...
    - Ludek
    Senior Support Engineer AGS Product Support, Global Support Center Canada
    Follow us on Twitter

Maybe you are looking for

  • How to take parts of a web page and feed into a PDF template to create a PDF

    Interesting quesiton that I think was what LiveCycle was for: How can someone take parts of a web page or xml document (say by id name or a specialized tag) and feed the chosen items into different regions inside a PDF template? Basically, can you id

  • Need to create a PDF with submit button for Wordpress Website.

    I need to create a restaurant's employment application in PDF form with fields that user can fill out and a submit button to send the form to a specified email. I then need to put this PDF online on client's website. Is this possible with ID?

  • How to update duplicate row from table

    Hi, how to update duplicate row from table? First to find duplicate row then update duplicate row with no to that duplicate row in oracle. can you give me suggestion on it? Thanks in advance. your early response is appreciated...

  • Airport Express Ethernet

    I have an Airport Express and I have used it as a extension from my Airport Extreme. I have brought it into work today to create a wireless signal via an ethernet cable but the light is flashing orange and is sending out no signal. Do I have to re-co

  • Want to execute SQL Queries from Textfile

    I have a text file full of a bunch of sql queries, of the format: select something1, something2 from someplace select something3, something4 from someplace2 select something5, something6 from someplace3 I want to execute these queries one at a time a