JDBC Receiver side query

Dear Freinds,
I am using Proxy Sender(Asyn) ---> JDBC Receiver(Asyn). I have to update a table in Oracle System based on various conditions.
In R/3 there is a table where i have to pick 2 fields for updation at Oracle System based on 5 other fields.
Now my question is at JDBC Receiver side is it possible to control the UPDATE query according to various parameters being passed for e.g
Assume this is the Receiver side Data Type..
    Statement
       TableName
          Action
          Table
       Access         
          SAP_Update
          SAP_Prod_Order
       Key
          Parent_Coil
             operation
          Coil_No
             operation
          Sale_Ord_Item
          operation      
          Sale_Ord_No
          operation       
          Prod_Flag
          operation            
          Size_Flag      
Operation is the attribute that will be used for the operator.
In some messages Under Access out of 2 fields only 1 might come from sender and also in the Key (where clause) some all fields might come or some could come.
Under these various circumstances will the Update query gets generated properly by the JDBC receiver.
What all i should need to do ??
Please advice.
Thanks & Regards
K.Ramesh

Dear Friends,
Below given query has to be executed at the JDBC Receiver (Asyn).
How to define braces () and Boolean AND/OR etc in the datatype.
UPDATE PROD_INV SET SAP_PROD_ORDER = :WA_PROD-SAP_PROD_ORDER
WHERE  PARENT_COIL = :WA_TRAN_CTRL-PARENT_COIL AND ( ( PROD_FLAG = :C_Y AND SIZE_FLAG = :C_SPACE ) OR ( PROD_FLAG = :C_Y AND SIZE_FLAG IS NULL ) ) AND ORD_NO = :WA_TRAN_CTRL-SALE_ORD_NO AND ORD_ITEM_NO = :WA_TRAN_CTRL-SALE_ORD_ITEM
Moreover the query that is getting generated must change based on the where clause dynamically.
Just tell me how to do in such cases.
Thanks & Regards
K.Ramesh

Similar Messages

  • Problem when trying the Stored Procedures in JDBC receiver side

    Hi,
    I am facing some problem when i am trying to configure a scenario in the receiver side of JDBC adpater.
    We have never got stored procedures to work as messages go in 'Delivering'   status always. It's as if control never gets back to the adapter engine after the stored procedure call is made by the JDBC adapter. Then I went to checkt in the IE where the message has successfuly sent. Then I went to check
    in AE where the message is in "Delivering" state for long time.
    So checked the Default trace File and Thread dumps.
    In Thread dumps, i found a strange thing like one thread is hanging on condition wait at the below location :
      at java/lang/StringCoding.getEncoder(StringCoding.java:331(Compiled Code))
      at java/lang/StringCoding.encode(StringCoding.java:472(Compiled Code))
      at java/lang/String.getBytes(String.java:651(Compiled Code))
      at com/sap/aii/adapter/jdbc/SAXHandler.constructResponseStream(xml2sql.java:841(Compiled Code))
      at com/sap/aii/adapter/jdbc/SAXHandler.SQLcallStmt(xml2sql.java:988)
    Can you please help me in solving this issue as it is very critical to me ?
    Thanks,
    Prakash.

    Dear Prakash,
       There are number of reasons for SAX error. May be structure is not well defined, statement is not written correctly. These following links help you to solve your issue.
         SQL Queries(JDBC sendor CC)
         Oracle DB - XI - SQL DB
         JDBC Scenerio.
    Regards,
    JP.

  • JDBC Receiver Adapter Error

    Hi All,
    I am executing SP by using JDBC Receiver Adapter.
    My strcture is follows
    <STATEMENT2>
    <SP_CREATE_T_BATCH action="EXECUTE">
    <spName type="VARCHAR">SP_CREATE_T_BATCH</spName>
    <IN_Control_Recipe hasQuot="No" type="Integer">100000000001723850</IN_Control_Recipe>
    </SP_CREATE_T_BATCH>
    </STATEMENT2>
    The below error I am getting
    Message processing failed. Cause: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'SP_CREATE_T_BATCH' (structure 'STATEMENT2'): java.lang.NumberFormatException: For input string: "100000000001723850"
    Any help on this

    Hi Ram,
    Since you mentioned that your SP has one input parameter and one output parameter, the structure of the XML message at the JDBC receiver side should be:
    <STATEMENT2>
    <SP_CREATE_T_BATCH action="EXECUTE">
    <IN_Control_Recipe isInput="true" hasQuot="No" type="BIGINT">100000000001723850</IN_Control_Recipe>
    <Output_Parameter isOutput="true" type="SQLDataType"></Output_Parameter>
    </SP_CREATE_T_BATCH>
    </STATEMENT2>
    Here, i have assumed the following:
    SP_CREATE_T_BATCH   - The name of the Stored Procedure to be executed
    IN_Control_Recipe - Input parameter of the SP and its SQLDataType is BIGINT as suggested by Stefan.
    Output_Parameter - Output parameter of the SP. You may enter the SQL data type as per the output of your Stored Procedure.
    The following SQL data types are supported:
    INTEGER, BIT, TINYINT, SMALLINT, BIGINT, FLOAT, REAL, DOUBLE, NUMERIC, DECIMAL, CHAR, VARCHAR, STRING, LONGVARCHAR, DATE, TIME, TIMESTAMP, BINARY, VARBINARY, LONGVARBINARY, BLOB (input and output),CLOB (input and output), CURSOR (output; only in conjunction with the Oracle JDBC driver).
    Hope this will surely solve your problem.
    Regards, Gaurav.

  • Alerts for JDBC Receiver Adapter

    Hi ,
    I am using JDBC receiver adapter. I have configured the alert category and Alert rules. Alerts are getting for Mapping etc.
    When ever error occured in the SQL server whether its firewall issue or some other issue. The alerts are not created. Instead I can see the error message in RWB Message monitoring and communicaton channel monitoring.
    Please let me know How can raise alerts if the error occured at the JDBC receiver side.
    Thanks in advance,
    Kevin

    Hi Kevin,
    Probabaly the alert rule did not capture the error in the adapter engine.
    The filter for sender and receiver interface details in the alert rule can cause this issue depending on when and how the error occured. Can you create an alert rule with * for all entries, for adapter engine and check?
    Also do NOT check the option "suppress multiple alerts from this rule" because it will prevent subsequent alerts from this rule, if there is already one and not yet confirmed.
    Further please check the alerts in SALRT table in se16 if its created properly or via transaction ALRTDISP.
    Please use the report SXMSALERT_LOGREADER for troubleshooting and checking the alert logs.
    Hope this helps.
    Regards,
    Francis

  • Data coming in receiver side by using proxy to jdbc scenario

    Hi experts ,
    I have scenario Proxy (client proxy) to JDBC (IVR system) Asynchronous method,
    I execute se38 its working fine and go SXMB_MONI here also success flag  in development server  same way I checking PI side also SXMB_MONI everything fine  but data not coming IVR side if write select query
    In runtime workbench the Communication channel status id green  and Message processing completed successfully
    My question is when I writing select query like select * from table name ,Why data not coming  receiver side ?   execute  query here IVR side also mention  query status is successfully ,but IVR side  data not coming, I have access right in receiver side
    Please provide valuable inputs.
    Thanks
    INASH NALLA

    Refer the following link for more details:
    http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/content.htm
    Also, in the reciever JDBC adapter you dont write a SQL query anywhere but it is the target MT structure and corresponding mapping,which generates the query.
    Refer the blog:
    http://www.riyaz.net/blog/jdbc-adapter-configuration/technology/ 1200/

  • Problem with Stored Procedure exection in Sender and Receiver side of JDBC

    Hi All,
    I am facing problem while executing Stored Procedures using sender and receiver sides of JDBC adapter.
    Here is my SP in Oracle DB :
    PROCEDURE EMP                           
    ( ID IN VARCHAR2,NAME IN VARCHAR2,PROCESSED IN VARCHAR2  ) AS                                                          
    BEGIN                                                         
       INSERT INTO EMPLOYEE VALUES (ID, NAME, PROCESSED);COMMIT;END EMP;
    Now I want to execute this SP using sender JDBC channel and receiver JDBC channel.
    Can anyone please help me executing this SP?
    Regards,
    Soorya

    Hi Soorya,
    The receiver Data type should be like this:
    <StatementName>
    <storedProcedureName action=u201D EXECUTEu201D>
        <table>realStoredProcedureeName</table>
    <param1 [isInput=u201Dtrueu201D] [isOutput=true] type=SQLDatatype>val1</param1>
    </storedProcedureName >
      </StatementName>
    Check the link http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
    Which DB  are you using?? The sender structure will be like
    <resultset>
    <row>
    <field1></field1>
    <field2></field2>
    <field3></ field3>
    </row>
    </resultset>
    Search SDN you will get lot of examples
    Regards
    Suraj

  • JDBC receiver adapter for AS400-query time out due to Escape Symbol

    Hello,
    I am uisng JDBC receiver adapter for AS 400, When I execute query, the query needs to have arguments in the open and close single ticks ('    12345' )
    My XML pay load looks like this, which is RFC sender. Look at dcudcstmr in <i><b>(' 838912')</b></i>.  When receiver gets this message the ' (single quotes are disappeared.
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ns1:MT_Cma_Customer_Select_Request xmlns:ns1="http://freemanco.com/xi/Get_Customer">
    - <Statement>
    - <LawsonCustomer action="SQL_QUERY">
      <access>select f1.DACMCMPNY from sap.sapcustvew f1, sap.sapcustvew f2 where f2.dcudcstmr in <i><b>(' 838912')</b></i> and (f1.dcudcstmr=f2.dcudcstmr or f2.komaster=f1.dcudcstmr)</access>
      </LawsonCustomer>
      </Statement>
      </ns1:MT_Cma_Customer_Select_Request>
    On the Receiver JDBC adapter I have tried with different combinations of Escape Symbol for Aposrophe as follows
    <b>   \
       '</b>
    As you know this is related to epcape character, I get following error all the time. Looks like the query is not able to execute in the specified time. My question is how do I get single quote as part of query.
    <b>select f1.DACMCMPNY from sap.sapcustvew f1, sap.sapcustvew f2 where f2.dcudcstmr in ( 100001) and (f1.dcudcstmr=f2.dcudcstmr or f2.komaster=f1.dcudcstmr) 2007-09-20 15:56:42 Error Unable to execute statement for table or stored procedure. 'LawsonCustomer' (Structure 'Statement') due to java.sql.SQLException:
    [SQL0666] Estimated query processing time 13766 exceeds limit 8000. 2007-09-20 15:56:42 Error MP: exception caught with cause com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'LawsonCustomer' (structure 'Statement'): java.sql.SQLException:
    [SQL0666] Estimated query processing time 13766 exceeds limit 8000. 2007-09-20 15:56:42 Error Exception caught by adapter framework: Error processing request in sax parser: Error when executing statement for table/stored proc. 'LawsonCustomer' (structure 'Statement'): java.sql.SQLException:
    [SQL0666] Estimated query processing time 13766 exceeds limit 8000. 2007-09-20 15:56:42 Error Delivery of the message to the application using connection JDBC_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'LawsonCustomer' (structure 'Statement'): java.sql.SQLException:
    [SQL0666] Estimated query processing time 13766 exceeds limit 8000.. Setting message to status failed. 2007-09-20 15:56:42 Error The message status set to FAIL. 2007-09-20 15:56:42 Error Returning synchronous error message to calling application: com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. 'LawsonCustomer' (structure 'Statement'): java.sql.SQLException:
    [SQL0666] Estimated query processing time 13766 exceeds limit 8000</b>
    Any feedback or helpfull tips appreciated.
    Thank you,
    Balaji

    Raj,
    Thank you for the reponse. I am using UDF on sender to generate sql statement as you see in sender XML message. After the message reaching receiver, gets executed but no response from AS400 becasue of missing single quotes in the sql query executed.
    Sender XML sends
    <access>select f1.DACMCMPNY from sap.sapcustvew f1, sap.sapcustvew f2 where f2.dcudcstmr in <u><b>(' 838912')</b></u> and (f1.dcudcstmr=f2.dcudcstmr or f2.komaster=f1.dcudcstmr)</access>
    Receiver executes as
    select f1.DACMCMPNY from sap.sapcustvew f1, sap.sapcustvew f2 where f2.dcudcstmr in ( <b><u>838912</u></b>) and (f1.dcudcstmr=f2.dcudcstmr or f2.komaster=f1.dcudcstmr)
    As you see the single quotes are missing. Like I said in previous posting I tried with following Escape Symbol for Aposrophe.
    Let me know if you need more information.
    Thank you,
    Balaji

  • How to use Stored Procedures in JDBC sender side and receiver side

    Hello,
    Can anyone explain how to use stored procedures in configuring the scenario using JDBC adapter at bothe sides sender nad receiver..
    Thanks,
    Soorya

    Hi,
    Refer the below link:
    JDBC:
    Receiver JDBC scenario MS access - /people/sameer.shadab/blog/2005/10/24/connecting-to-ms-access-using-receiver-jdbc-adapter-without-dsn
    /people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30 --> for jdbc receiver: file -JDBC
    Stored Procedures-
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    http://www.ics.com/support/docs/dx/1.5/tut6.html
    /people/sriram.vasudevan3/blog/2005/02/14/calling-stored-procs-in-maxdb-using-sap-xi
    http://www.ics.com/support/docs/dx/1.5/tut6.html
    http://java.sun.com/docs/books/tutorial/jdbc/basics/sql.html
    http://www.sqlteam.com/article/stored-procedures-an-overview
    HI in the message mapping structure u need to specify the different action and also u need to specify the procedure name.
    refer the below link which has all the associated action
    http://help.sap.com/saphelp_nw04s/helpdata/en/22/b4d13b633f7748b4d34f3191529946/frameset.htm
    Chirag

  • Synchronous JDBC adapter(receiver side) with stored procedure

    Hi experts,
    Can some database processing logic be included in receiver JDBC (synchronous) adapter...to put it simply
    I have synchronous JDBC adapter in the receiver side..Using this JDBC adapter I want to get some response back from the table..
    The requirement is not a simple fetch from the table..It involves some processing in the database side which I guess will be done by stored procedure..After this database processing , this output will be picked up by the JDBC adapter and will send to PI.
    How can this be achived ..Any Blog..
    Thanks
    Ayan

    Yes u can use stroed procedure and send back the response,
    refer this link for stored procedure structure.
    http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
    chirag.

  • JDBC Receiver : Handling NULL return from SELECT query

    Hi All,
    I have a Proxy <-> XI <-> JDBC synchronous scenario. I have designed my message mapping to perform a select query using JDBC receiver adapter. The request message mapping structure at the JDBC end is as follows.
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_Matmvmt_Jdbc_Request xmlns:ns0="http://esag.com/xi/bat/MatMovementRead">
       <StatementSelect>
          <Tablename action="SELECT">
             <Table>MM_DATA</Table>
             <access>
                <SEQNO/>
                <MATERIAL/>
                <UOM/>
                <SOLDQTY/>
                <SAPUPD/>
             </access>
             <key compareOperation="EQ">
                <SAPUPD>N</SAPUPD>
             </key>
          </Tablename>
       </StatementSelect>
    </ns0:MT_Matmvmt_Jdbc_Request>
    The scenario works fine when there are records matching the select condition, but when there are no records matching the select condition (i.e. if there are no record with value SAPUPD = 'N' ) then my response message is returning the empty message strucuture as given below.
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_Matmvmt_Jdbc_Request_response xmlns:ns0="http://esag.com/xi/bat/MatMovementRead">
       <StatementSelect_response/>
    </ns0:MT_Matmvmt_Jdbc_Request_response>
    My requirement is that if there are no records matching the select condition then my response message should look like below.
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_Matmvmt_Jdbc_Request_response xmlns:ns0="http://esag.com/xi/bat/MatMovementRead">
       <StatementSelect_response>
          <row>
             <SEQNO/>
             <MATERIAL/>
             <UOM/>
             <SOLDQTY/>
             <SAPUPD/>
          </row>
       </StatementSelect_response>
    </ns0:MT_Matmvmt_Jdbc_Request_response>
    Note : I have made the occurence of the request and response message elements as miniccurs = 0 and maxoccurs = 1.
    Any inputs in this regard will be highly appreciated.
    Regards,
    Sandeep

    Hi Sandeep,
    you can not expect structure like <?xml version="1.0" encoding="UTF-8"?>
    <ns0:MT_Matmvmt_Jdbc_Request_response xmlns:ns0="http://esag.com/xi/bat/MatMovementRead">
       <StatementSelect_response>
          <row>
             <SEQNO/>
             <MATERIAL/>
             <UOM/>
             <SOLDQTY/>
             <SAPUPD/>
          </row>
       </StatementSelect_response>
    </ns0:MT_Matmvmt_Jdbc_Request_response>
       if there is no data in table. The response which you are geting is standard format which you can not change. Instead you map this response with mapwithdefault node function while mapping to target to make the response mapping success, even though there is no data in response message.
    thanks,
    madhu

  • JDBC Receiver: Check INSERT Query.

    Hi Experts,
    I am working on IDOC To JDBC(INSERT) Scenario.
    Is there any possibility to check the INSERT Query that triggered by Receiver Adapter? If its possible please guide me how .
    Thanks,
    Vijay.

    Hi Vijay,
    Configure parameter logSQLStatement = true in advanced parameter of JDBC receiver channel. It will show the INSER query in audit log of message which you can see from message monitoring of RWB.
    Regards
    Sushil

  • Executing Select query using JDBC Receiver Adapter

    I created couple types in Oracle and also new function instead of procedure
    Can I execute the above query using JDBC Receiver Adapter.
    select *
    from  the ( select cast( apr.get_distribut('', '', '', 'hdfcgd', 'CAN') as dsrTable )
             from dual );
    If possible how my message structure should look like...

    Hi vikram,
       If you use JDBC as Receiver Adapter you can only post the data to the data base I do no think so we can select the records from the data base.
       If you use JDBC as Sender hope,we can the select query in the sender communication channel.
        Hope I am clear.
      Thanks and Regardds,
      Chandu.

  • Do we have any Acknowledgement concept At receiver side of JDBC Adapter

    Helo,
    Do we have any Acknowledgement concept At receiver side of JDBC Adapter?
    Thanks,
    Soorya

    Hi venkat,
    For receiver JDBC adapter message can be sent synchronously and asynchronously.
    In case of SELECT  statement only synchronous makes sense..since the JDBC adapter will select some rows/columns and return it.
    In case of other statements (UPDATE,INSERT,DELETE) if the message is sent synchornously.. u will get only the no of rows affected..so these can be treated as acknowledgement...
    Regards
    Biplab
    **Reward points if it helps u**

  • Updating in JDBC receiver adapter

    Hi Friends,
         I came across in the some sdn blogs, Like JDBC to JDBC scenarios i found that in the receiver JDBC adapter there is no place to write update statement or insert statement.Then how the records get updated in the DB.
    My actual need is to update the oracle db from sap, which currently using the following statement
    Loop at it_trn_ctl into WA_TRN_CTL.
    UPDATE TableA SET SAP_UPDATE = 'Y'
                                      WHERE PARENT_ID = :WA_TRN_CTL-PARENT_COIL .
    end loop.
    should replaced by XI, using the proxy to jdbc receiver. Where i can write the update statement and the where condition.
    Kindly revert back for queries.
    Thanks in advance
    Karthikeyan

    hi
    for updation no need to write any query,use update structure at reciever side
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/frameset.htm
    this contains action:udate and then
    key1: field that u want to update.
    key2:pass old value of field for matching(where conditon matching field)
    Edited by: Dharamveer Gaur on Sep 19, 2008 8:40 AM

  • Issue with processing time of JDBC receiver adapter

    Hi all,
    We are using PI 7.1 EHP1.
    We have an issue with JDBC receiver adapter taking too much time to process messages.
    We are using XML SQL format message protocol with INSERT_UPDATE as the document format.
    Each message can contain multiple records, i.e. 1 single message can result in many updates/inserts.
    Currently, time taken to process in 6-12 secs which is quite high considering the messages are not very large in size.
    We sent the statements to Oracle DBA to see if anything about the queries being used is causing issues. Awaiting inputs.
    In the mean time, wanted to check if there is anything that can be done from PI side that will help us improving the processing time.
    Thanks in Advance,
    Sailaja.

    Hi,
           i think the main cause is  query taking long time to execute in DataBase.
          -> increase the read time and response time in the JDBC receiver adapter.
      In the advanced mode table section of sender channel and receiver channel configurations, we can set driver properties for each DB connection. Any such property would have to contain prefix 'driver:'(with out quotes).
    For Oracle Database JDBC thin driver 10.2.0.3 version, the property oracle.jdbc.ReadTimeout helps to set read timeout while reading from the socket. Also for setting login time out in Oracle, we use oracle.net.CONNECT_TIMEOUT. To set these two properties use as follows: driver:oracle.jdbc.ReadTimeout 1000 driver:oracle.net.CONNECT_TIMEOUT 1000 The TimeOut Driver properties like ReadTimeout and CONNECT_TIMEOUT are in milliseconds.
    Refer note 1078420 for more details
    please go through this blog i hope it will help you.
        http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/c059d583-a551-2c10-e095-eb5d95e03747
    regards,
      ganesh
    Edited by: ganesh.nijampudi on Oct 25, 2011 12:00 PM

Maybe you are looking for