Database tables with foreihn key

There is two database table JOBS,WORK ALLOCATION. Jobid is the primary key of jobs table and foreign key in work allocation table.I have created the data control of jobs and drag it on jspx page as a adf form. On commit operation i want to insert data in jobs table and jobid in workallocation table also.I can'nt use master-detail table as later on i have another constraint on workallocation table.so,please suggest a workaround to achive this.
Plz
Thanks

Hi,
I am not sure I understand your use-case.
When you insert a new JOB record you need a new record also created in the WORK_ALLOCATION table having the same jobId?
Is the Job -> Work_Allocation relation "1 to 1"?
Please give us a better picture and tell us your jdev version and whether you are using ADF BC.
Gabriel

Similar Messages

  • Updating database table with DUPLICATE keys

    i have an internal table having data as follows.
    emp_id     name     date           proj_id  activity_id    Hours  Remarks
    101     Pavan    09.10.2007      123     1         2.00       Coding
    101     Pavan     09.10.2007   124     2         1.00        Documentation
    102     Raj     09.10.2007   123        3         6.00     Testing
    Now i need to update a Ztable with above mentioned data.
    The structure of the Ztable is as follows.
    Mandt     emp_id  name    date    proj_id   activity_id   Hours   Remarks
    NOte: i have ticked both check boxes for the field MANDT in table.
    Rest didnt select the check boxes.
    I believe now the field MANDT alone is a primary key for the z-table.
    NOw i have tried with UPDATE/INSERT statments to update the database table.
    But instead of inserting all the rows, the system is over writing on the same emp_id row.
    Even tried with the statments like INSERT INTO <Ztable> values <Internal table> ACCEPTING DUPLICATE KEYS.
    But its not getting inserted as a separate row in the table.
    Requirement is to insert the multiple rows in the database table without any over writing activity.
    Can anyone give me the code to do this?
    Regards
    Pavan

    Hi Pavan,
        Please let me know what are the key fields in your Ztable. Try with below code it may help you. change the "Ztablename" as your database table name and I_INTERNAL TABLE  as your internal table name. still you are facing the problem please let me know.
    lock the custom table before updating the table.
      CALL FUNCTION 'ENQUEUE_E_TABLE'
       EXPORTING
      MODE_RSTABLE         = 'E'
         TABNAME              = 'ZTABLENAME'
      VARKEY               =
      X_TABNAME            = ' '
      X_VARKEY             = ' '
      _SCOPE               = '2'
      _WAIT                = ' '
      _COLLECT             = ' '
       EXCEPTIONS
         FOREIGN_LOCK         = 1
         SYSTEM_FAILURE       = 2
         OTHERS               = 3
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ELSE.
        INSERT  ZTABLENAME FROM TABLE I_INTERNALTABLE ACCEPTING DUPLICATE KEYS.
        COMMIT WORK.
      ENDIF.
    unlock after updating the custom table After updation is done.
      CALL FUNCTION 'DEQUEUE_E_TABLE'
       EXPORTING
        MODE_RSTABLE       = 'E'
         TABNAME            = 'ZTABLENAME'
        VARKEY             =
        X_TABNAME          = ' '
        X_VARKEY           = ' '
        _SCOPE             = '3'
        _SYNCHRON          = ' '
        _COLLECT           = ' '

  • How to update database table with key field?

    Hello Experts,
    I have a database table with following fields
    MATNR   - Key
    SSOUR  -  Key
    KUNNR   - Key
    MENG1 
    MENG2
    MENG3
    And this table contains records like...
    MSD50001     R      1000001     5.30    2.30    5.25
    MSD50002     R      1000002     5.30    2.30    5.25
    MSD50003     R      1000003     5.30    2.30    5.25
    MSD50005     R      1000004     5.30    2.30    5.25
    MSD50004     R      1000005     5.30    2.30    5.25
    I have an internal table with same fields of above database table.
    MSD50001     A      1000001     5.30    2.30    5.25
    MSD50002     A      1000002     5.30    2.30    5.25
    MSD50003     A      1000003     5.30    2.30    5.25
    MSD50005     A      1000004     5.30    2.30    5.25
    MSD50004     A      1000005     5.30    2.30    5.25
    MSD50006     A      1000006     5.30    2.30    5.25
    I want to update the DB table with following internal table records.
    If internal table records = db table records are same then Update....else insert from internal table to db table.
    But here, SSOUR is key field so i am not able to use
    MODIFY dbtab from itab.
    It results me , entries in internal table are inserted into db table.
    So i have double records.
    Is there any statement which updates the key field? and if no fields in db table then insert it?
    Regards
    RH

    hi,
    u cannot update akey field.u can update only non key fields by using key field as a selection criteria.For example if u go to sm30 if u enter any table for inserting values, the key field will always be greyed out it is not succumbed to chnges.but u can insert value into ,if ur inserting and in the insert staemnet if  u have key field which is already present in the table it will return sy-subrc = 4 otherwise it will insert the record and return 0.
    eg for update :
    UPDATE zdm_wtyprof  SET upload_status = 'S'
                             WHERE spart = wa_upd-spart.
    here spart is the key field and it will update the status field in the table as S.
    if updated succesfully it will return 0.
    SIMILARLY U CAN USE select.

  • Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the rows? Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    Hello Anybody, I have a question. Can any of you please suggest me how to make an xml file from the database table with all the records?
    Note:- I am having the XSD Schema file and the resulted XML file should be in that XSD format only.

    The Oracle documentation has a good overview of the options available
    Generating XML Data from the Database
    Without knowing your version, I just picked 11.2, so you made need to look for that chapter in the documentation for your version to find applicable information.
    You can also find some information in XML DB FAQ

  • Maintenance View for custom table with foreign key relationship

    Hi Folks,
         I have created a custom table with foreign key relationship with other check tables. I want to create a maintenance view / tablemaintenance generator. What all things I need to take care for the foreign keys related fields while creating the maintenance view / tablemaintenance generator.
    Regards,
      santosh

    Hi,
    You do not have to do anything explicitely for the foreign key relationships in the table maintainance generator.
    Create the table maintainance generator via SE11 and it will take care of all teh foreign key checks by itself.
    Regards,
    Ankur Parab

  • How to insert record in child table with foreign key

    Hi,
    I am using Jdeveloper 11.1.2.0. I have two master table one child table.
    How to insert and update a record in child table with foreign key ?
    I have created VO based on three EO(one eo is updatable other two eo are references) by using joined query.
    Thanks in Advance
    Edited by: 890233 on Dec 24, 2011 10:40 PM

    ... And here is the example to insert using sequenceimpl by getting the primary key of the master record and insert master and detail together.
    Re: Unable to insert a new row with a sequence generated column id
    -Arun

  • Select data from database tables with high performance

    hi all,
    how to select data from different database tables with high performance.
    im using for all entries instead of inner joins, even though burden on data base tables is going very high ( 90 % in se30)
    hw to increase the performance.
    kindly, reply.
    thnks

    Also Check you are not using open sql much like distict order by group by , use abap techniques on internal table to acive the same.
    also Dont use select endselect.
    if possible use up to n rows claus....
    taht will limit the data base hits.
    also dont run select in siode any loops.
    i guess these are some of the trics oyu can use to avoid frequent DATA BASE HITS AND ABVOID THE DATA BASE LAOD.

  • How to enter values to a database table with data type 'LCHR'?

    Hello All,
    I have created a database table with five fields, of which the last field is 'Value' field in which i have to enter text with a maximum of 1000characters. I have also specified a 'Length' field preceding the 'Value' field.
    The datatype specified for the 'Length' field is 'INT2' and for the value field is 'LCHR' with length 1000.
    When i tried inserting values to the table through a report, the report is giving an error that 'Literals that take up more than one line are not permitted', which means 255characters.
    Also, when i entered a short text which is less than 250 characters to the 'Value' field,, the report is working fine and the table entry is visible.
    Can anyone help me in this?
    It would be really helpful if you explain how to use 'LCHR' data type in tables and how to enter values to such a field with more than 255characters.
    Thanks in Advance,
    Shino

    Hi shino,
    Alternatively,
    you can use STRING instead of LCHR.
    I too have tried with LCHR and am facing the same issue.. i am not sure why its coming..
    i have tried STRING and its working perfectly.
    wa-key_field = 'IN4'.
    CONCATENATE  'Long text over 200 chars length '
                  'another Long text over 200 chars length '
                  'another Long text over 200 chars length '
                  INTO wa-long_text.
      wa-len = strlen( wa-long_text ).
      INSERT zshino_table from wa.
      SELECT * FROM zshino_table INTO table it.
      clear wa.
      LOOP AT it INTO wa.
          WRITE:/ wa-len, '  ' , wa-long_text.
      ENDLOOP.
    Also, remember to set the type of the database field as String.
    hope this was of some help,
    thanks and regards,
    Sagar.

  • Copying database table with data

    Dear Team,
    I want to copy a database table with all entries of that table. example: if i am copying MARA table as ZMARA i want all the entries of MARA should also exist in ZMARA.
    Is it possible to do this without writing any piece of code.
    Regards,
    N.Jain

    Hi,
    It is not possible to do the same without coding.
    Regards,
    Sriram
    Edited by: Srirama Murthy Maddirala on Jun 4, 2008 11:14 AM

  • Database table with potentially millions of records

    Hello,
    We want to keep track of user's transaction history from the performance database.  The workload statistics contain the user transaction history information, however since the workload performance statistics are intended for temporary purposes and data from these tables are deleted every few months, we loose all the user's historical records.
    We want to keep track of the following in a table that we can query later:
    User ID      - Length 12
    Transaction  - Length 20
    Date         - Length 8
    With over 20,000 end users in production this can translate into thousands of records to be inserted into this table daily.
    What is the best way to store this type of information?  Is there a specific table type that is designed for storing massive data quantity?  Also, over time (few years) this table can grow into millions or hundreds of millions of records.  How can we manage that in terms of performance and storage space?
    If anyone has worked with database tables with very large amounts of records, and would like to share your experiences, please let us know how we could/should structure this function in our environment.
    Best Regards.

    Hi SS
    Alternatively, you can use a <u>cluster table</u>. For more help refer to F1 help on <b>"IMPORT TO / EXPORT FROM DATABASE"</b> statements.
    Or you can store data as a <u>file</u> on the application server using <b>"OPEN DATASET, TRANSFER, CLOSE DATASET"</b> statements.
    You can also select to archieve data of older than some definite date.
    You can also mix your alternatives for the recent and archieve data.
    *--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>

  • Sample report for filling the database table with test data .

    Hi ,
    Can anyone provide me sample report for filling the database table with test data ?
    Thanks ,
    Abhi.

    hi
    the code
    data : itab type table of Z6731_DEPTDETAIL,
           wa type Z6731_DEPTDETAIL.
    wa-DEPT_ID = 'z897hkjh'.
    wa-DESCRIPTION = 'computer'.
    append wa to itab.
    wa-DEPT_ID = 'z897hkjhd'.
    wa-DESCRIPTION = 'computer'.
    append wa to itab.
    loop at itab into wa.
    insert z6731_DEPTDETAIL from wa.
    endloop.
    rewards if helpful

  • Access key needed when creating a new database table with SE11

    Hi,
    I'm using SAP Testdrive (evaluation) on linux in order to learn a bit about ABAP programming. I want to create a new database table in the  dictionary to be used in my programs. I proceed in the following way:
    1) I run the SE11 transaction
    2) At the first entry I write the name of the table to be created (in the Database Table field)
    3) I click on the create button.
    But then the system asks me an Access Key to register, where can I get this?
    Thanks in advance,
    Kind Regards,
    Dariyoosh

    Ok I found the answer to my question in another thread
    Developer Key
    Make sure that your program names starts with "Z" or "Y", otherwise the system will ask you to register the object because it thinks you are creating/changing in the SAP namespace.
    In fact this was my error, my table name didn't start with neither "Z" nor "Y".
    Kind Regards,
    Dariyoosh
    Edited by: dariyoosh on Nov 13, 2010 12:34 PM

  • Help.......... required :Database table with no primary key

    Hi All,
    I have a table sponsor_logos whose structure is as follows:
    sl__sponsorid number,
    sl__clubid number,
    sl_hallno varchar2(7) not null,
    sl_logofilename varchar2(100) not null,
    sl_date_modified date not null
    Where in the sl__sponsorid and sl__clubid are foreign keys and I do not have any primary key for the table.
    I need to insert into and also delete records from the table.
    I have gone through various topics in the java forum for EJB's to find out what design strategy should I use?
    Some say that if a table does not have primary keys, and if the table is represented by a CMP entity bean all the fields of the table are considered as a part of primary key.In that case what would my code look like and what would my deployment descriptor contain?????
    According to the specification, the CMP or a BMP represents a unique record in a database.In that case should I be using a Session bean to handle insertions and deletions for the table?
    Since this is my first project with EJB's I am really confused as to what design should I be using for this situation. Since I have a time constraint I can't take a long time to decide on what strategy I should use.
    Suggestions regarding this are welcome .

    Hi Maris,
    I have my PK class ready with all the fields in it.
    Deployment descriptor ready with <prim-key-class>package.SponsorLogoPK</prim-key-class>
    . According to descriptor specification there is no need to have an entry for
    <primkey-field>bookingSlNo</primkey-field>
    in case of custom primary key .
    So I have omitted <primkey-field>bookingSlNo</primkey-field>
    I have used the verifier tool and verified the ejb , no errors with regards to this ejb, but , getting errors while deploying:
    An error has occurred.
    Deployment Error -- Error while running ejbc -- Fatal Error from EJB Compiler -- JDO74025: JDOCodeGenerator: Caught an Exception validating CMP bean 'SponsorLogoBean' in application 'resnet_ejb' module 'E:\Sun\AppServer\domains\domain1\applications\j2ee-modules\resnet': JDO72335: If the table SPONSOR_LOGOS for the bean corresponding to the generated class com.resnet.squash.api.entity.SponsorLogoBean483209734_JDOState is mapped as the primary table, it must have a primary key. Choose a different primary table or verify that the contents of the schema file are correct.
    Now what could the problem be . Do I need to do any other setting in the descriptor. I have the cmp-mapping also intact.

  • Issue creating a Database table with a decimal key field

    Hi guys!
    Can you try this?
    - Create a Database Table ZTEST via SE11 with just the client field and a decimal field (which has to be a key field)
    - Create a corresponding text table for ZTEST with SPRAS, and a TEXT field
    - Create the dialog maintance view and enter some random data through SM30 (5 or 6 rows)
    Then go to SE11, display table ZTEST and click contents to show the data you just entered.
    Is there anything strange? In my case there is, actually: Not all text fields are shown, nevertheless if i try to display the data through SM30 the data is shown correctly....
    I've tried this in several releases and is always the same.
    Do you know why this is?
    Thanks in advance.

    Thanks for the answer.
    Unfortunately, this is not the case, the tables are correctly linked.
    Please look at the following snapshot, the first one, corresponds to the SE11 of the original table, the second one is the SE11 of the text table, and finally the third one is the SM30 of the original table.
    [Snapshot|http://img100.imageshack.us/img100/5071/testkl.jpg]

  • Best Practice loading Dimension Table with Surrogate Keys for Levels

    Hi Experts,
    how would you load an Oracle dimension table with a hierarchy of at least 5 levels with surrogate keys in each level and a unique dimension key for the dimension table.
    With OWB it is an integrated feature to use surrogate keys in every level of a hierarchy. You don't have to care about
    the parent child relation. The load process of the mapping generates the right keys and cares about the relation between the parent and child inside the dimension key.
    I tried to use one interface per Level and created a surrogate key with a native Oracle sequence.
    After that I put all the interfaces in to one big Interface with a union data set per level and added look ups for the right parent child relation.
    I think it is a bit too complicated making the interface like that.
    I will be more than happy for any suggestions? Thank you in advance!
    negib
    Edited by: nmarhoul on Jun 14, 2012 2:26 AM

    Hi,
    I do like the level keys feature of OWB - It makes aggregate tables very easy to implement if your sticking with a star schema.
    Sadly there is nothing off the shelf with the built in knowledge modules with ODI , It doesnt support creating dimension objects in the database by default but there is nothing stopping you coding up your own knowledge module (use flex fields maybe on the datastore to tag column attributes as needed)
    Your approach is what I would have done, possibly use a view (if you dont mind having it external to ODI) to make the interface simpler.

Maybe you are looking for

  • How do I create a chat in my server?

    I am building an mmorpg game and one of my first tasks is to create a chat, now I have no idea about how it is working. The only thing that I do know is that there is two ways to do it, one of them will force me to update my chat page all the time an

  • Report Viewer error on export PDF or Excel from Azure Web Sites

    Hi, When I try to export any RDLC report on PDF or Excel I obtain the error: [ArgumentException: Parameter is not valid.]    System.Drawing.Graphics.GetHdc() +1153145    Microsoft.ReportingServices.Rendering.RichText.LineBreaker.Flow(TextBox textBox,

  • Incoming Email in SharePoint 2013

    Trevor, Side question - I need to configure incoming email; since I have multiple WFE Servers & APP Servers and based on Q&A at the link below (is the hotfix part of the December cumulative update 15.0.4551.1511 or I have to apply it separately)? htt

  • Slow Printing with HP 940 C

    I haven't posted here for quite a while but was wondering if anyone has ever found a way to speed up the printing. When I was using OS 9 and I hit "print", the printer responded instantaneously and was quick. Ever since I upgraded to OS 10 it has alw

  • Application server B.I start issue

    Good Morning, Kindly help out on this issue , i tried starting the services on the Application server for the infrastructure tier of my B.I. and i get this error, i have checked my /etc/host file and i can find 127.0.0.1 localhost loopback -a:applpro