IDoc to JDBC with two tables

Hi guys,
I'm doing an interface IDoc to JDBC. With one IDoc (ORDERS) I have to perform two INSERT's in two different tables. I already read the SAP Help and there I saw that it is possible to do several statements in one or more tables! But, strangely, surfing on SDN forum I found some threads regarding the same scenario and the solution used is to use a multi mapping 1x2 and two JDBC adapter, one per table.
Does anyone know if it is possible and which is the best approach for this scenario?
Thanks in advance,
Ricardo.

Hi,
As above bhavesh said is the correct,We can acheive this using two statement level tags.no need to use two comm channels.Under first statement level tag u can assign your sirst table name and under second statement level tag u can assign second table name.Finnaly source data is moved to two different tables in database system.
Thanks
KP..!

Similar Messages

  • For All Entries with two tables

    Hi All,
             Can we use FOR ALL ENTRIES with two tables. for example
    SELECT * FROM MKPF INTO TABLE T_MKPF
             WHERE BUDAT IN S_BUDAT.
    SELECT * FROM MARA INTO TABLE T_MARA
             WHERE MTART IN S_MTART AND
                            MAKTL IN S_MAKTL.
    SELECT * FROM MSEG INTO TABLE T_MSEG
           FOR ALL ENTRIES IN  "T_MKPF AND T_MARA"
                  WHERE MBLNR EQ T_MKPF-MBLNR AND
                                 MATNR EQ T_MARA-MATNR.
    can we do it like this or any other way to do this plz tell. I waitting for your responce.
    Thanks
    Jitendra

    Hi,
    u cannot do like this....chek some documentation on it..
    1. duplicate rows are automatically removed
    2. if the itab used in the clause is empty , all the rows in the source table will be selected .
    3. performance degradation when using the clause on big tables.
    Say for example you have the following abap code:
    Select * from mara
    For all entries in itab
    Where matnr = itab-matnr.
    If the actual source of the material list (represented here by itab) is actually another database table, like:
    select matnr from mseg
    into corresponding fields of table itab
    where ….
    Then you could have used one sql statement that joins both tables.
    Select t1.*
    From mara t1, mseg t2
    Where t1.matnr = t2.matnr
    And T2…..
    So what are the drawbacks of using the "for all entires" instead of a join ?
    At run time , in order to fulfill the "for all entries " request, the abap engine will generate several sql statements (for detailed information on this refer to note 48230). Regardless of which method the engine uses (union all, "or" or "in" predicates) If the itab is bigger then a few records, the abap engine will break the itab into parts, and rerun an sql statement several times in a loop. This rerun of the same sql statement , each time with different host values, is a source of resource waste because it may lead to re-reading of data pages.
    returing to the above example , lets say that our itab contains 500 records and that the abap engine will be forced to run the following sql statement 50 times with a list of 10 values each time.
    Select * from mara
    Where matnr in ( ...)
    Db2 will be able to perform this sql statement cheaply all 50 times, using one of sap standard indexes that contain the matnr column. But in actuality, if you consider the wider picture (all 50 executions of the statement), you will see that some of the data pages, especially the root and middle-tire index pages have been re-read each execution.
    Even though db2 has mechanisms like buffer pools and sequential detection to try to minimize the i/o cost of such cases, those mechanisms can only minimize the actual i/o operations , not the cpu cost of re-reading them once they are in memory. Had you coded the join, db2 would have known that you actually need 500 rows from mara, it would have been able to use other access methods, and potentially consume less getpages i/o and cpu.
    In other words , when you use the "for all entries " clause instead of coding a join , you are depriving the database of important information needed to select the best access path for your application. Moreover, you are depriving your DBA of the same vital information. When the DBA monitors & tunes the system, he (or she) is less likely to recognize this kind of resource waste. The DBA will see a simple statement that uses an index , he is less likely to realize that this statement is executed in a loop unnecessarily.
    Beore using the "for all entries" clause and to evaluate the use of database views as a means to:
    a. simplify sql
    b. simplify abap code
    c. get around open sql limitations.
    check the links
    http://www.thespot4sap.com/articles/SAPABAPPerformanceTuning_ForAllEntries.asp
    The specified item was not found.
    Regards,
    Nagaraj

  • How to deal with two tables in the Data Base

    Hi Experts,
    IF WE WANT TO GET THE DATA FROM THE TWO TABLES, WHAT QUERY SQL STATEMNET SHOULD HAVE TO WRITE AND ANY CONFIGURATION CHANGES NEED TO BE DONE AND WHAT SETTINGS NEED TO BE DONE IN THE ESR .
    PLEASE EXPLAIN ME ON THIS .
    THANKS IN ADVANCE.
    RAM

    If you are using the same database and referencing two tables then you dont need special configuration for it. You use single jdbc adapter. In ESR you create two statment structure one for each table. This is one option. The second option is use join statment and write query and in this case one statment data structure.
    Please go through the help sap link for the jdbc document structure.
    http://help.sap.com/SAPHELP_NW04s/helpdata/EN/2e/96fd3f2d14e869e10000000a155106/content.htm
    The second option can be done using the below structure.
    <StatementName>
    <anyName action=u201D SQL_QUERYu201D >
    <access>SQL-String with optional placeholder(s)</access>
    <key>
      <placeholder1>value1</placeholder1>
      <placeholder2>value2<placeholder2>
    </key>
    </anyName > 
    </StatementName>

  • FOR ALL ENTRIES IN with two tables

    Hi Guy's,
    I have two int. tables, gt_likp, gt_lips.
    I need to use "FOR ALL ENTRIES IN" with this two tables.
      SELECT matnr
             vkorg
             vtweg
             ypcogsl
        FROM mvke
        INTO TABLE gt_mvke
    <b>    "FOR ALL ENTRIES IN gt_likp gt_lips"</b>
        WHERE matnr = gwa_liefpos_tab-matnr
        AND vkorg = gt_likp-vkorg
        AND vtweg = gt_lips-vtweg.
    How to do this?
    Please Help.
    Thanks in Advance.

    Hi,
    Fill gt_likp-vkorg values in a range(r_vkorg). Use gt_lips in FOR ALL ENTRIES.
    Basically you can use only 1 internal table with FOR ALL ENTRIES statement.
    SELECT matnr
    vkorg
    vtweg
    ypcogsl
    FROM mvke
    INTO TABLE gt_mvke
    FOR ALL ENTRIES IN gt_lips
    WHERE matnr = gwa_liefpos_tab-matnr
    AND       vkorg in r_vkorg
    AND       vtweg = gt_lips-vtweg.
    - SRao

  • WBS data distribution for IDOC-PI-JDBC with system status 'CRTD' not working.

    Hello Experts,
    I am busy with a project where the PS project creation and updates should be transfered to the external legacy system through IDOC-PI-JDBC scenario.
    I am using the BAPI_PROJECT_MAINTAIN for this process. This scenario is working fine with the projects system status released (REL).
    If the system status is Created (CRTD) then no idoc creation happening therefor no data distribution of work breakdown structure(WBS) to the legacy system.
    Can anybody give me some suggestion of make it happening.
    Thanks in advance.
    Regards,
    Antony.

    Hello all,
    I did it with the help of my abap developer.
    We implemented a BADI, and from the BADI we created the idoc.
    When the idoc is there the legacy system receive the data.
    Regards,
    Antony.

  • Please help with two tables...

    I've created form based on two tables - two blocks with relationship. One table have fields ID and DESCRIPTION and there is LOV based on it. LOV returns value to textbox. I want that user see in textbox value DESCRIPTION, but when user save changes to main table there is update on ID field. How can I do that?
    PS Sorry my english is not perfect.

    see this link , i guess you are looking for same thing
    Copying value from updated block to newly created bolck

  • Trouble with two tables and persistence

    Hi all,
    I would need your opinion on this:
    I have two tables:
    Table User (UID(PK), Uname, Pword)
    Table Choice (CID(PK), UID(FK), Cname, Cparameter1, Cparameter2)
    I have tried to put both together into one entity as described in: http://en.wikibooks.org/wiki/Java_Persistence/Tables#Example_mapping_annotations_for_an_entity_with_multiple_tables
    However, the trouble is that it doesn't work as I have hoped. I am unable to insert data into the user table alone, because it complains about missing entries for CID, Cname, etc...). I thought I would be able to query them independently, as 1 user can have many Choices.
    Any suggestions how to tackle this problem?
    Thank you.

    Ahh, I think I have figured out part of it but it isn't working yet. I created a view of the trk_user table. Now I need help with the code, I am trying to incorporate it here:
    SELECT webb.TRK_CALLS_VIEW.ID, webb.TRK_CALLS_VIEW.USER_, webb.TRK_CALLS_VIEW.ASSIGNED_TO, webb.TRK_CALLS_VIEW.PROBLEM, webb.TRK_CALLS_VIEW.SOLUTION, webb.TRK_CALLS_VIEW.STATUS, webb.TRK_USER_VIEW.lname, webb.TRK_USER_VIEW.fname
    FROM webb.TRK_CALLS_VIEW, webb.TRK_USER_VIEW
    WHERE
    ( STATUS = 'Open' and :P2_REPORT_SEARCH is null )
    or
    ( regexp_like( USER_ || '#' || ASSIGNED_TO || '#' || PROBLEM || '#' ||
    SOLUTION || '#' || STATUS, :P2_REPORT_SEARCH, 'i' ) )
    Can someone help me in the right direction

  • Preparedstatement with two tables

    I try to use "preparedstatement" to insert two tables. Is there any posibility to control the constraint of the two tables? Assume that the two tables are master detail. Commit them both or rollback them both... An example would be very helpful.

    Something like that: if the preparedstatement2 throws an exception then I should rollback the preparedstatement1.
    StringBuffer stringbuffer = new StringBuffer();
    stringbuffer.append("insert into T_ABC");
    stringbuffer.append("(a,b,c)");
    stringbuffer.append(" VALUES(?, ?, ?);
    StringBuffer stringbuffer2 = new StringBuffer();
    stringbuffer2.append("insert into T_DEF");
    stringbuffer2.append("(d,e,f,g)");
    stringbuffer2.append(" VALUES(?, ?, ?, ?);
    preparedstatement1 = dc.prepareStatement(stringbuffer.toString());
    preparedstatement2 = dc.prepareStatement(stringbuffer2.toString());
    preparedstatement1.setLong(1, 0);
    preparedstatement1.setLong(2, 0);
    try {
    preparedstatement1.executeUpdate();
    preparedstatement2.executeUpdate();
    } catch {
    //control
    }

  • Find the idoc segment link with Sap Table

    Dear Abaers,
    I am new to Idoc. i have one Idoc (Orders01) for creating sales order.
    I had seen the t-codes WE 30 and WE 60 to know the field description.
    The fielddescription shows names like name1 name2 ort01 etc.
    i want to know what are the db tables involved for that particular idoc segment.
    Thanks in Advance,
    Arati

    Hi Arati,
    to get the description name:
    WE30 transaction and check the segments name available.
    With the segment name, go to WE31 and check the fields used and column 'Data element'.
    Double-click in data element (or inform in se11), you have the description value of the field.
    About the tables involved:
    Click in 'Where use list' os this data element.

  • Working with two tables in Request!!! Any alternative solution?

    Hi All,
    I am stuck with a requirement, it is as follows,
    I have one table say Table1 with DATE,CYRRENCY and AMOUNT . User will select a date, we need to get all records greater than date selected by user from Table 1.
    Now I need to get exchang rate and currency for the date selected by user from other table say Table2 which has got details DATE, CURRENCY and EXCHANAGE RATE.
    Next step will be, Amount*Exchange Rate will be shown Currency wise.
    we need to do this calculation at run time based on date selected by user.
    I tried to do this in many ways like union query, changing data model at ETL layer etc. But not able to achieve.
    Your valuable suggestions would help me.
    Thanks.

    Thanks for the response, i am getting some idea, need bit clarification.
    For example, In table2 i will have records like below for the selected date:
    Currency Exchange Rate
    USD 47
    EUR 59
    In output of Table 1 i will take records greater than slected date range, that will have again currency and amount
    Currency Amount
    USD 2000
    EUR 1000
    USD 5000
    INR 1500
    we would need to match currency and take Amount * Exchange rate....
    Can this be achieved with presentation variable?
    Please help.

  • Report generation with two tables having no join

    Hi, 
           I would like to know if i can generate a report to view data from purchase and sales tables at one time even if they are not directly linked.
    Regards,
    Bhavna

    hi jain,
    You can use Union All to combine sql queries of sales and
    purchase tables.
    Jeyakanthan.

  • Calling a web service with two tables

    Hello all,
         I am having a problem calling a web service in VC which has data of the format order and orderitems.
    that is I have a record of information a recordset is part of that information. Please point to any blogs or any info available on SDN.
       I appreciate all your help
    Thank You
    Shekar

    Hi,
    Please check the below links.
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/vc71/webServiceDestination.
    https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/4679. [original link is broken] [original link is broken] [original link is broken]
    Govindu

  • Outer join two tables with query search record attached to both tables

    When I create a query with two tables that have query search records attached with outer join, PS seems to do a natural join (cartesian). We are on PT8.48.
    Is there a workaround for this issue. I do not want to remove query search record on either of the tables.
    I am trying to create an Emergency contact report. I am using two tables PS_EMPLOYEES and PS_EMERGENCY_CNTCT. Here is the sql PeopleSoft query generated when I did Left outer Join.
    Query SQL:
    SELECT A.EMPLID, A.NAME, A.ADDRESS1, A.CITY, B.PRIMARY_CONTACT, B.ADDRESS1, B.CITY, B.STATE, B.POSTAL, B.RELATIONSHIP, A.DEPTID, A.JOBCODE, A.COMPANY, A.EMPL_TYPE
    FROM (PS_EMPLOYEES A LEFT OUTER JOIN PS_EMERGENCY_CNTCT B ON A.EMPLID = B.EMPLID ), PS_EMPLMT_SRCH_QRY A1, PS_PERS_SRCH_QRY B1
    WHERE A.EMPLID = A1.EMPLID
    AND A.EMPL_RCD = A1.EMPL_RCD
    AND A1.OPRID = 'SREESR'
    AND (B.EMPLID = B1.EMPLID OR B.EMPLID IS NULL )
    AND B1.OPRID = 'PS'
    Appreciate any help.

    I think there are fixes for this issue in later tools releases (Report ID 1544345000). I'm not sure about 8.48, but you might try the workaround documented in
    E-QR: Left Outer Joins with Security Records are returning unexpected results [ID 651252.1]
    on Oracle Support.
    Regards,
    Bob

  • DataType conflict in the R/3 when joining two tables

    Hi Experts,
    I have created a view with two table in the R/3 side by joining two common fields,but one of the field is getting error with different data type, so could any one suggest me how to resolve this issue without changing type.
    Thanks,
    Venugopal

    Hi
    Actually I have to pull one of the  field from one table and place in other table and create a generic data source on it,Can any one suggest me with any solution or exists to solve this issue.
    Thanks,
    Venugopal

  • How to copy the value of two tables into a view.

    Hi Experts ,
    I have a requirement in which i have been provided with two tables(T1,T2) of same table structure ,i need to copy their entries into a table view with the same structure as the two tables(T1,T2) .
    suppose T1 has entries name age T2 has entries
    A 20 D 40
    B 30 E 46
    C 40
    the view should have all the entries,duplicate values no issues ...
    Could you please suggest how can i do that ?
    Thanks and Regards
    Debashis

    if table have same structure then you can use
    select * from t1
    union all
    select * from t2

Maybe you are looking for

  • Error while creating new tab/user...

    hi there ... I have this error while creating using this <a href="http://https://www.sdn.sap.com/irj/sdn/message?messageID=3171191">https://www.sdn.sap.com/irj/sdn/message?messageID=3171191</a> that i have posted for help... I have encountered this e

  • No sound while Recording

    Sound is fine while watching TV or listening to the Radio. Jumper is setup going from Line Out  [tv card] -> Line In [sound card] Settings in the software player are as such. http://www.egohost.net/untitled.jpg Anyone have any idea's about this pleas

  • SAP Note Number: 953823 says string not supported in FM ??

    Hello Friends I am desperately trying to findout how to send a variable length string from XI and save it in a table. However, SAP Note Number: 953823 says that STRING is not supported in FM but the work around it suggests is as follows: ============

  • Fonts turn to gibberish randomly.

    See the images below. Any ideas what's happening?

  • Premiere elements 10 crashes on startup error DirectoryRegistry.cpp-283

    I bought premiere elements 10 yesterday on mac app store and until now i wasnt able to use it. It crashes on the startup and this error apears. [/Users/ramyadav/perforce/premiere/elements/molecules/pre10-bullseye/molecule-17/MediaCore /ASL/Foundation