Jdbc Reaciver UPDATE_INSERT

Hey Guys,
Here i am doing an Update_INSERT Senario.
I am following ..Below documnets.
http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm.
Statement
TableName
   Action= UPDATE_INSERT
   MYTABLE
  access
    Feild1   is Primarykey
    feild2   is Primarykey
    feild3
  Key
    Feild1  
Here i should not insert a Doublicate values in ORacle can some one help me here
Thanks for helping me all these days
Regd's
Raj

Raj,
hmm.. now this is tricky.
One option ~~ Select all Customer  ID's from your DB table using select, check the list of values with your vallue and only if it is not available then INSERT using the JDBC adapter.
This will need a BPM with a Synchronous Select as well as a Separrate INSERT.
Another optionn~~
Pass the cusomer ID to a Stored Procedure using a JDBC adapter and then the Stored Procedure will decide if it need to update / insert or ignore this customer id.
Option 2 is a better way to do it as it avoid a BPM>
Regards,
Bhavesh

Similar Messages

  • JDBC Reaciver

    Hi Guys,
    I have a problem when i am  passing a message from Idoc to Oracle  useig JDBC Reaciver i had problem in Runtime..
    Below message  is my Error message..
    channel Jdbc_Rec: processing started; party  , service DMZ_DEV
    2006-09-07 11:56:33 Error No "action" attribute found in XML document ("action" attribute missing or wrong XML structure)
    2006-09-07 11:56:33 Error Exception caught by adapter framework: Error processing request in sax parser: No 'action' attribute found in XML document (attribute "action" missing or wrong XML structure)
        Page 1 / 2
    Thanks in advance
    Thanks
    Hari

    Hi Hari,
    I was the same <u>stupid</u> error, because I read the doc too quickly...
    Go to your Data Type and look at the line "action":
    > DO NOT use "insert Element" but "<b>Insert Attribute</b>", because <u>action is an attribute</u> of TableName.
    Example: If action has category "Element", then you have
    <TableName>
    <action>INSERT</action>
    </TableName>
    and it's wrong... That's why you have "<i>Error No "action" attribute</i> "
    But if you use category "Attribute", then you will have:
    <TableName <b>action</b>="INSERT">
    </TableName>.
    And this is exactly what the JDBC adapter want!
    Mickael
    Message was edited by: Mickael Huchet

  • JDBC DB2  UPDATE_INSERT Delay

    Hello everybody,
    I have the following asynchronous scenario
    SAP ECC IDOC -> SAP PI 7.11 - > JDBC DB2 Database
    now, I receive ARTMAS Idoc's from ECC and do mapping to create XML Query statements, now mapping is working correclty and UPDATE_INSERT statements also, the problem is that the Adapter Engine sends the statements, the database recieves them and process them in milliseconds each, and when the database finished ,PI keeps waiting for something for 2 minutes and 6 seconds each message, I already did the following:
    1.- Tried Idoc packaging in development in Mapping to send as much statements as I can considering bandwith, but the problem remains.
    2.- I tried sending only one stamente and takes the same time.
    3.- I already disabled in SAP PI the acknowledge for the Idocs and times are the same.
    4.- I already tried the option "Disconnect from database after each message" with this checkbox activated and deactivated, and the times still the same.
    5.- Already tried the Isolation level with all different options and times still the same.
    6.- Pool waiting advanced parameter not defined so it should take the default that is 5 seconds, but I'm not sure that parameter can control that, do you think?
    The readl problem after monitoring both PI and the database is that the database finishes really fast but PI still waits for something I don't know what for more than two minutes for each message, this creates queueing of messages in the Adapter Engine for this interface, cause each message takes this time.
    I thank in advance your attention and recomendations.
    Regards,
    Julio

    PI should be waiting back the response with the count of recordsinserted or updated. and this delay corresponde with the time that DB take to insert or update the fields i think
    see this. i took it from help sap.
    did you configured the response mapping?
    action=UPDATE_INSERT
    The statement has the same format as for the UPDATE action. Initially, the same action is executed as for UPDATE. If no update to the database table can be made for this action (the condition does not apply to any table entry), values of the table described in the <access> element are inserted in accordance with the description of the action INSERT. <key> elements are ignored in this case.
    The response document has the following format; one of the two values is always 0 because either an UPDATE or an INSERT action is always executed:
    <update_count>count</update_count>
    <insert_count>count</insert_count>

  • Regarding JDBC Reaciver Adapter

    Hi Everyone,
    After Mapping in IR do i need to write any SQL Statements in ID.Some one can help me in these.
    Regd's
    Raj

    Do have a look at these links :
    http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    Also this weblog - /people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30

  • Creatteing an R/3 -xi -Jdbc Reaciver

    Hello Everyone,
    Do i need to create two software Componets when i am developing a  R/3->xi--> Oracle.
    Regd's
    Raj

    Hi Raj,
    It depends on the design approach of which you are going to take.
    This design is based on the how many interfaces yoy have, and what is the classification ? is it depend on the business process of your implementation.
    So the answer is not neccessary to have 2 SWCVs.
    Regards,
    Moorthy

  • Simple File to Database Scenario

    Dear Experts
    I am working on a File to Database scenario. My requirement is to update the database with latest information. For example
    1. First day i got a file of 100 records...Insert all the 100 records.
    2. Second day i will get 110 records (here 100 records is old data and 10 records is the delta). Now PI needs to lookup with DB and insert the updates of 100 records and insert the delta 10 records...
    3. Third day i got 125 records file (here 110 is previous days data and 15 is todays delta). I need to update the changes of all the 110 and insert 15 delta records
    Thanks

    Hi,
          Since you want to update the existing records and insert the delta, the 'update_insert' option of JDBC receiver should fulfill your requirements.
    Refer the following links for more help on this
    Re: jdbc update_insert
    Jdbc Reaciver UPDATE_INSERT
    Regards

  • Sync Proxy alerting in SAP

    Hi,
    I have a scenario as follows:
    SAP sender sync proxy -> PI -> JDBC (action = update_insert)
    The JDBC receiver adapter will send back the number of records updated or inserted. My question is how to raise an alert in SAP based on the response from the JDBC adapter? For example if the result says no records were updated or inserted I would like to raise an alert in SAP/PI.
    Do I simply define the Sender Interface to include a response and standard fault? then use a suitable method to raise a fault exception in SAP? Can the fault on a sync proxy be used in this way?
    I know there is a blog that shows how to raise an alert for an async proxy scenario: Fault Message Types - A Demo (Part 1).
    Thanks
    Che

    Hi Che,
    The blog gives the details for fault response from receiver. In your case you will receive the response from JDBC in one format for successful and no update message.
    For your requirement, you can raise alert in UDF. But do you want to stop the message and raise alert? Or pass the message.
    Please check the below blog
    Hacking: To get error from the PI Mapping Mapping realtime.
    I think the response should go to sender (proxy) and alert or further action should handle in proxy.
    regards,
    Harish

  • File to JDBC -  JDBC database not getting updated using UPDATE_INSERT

    Hi ,
        I have a done a file to JDBC Scenario.File is successfully picked up by sender file channel and recieved by reciever JDBC channel.There is no error in receiver communication channel.I used UPDATE_INSERT action in mapping which has to update the database with all records it recieve.But,i found there is no update in Database table.I donot have access to database,so i made a sender jdbc channel querying all data in it to see what new value is populated.
    I made a dummy sender jdbc channel to check what are the values updates on the run of above interface.But , i found no update occur.Please help me out of this problem.
    Thanks
    Deepak Jaiswal

    The reason I ask , because you will see whether the message got successfully delivered to the target system.
    I want  to see information like below
    2010-04-14 14:31:35 Success Message successfully received by messaging system. Profile: XI URL: http://server:port/MessagingSystem/receive/AFW/XI Credential (User): PIISUSER
    2010-04-14 14:31:35 Success Using connection JDBC_http://sap.com/xi/XI/System. Trying to put the message into the receive queue.
    2010-04-14 14:31:35 Success Message successfully put into the queue.
    2010-04-14 14:31:35 Success The message was successfully retrieved from the receive queue.
    2010-04-14 14:31:35 Success The message status set to DLNG.
    2010-04-14 14:31:35 Success Delivering to channel: Communuication channel
    2010-04-14 14:31:35 Success MP: Entering module processor
    2010-04-14 14:31:35 Success MP: Processing local module localejbs/CallSapAdapter
    2010-04-14 14:31:35 Success Receiver JDBC adapter: processing started; QoS required: ExactlyOnce
    2010-04-14 14:31:35 Success JDBC adapter receiver channel CC: processing started; party  , service DB_BS
    2010-04-14 14:31:35 Success Database request processed successfully
    2010-04-14 14:31:35 Success MP: Leaving module processor
    2010-04-14 14:31:35 Success The message was successfully delivered to the application using connection JDBC_http://sap.com/xi/XI/System.
    2010-04-14 14:31:35 Success The message status set to DLVD.
    raj.

  • JDBC UPDATE_INSERT not working

    Hi Experts,
    I have an issue with the JDBC Update_Insert action with the SQL database.
    When I tried with the Update function and Insert Function seperately the data was updating in the database fine.
    When I use the UPDATE_INSERT action with the same data getting below error.
    Error while parsing or executing XML-SQL document:
    Error processing request in sax parser: Error when executing statement for
    table/stored proc. 'CUSTMAST' (structure 'Statement'):
    com.microsoft.sqlserver.jdbc.SQLServerException: String or binary data would be
    truncated.
    And the query that was running in the background was as follows
    10.04.2014 16:34:45
    Information
    JDBC
    Adapter Receiver processing started, required QoS ExactlyOnce
    10.04.2014 16:34:45
    Information
    JDBC
    Adapter Receiver Channel CC_Laserfische_FetchDate:  processing started; party *
    / service SYS_DB_BIS.
    10.04.2014 16:34:45
    Information
    UPDATE CUSTMAST SET COMP_CODE='ESSR', CUST_ID='20035780',
    CUST_NAME='PRAVEEN', CITY='HYD', PINCODE='500060', COUNTRY='IN',
    EMAIL='[email protected]', REC_INSR_DATETIME='2014-04-10 16:34:45' WHERE
    (COMP_CODE='ESSR' AND CUST_ID='20035780')
    10.04.2014 16:34:45
    Information
    INSERT INTO  CUSTMAST (COMP_CODE, CUST_ID, CUST_NAME, CITY, PINCODE,
    COUNTRY, EMAIL, REC_INSR_DATETIME) VALUES ('ESSR', '20035780', 'PRAVEEN', 'HYD',
    '500060', 'IN', '[email protected]', '2014-04-10 16:34:45')
    When I try this query manually in the database it is working fine but when I trigger the data from SAP PI 7.1 we are facing error as mentioned above.
    Please help me with this.
    Thanks in advance.

    Hi Praveen,
    Error "String or binary data would be truncated." comes when the incoming data length is more than the length specified in Database.
    Cross check the lengths in Database with your data.
    Reagrds,
    Sudhasree

  • Jdbc update_insert

    Hi
    I have a requieement like to update a record if key values are same else insert the record since it might be new record.
    I see on jdbc recv structure ,we need to define the keys in the table. But what are they mapped to ? these keys are also present in access tag. Should the mapping for key elements be same as access eleements since key elements are also part of access tags.
    is there any blog ofr update_insert //keys...?
    Please give your suggestion.
    Thanks

    Eg:
    root>
    .<StatementName1>
    ..<dbTableName action= u201CUPDATE_INSERTu201D>
    ..<table>realDbTableName</table>
    ...<access>
    ......<SSN>val1</SSN>
    ......<col2>val2</col2>
    ...</access>
    ...<key1>
    .....<SSN></SSN>
    ....</key1>
    .........</dbTableName>
    .</StatementName1>
    </root>
    we define this structure in Data type: and call this structure in the map.
    since this is receveing side jdbc structure ,we map it to the source fields... so we map target SSN to source SSN
    target SSN is also in the key tag node : here should we map the target SSN node to source SSN node ?
    Thanks

  • ABAP Proxy to JDBC : UPDATE_INSERT issue.

    Dear Friends
       I am inserting one ekpo records to MS SQL server. my structure and records are below.
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:MT_EKPO_RECEIVE xmlns:ns0="http://gspcgas.net/asset_rfid">
    - <StatementName>
                   - <dbTableName action="UPDATE_INSERT">
                      <table>EKPO</table>
    - <access>
               <EBELN>4500000687</EBELN>
               <EBELP>00010</EBELP>
              <MATNR>000000000100000012</MATNR>
              <MENGE>1.000</MENGE>
              <MEINS>EA</MEINS>
              <WERKS>1000</WERKS>
              <LGORT />
              <AEDAT>2011-12-12</AEDAT>
              <BUKRS>1000</BUKRS>
              <ANLN1>010023000315</ANLN1>
              <PSTYP>0</PSTYP>
              <KNTTP>A</KNTTP>
              <LOEKZ /> <-- during insertion I am not updating this field ( this is for item deletion)
      </access>
      - <Key1>
              <EBELN>4500000687</EBELN>
              <EBELP>00010</EBELP>
      </Key1>
      </dbTableName>
      </StatementName>
      </ns0:MT_EKPO_RECEIVE>
    this works absolutly fine and record inserted in the MS SQL server.
    problem occurs when in second run my user is changing the fields means he deletes the item  from the PO,  but it is not reflecting in the data base. only I can see previously created entery not the changed one. I have below payload in RWB for the receiver communication channel. 
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:MT_EKPO_RECEIVE xmlns:ns0="http://gspcgas.net/asset_rfid">
    - <StatementName>
                   - <dbTableName action="UPDATE_INSERT">
                      <table>EKPO</table>
    - <access>
               <EBELN>4500000687</EBELN>
               <EBELP>00010</EBELP>
              <MATNR>000000000100000012</MATNR>
              <MENGE>1.000</MENGE>
              <MEINS>EA</MEINS>
              <WERKS>1000</WERKS>
              <LGORT />
              <AEDAT>2011-12-12</AEDAT>
              <BUKRS>1000</BUKRS>
              <ANLN1>010023000315</ANLN1>
              <PSTYP>0</PSTYP>
              <KNTTP>A</KNTTP>
              <LOEKZ>L</LOEKZ> <---- I receive the value here when user has deleted the item in the PO.
      </access>
      - <Key1>
              <EBELN>4500000687</EBELN>
              <EBELP>00010</EBELP>
      </Key1>
      </dbTableName>
      </StatementName>
      </ns0:MT_EKPO_RECEIVE>
    Please help me to understand why the changed values are not reflecting in my MSSQL server from PI. and tell me what should i do to correct it.  I have no error message in RWB for the receiver communication channel. please reply me. your any reply will be highly appreciated. Please reply me

    Delete is handled differently when compared to an  Update_Insert.
    an Update_insert statement is like a modify command. it either inserts an entry or changes it, but does not delete it. You need to specify the keys in the Update_insert XML-SQL.
    In case you have a scenario for delete along with update/insert, please do the following
    1.  Let the source system determine an action, and pass it to PI
    2. Based on the action code, implement 2 split mappings using enhanced interface determination ( rule based interface determination).
    3. Implement 2 seperate maps for Delete and Update, and call them based on the action code rule from the interface determinaton.
    Hope this helps.
    Regards,
    Abhishek

  • Reaciver JDBC Adapter

    Hello Everyone.
    while i am Mapping R/3 STRU AND AND ORACLE STRUC
    here what field do i need to map to oracle statement
    from idoc
    Idoc                    Oracle
    Idoc                    Oracle_struc
    Begin                 Statement
    Edi_dc40               Emp
    2segment                 action
       Feild1                 access
       Field2                   field1
                                Field2  
    Here what field do i need to Map for statement of target  and emp for table name.. can some one help me here please..

    Hi Raj,
    If you are getting multiple idocs , then map your Idoc node into the Statement node in the target structure. Provided your statement has multiple occurence i.e you required to post multiple occurences of the data into Oracle database.
    If not also, you can map with Idoc with Statement node in the target structure, No need of mapping control record structure etc.. just leave it. In the mapping , map the fields based on the target structure ie requirements. if you created any mandatory segments or fields map with appropriate values from the source.
    Your all field1,.. from source structure is the exact value or data. this you need pass as a input values into your stored procedures.
    For others you can leave it and test the mapping
    Regards,
    Moorthy

  • Error while updating database using jdbc receiver adapter

    Hi All,
    I am trying to update a single record using jdbc receiver adapter.
    This is my the message that is getting created..
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns0:Data xmlns:ns0="urn:Test">
    - <STATEMENT>
    - <TABLENAME ACTION="UPDATE_INSERT">
      <TABLE>ORDERS</TABLE>
    - <ACCESS>
      <OrderID>99999</OrderID>
      <CustomerID>VICTE</CustomerID>
      <EmployeeID>3</EmployeeID>
      <ShipAddress>VICTE</ShipAddress>
      </ACCESS>
    - <KEY>
      <OrderID compareOperation="EQ">99999</OrderID>
      <ShipAddress compareOperation="EQ">VICTE</ShipAddress>
      </KEY>
      </TABLENAME>
      </STATEMENT>
      </ns0:Data>
    But in Adapter Monitoring i am getting the following error..
    <i>Error while parsing or executing XML-SQL document: Error processing request in sax parser: Error when executing statement for table/stored proc. 'ORDERS' (structure 'STATEMENT'): java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'VICTE'.</i>
    Regards,
    Rahul

    Rahul,
    > In this case i believe the interface has to be synch.
    > So what will the response message type be like..
    Not necessary. UPDATE can be asynch as well.
    Can you turn the trace on like pointed by Michal and then you can see the Query in the Audit Log of the adapter montioring. Try to execute the same query from your DB Client like TOAD and see what is the Syntax error you are getiing.!
    The problem looks like some field has some dataype / column name mismatch.
    Regards
    Bhavesh

  • JDBC receiver adapter: No 'action' attribute found in XML document

    Hi this is my target structure getting generated at the Receiver JDBC adapter
    I have checked the XML doc, still unable to figure out why in the RWB its showing the following error:
    "Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: No 'action' attribute found in XML document (attribute "action" missing or wrong XML structure)"
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_IF001 xmlns:ns0="http://vodafone.com/xi/IF001">
    <Statement>
    <OPCO_VPC_PO action="UPDATE">
    <access>
    <SO>0060000090</SO>
    <SO_ITEM>000010</SO_ITEM>
    </access>
    <key>
    <OPCO_PO>0002002291</OPCO_PO>
    <OPCO_PO_ITEM>00010</OPCO_PO_ITEM>
    </key>
    </OPCO_VPC_PO>
    </Statement>
    </ns0:MT_IF001>
    Kindly Help !!
    Thanks !!

    Hi,
                 Clearly stating that no action attribute .So, please take a look at the structure please do like this at your Data Type specification
    <i><b><b><root>
      <StatementName1>
    <dbTableName action=”UPDATE” | “UPDATE_INSERT”>
        <table>realDbTableName</table>
    <access>
    <col1>val1</col1>
    <col2>val2new</col2>
    </access>
    <key1>
    <col2>val2old</col2>
    <col4>val4</col4>
    </key1>
    <key2>
    <col2>val2old2</col2>
    </key2>
    </dbTableName>
      </StatementName1>
    </root></b></b></i>
        refer the  following link
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    **Assign points if you found helpful
    Regards.,
    V.Rangarajan

  • JDBC - No 'action' attribute found in XML document - error

    Hi,
    I'm trying to write to SQL Server form File
    I successfully read from file, but fail to write.
    <b>My XML is :</b>
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:SD_NEZIGA_OUT_MT xmlns:ns0="ssss.co.il:SD:Office_core_Neziga"><statement2 action="INSERT"><table>Employees</table><access><ID>000009</ID><Name>&#1497;&#1493;&#1504;&#1505;&#1497; &#1512;&#1493;&#1514;&#1497;</Name><Phone>972528288840</Phone><Manager>001037</Manager><DistManager>001037</DistManager><Password>D</Password><UserType>0</UserType><miskalID>0000</miskalID></access></statement2></ns0:SD_NEZIGA_OUT_MT>
    <b>Error from JDBC adapter:</b>
    TransformException error in xml processor class: Error processing request in sax parser: No 'action' attribute found in XML document (attribute "action" missing or wrong XML structure)
    Help me please.
    Best regards, Natalia.

    Hey
    Ur XML is not correct,it must be something like this
    <root>
    <StatementName1>
    <dbTableName action=”UPDATE” | “UPDATE_INSERT”>
    <table>realDbTableName</table>.....
    </StatementName1>
    if u look at the receiver structure of /people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30 this blog,action is an attribute of TEST and not STATEMENTNAME,for ur structure its an attribute of Statement2
    can u send ur receiver structure?
    thanx
    ahmad
    Message was edited by:
            Ahmad

Maybe you are looking for

  • Cannot install windows on bootcamp

    I have leopard os with bootcamp and a new windows xp sp2 disk. i cannot install windows on bootcamp. it says that i am missing a component. any tips?

  • Lost Excel document- 'Terminal Bash' suddenly appeared

    Can anyone help??? I have been working on an excel (Office for Mac) spreadsheet for a week. I have been saving it on my work network which I access from home through 'Shared' on Finder. I finally finished it tonight and saved it but wanted to rename

  • Problem with customized info type creation

    hi When i am creating customized info type using T-code PM01, i get error message like "package in non original system only modifiable with organizer tools". The above message is coming whenever save the infotype in either customized package or local

  • SAVING AN ILLUSTRATOR FILE AS A TIFF IN PHOTOSHOP

    I´m designing  a billboard on illustrator and its  very big, the printing company is asking me to send the file as a TIFF. I did the design on a scale 1-10 because the real size of the billboard is 15mts X 6mts, now I have to convert the artwork into

  • Photoshop CS5 & Epson Stylus 3800 problem (Mac)

    I am experiencing a frustrating problem with Adobe Photoshop CS5 and Epson Stylus Pro 3800 printer with a Mac. Trying to print on H-M paper, using the appropriate settings (see below), I find that under "Print Settings" on the printer driver, all the