JDBC Sender Adapter - Records sent one at a time

Hello everyone,
Here's a summary of my scenario JDBC > XI > RFC.
My select statement (JDBC) looks like this:
SELECT * FROM BATCH WHERE STATUS='Y'
The problem is, whenever it returns multiple rows, the RFC can only accept one record at a time (1...1), so I need to pick up the records from the DB and send them one at a time.
Currently, this is how the output XML looks like:
<?xml version="1.0" encoding="utf-8" ?>
  <ns:SQL_RESP_MT xmlns:ns="http://www.pharmaindustries.com">
  <row>
  <number>200000000472</number>
  <status>Y</status>
  </row>
  <row>
  <number>200000000473</number>
  <status>Y</status>
  </row>
  <row>
  <number>200000000474</number>
  <status>Y</status>
  </row>
</ns:SQL_RESP_MT>
Instead, I need each row to be picked up and sent one at a time.
<?xml version="1.0" encoding="utf-8" ?>
  <ns:SQL_RESP_MT xmlns:ns="http://www.pharmaindustries.com">
  <row>
  <number>200000000472</number>
  <status>Y</status>
</ns:SQL_RESP_MT>
<?xml version="1.0" encoding="utf-8" ?>
  <ns:SQL_RESP_MT xmlns:ns="http://www.pharmaindustries.com">
  <number>200000000473</number>
  <status>Y</status>
  </row>
</ns:SQL_RESP_MT>
<?xml version="1.0" encoding="utf-8" ?>
  <ns:SQL_RESP_MT xmlns:ns="http://www.pharmaindustries.com">
  <number>200000000474</number>
  <status>Y</status>
  </row>
</ns:SQL_RESP_MT>
Does anyone know the changes I need to make in my current SELECT statement or the JDBC Sender Adapter to make this possible.
Thanks in advance!
Glenn

Thank you all for your replies. I'll check out your link in a bit, Phani. Thanks!
A SpliByValue won't work since the BAPI Header is (1...1).
Luckily, during testing, I found out that the BAPI (BAPI_PRODORDCONF_CREATE_TT) handles multiple lines in one of the subelements of the header so that was where I mapped the Rows.
I might need to trigger multiple BAPIs in the future, so I'll take a good look at your suggestions, but for now, I'm marking this question answered.
Warm regards,
Glenn

Similar Messages

  • JDBC Sender Adapter - NOT FETCHING RECORDS...

    Hello Experts,
    I know this was answered in a separate thread (JDBC Sender Adapter -  NOT FETCHING RECORDS -PROCESSING STARTED).
    However, my question is, Is there a way that we can be notified if a channel has stopped fetching records?
    or is there a reporting tool that can be used to check/monitor if a channel is not processing any messages?
    Thanks & Kregards,
    allar

    Hi Sreedhar,
    Thanks for your reply.
    These case is not being captured by our alert configuration because its not throwing any error.
    in the communication channel monitoring, we see only something like this..:
    3/16/09 8:25:19 PM Processing started
    3/16/09 8:34:20 PM Processing started
    3/16/09 8:33:55 PM Processing started
    3/16/09 8:32:54 PM Processing started
    but no error is being displayed nor sent.
    Also, there was a case that the channel just stopped fetching, even though everything is active.
    example log:
            3/12/09 8:32:54 PM Processing started
    We're looking for ways on how we can trap these scenarios as early as possible,  get us notified and   perform adapter-lock release when needed.
    Regards,
    allar

  • JDBC Sender Adapter -  NOT FETCHING RECORDS -PROCESSING STARTED

    Hello all,
    I have set up a JDBC sender adapter .With polling interval as 30 Seconds. Polling is done successfully
    but it does not fetch the records .
    Valid Data is present in the tables.In the Communication Channel Monitoring log shows :
    "Processing Started"
    after each poll interval.
    Adding to this , it was working fine  with the same parameters two days back.
    I have enabled the Driver Trace but didnot get any information from Trace.
    How to resolve this issue?Any help
    Regards
    Ganga Prasad

    Hello maheshwari,
    Valid Data is there & many records are there to be fetched.
    One more thing  Normally in the Communication Channel Monitoring
    for an JDBC adapter even if there are no records to fetch we get the Log information in detail that :
    Polling interval started.
    Processing finished successfully
    Processing started
    Polling interval started.
    Processing finished successfully
    Processing started
    But here in my case am getting only : (polling interval : is 60 Seconds)
            2/5/08 8:29:19 AM           Processing started
         2/5/08 8:28:19 AM           Processing started
         2/4/08 3:34:54 PM           Processing started
         2/4/08 3:33:54 PM           Processing started
    One more observation is that my poll interval is 60 seconds but now it is polling after every 120sec
           2/5/08 11:17:31 AM           Processing started
         2/5/08 11:15:31 AM           Processing started
         2/5/08 11:13:31 AM           Processing started
         2/5/08 11:11:31 AM           Processing started
    I have tried refreshing Cache but no change .
    Regards
    Prasad

  • How to notify in case SQL query(JDBC sender adapter) does not fetch records

    hi,
    How can we notify(by alerts or something) in case SQL query(JDBC sender adapter) does not fetch records? In channels logs it only says processing started & finished(no message is created for same).
    Thanks,
    Mayank

    Hi,
    1 ) What is exact audit log message ?
    2) Try fetching the count in SQL statement  if there are any valid records it will give the count.
        May for testing you can use <TEST> in update statement.
    3) Have you used taskTimeout parameter ?
    4) Are multiple channels polling on same table ?
    regards
    Ganga

  • JDBC Sender Adapter - Transaction & Parameterized Query?

    Dear Experts,
    I'm curious about the JDBC sender adapter in SAP PI.
    As I see from the document and have been searching in the Internet, The default procedure of the sender JDBC adapter is to first run a SELECT/Store Procedure query then update the records that have been read before.
    Configuring the Sender JDBC Adapter - Advanced Adapter Engine - SAP Library
    What I want to ask is:
    - What is the database transaction used for the SELECT and the UPDATE? I mean what if the SELECT is successful and the records have been sent to the IE, but the UPDATE failed. This way, the next polling run, the same records could be read again. Is it possible? Are the SELECT and UPDATE query atomic (if one fails the other fails too)?
    - Is it possible to have a parameterized query / stored procedure in sender JDBC adapter? Because seeing at the default procedure, there should be at least a field that will be used as a flag (for example the processed field needs to be updated to '1'). Something like:
              - SELECT * FROM table_a WHERE docno > $last_doc_no
                             $last_doc_no is a paramter or variable from PI
              - EXEC sp_do_something ( $param_a, $param_b )
                             $param_a, $param_b are parameters or variable in PI
    Thank you,
    Suwandi C.

    Hi Suwandi,
    all action to database are in one transaction and thats mean if one failed all failed.
    And it is possible to have parameterized storied procedure. You sould send something like
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:mt_proc xmlns:ns0="http://aaaa">
       <statementname>
          <stProc action="EXECUTE"/>
          <TABLE>PROCEDURE NAME</TABLE>
          <access>
             <param_in isInput="1" type="some_type">input param</param_in>
             <param_out isOutput="1" type="some_type"></param_out>
          </access>
       </statementname>
    </ns0:mt_proc>

  • Update- statement in JDBC sender Adapter

    Hi ,
    I have a requirement where I am trying to fetch data from ODS based on some flag and immediately I want to update the flag status . So I used selected and update in JDBC sender adapter .
    But I have one question , in the small timeframe where  XI has done a select and just before  XI could  issue the update statement  if a new record is added to ODS . Then  that new record will also get updated though it wasnot selected in select statement .
    Can someone let me know how to overcome this problem ; as I want to make sure I update only those recrods which are selected in select statement ??
    Thanks & Regards,
    Suvarna

    Hi,
    Check out the following thread. It gives the exact answer to this question.
    JDBC Sender Update Query
    One of the replies in the above thread:
    I put in an OSS note asking this exact question with your specific example, and got a reply. I was referred to OSS note 0000831162, where it is explained very unambiguously that the SELECT and UPDATE queries are run in the same transaction.
    Regards,
    P.Venkat
    Message was edited by:
            Venkataramanan

  • ** JDBC Sender Adapter support custom module ...?

    Hi friends,
    Does JDBC Sender Adapter support custom module ? If it is how it wil work ?
    Kind Regards,
    Jeg P.

    Hi Kulwinder,
    We want to separte the records (1:n) returned by JDBC sender adapter XML. ie. Split/Parse the records in XML and then send to BPM (one by one) instead of whole message . For that purpose, we want to write an adapter module.
    Is this possible ?
    Kind Regards,
    Jeg P.

  • Challenging issue with JDBC sender adapter

    Hello Guys
    I have this requirement
    From Oracle Database I have to read to tables  one for the header and one for the detailes and map the result to one RFC.
    I have only  worked with one table at the time with the JDBC sender adapter but never with 2  tables
    My challenges are
    1 - How I can read the 2 tables at the same select statement , I suppose I have to use a join with 2 identical fields , so far so good ,but how I can handle multiple records
    suppose the result is 10 new different records which each of the recored has to be mapped to the RFC , then we will have 10 RFC calls.
    how can I do the mapping in this case.
    2 - How can I update the 2 tables at the samme time and flag them as processed , as far as I know we can not use 2 update statement in the same JDBC sender
    any help will do
    Thanks in advance.

    Hi
    Thanks for the replayes
    The RFC is used to create and Invoice Idoc , It has to be one record (Header and Item ) to one RFC.
    a JDBC to IDoc can also be used , but we have to update another table in SAP that is why the RFC,
    My doubt is how the Data type for the sender JDBC should look like , as mentioned I have 2 tables to fetch data from
    <Invoice>
    <Header> 1 -- 1
    <f1>
    <f2>
    <f3>
    </Header>
    <Item> 1--n
    <f1>
    <f2>
    <f3>
    </Item>
    </Invoice>
    The sender JDBC returns
    <Invoice>
    <row>
    <f1>
    <f2>
    <f3>
    </row>
    </Invoice>
    How can I replicate the data type to meet the JDBC sender structure.
    and regarding the mapping do I have to change the occurrunce to 0 -- unbounded
    regarding the update Ragu is right in his suggestion
    Table1 can be used as primary table, Table2 can be used as Secondary table.. u will have key field to link both table.
    So Just Updating only Primary Table(Table1) will helps on this.
    Thanks.

  • JDBC Sender Adapter - Single Select and Single Delete

    Hi,
    I have the requirement where I have to select the single row (or 1st row) from database through JDBC Sender Adapter and delete that record after selection in single polling.
    Please help me out with proper SQL query or with any other approach.
    Thanks and Regards,
    Vijay

    I think in SQL select statment you have something like Select TOP number....where number is 1,2..
    The detailed syntax for the SELECT clause is as follows:
    SELECT [ALL | DISTINCT] [TOP nExpr [PERCENT]] Select_List_Item [AS Column_Name] [, ...]
    for more details...check out..
    http://msdn2.microsoft.com/en-us/library/95c6ex88(VS.80).aspx
    Document sent on your email id.
    Nilesh

  • JDBC sender adapter: Update before mapping

    Dear all,
    following scenario:
    in a database we have a field called "statpi". We pick all messages that have statpi =  0 and
    update the data record to statpi = 1 via UPDATE function in JDBC sender adapter.
    Every select statement is limited to 100 data records for each message in PI.
    But if one data record is wrong and the mapping failed, of course the complete mapping failed.
    My problem: The update function of the JDBC sender adapter has already updated the
    data records, although they didn't have been send to target system.
    What I need is following thing: The adapter should send the messages and after PI has mapped
    the message and send it to target system, the UPDATE command should be executed.
    In my opinion, this is only possible with BPM, but I am not familiar with Advanced mode in JDBC
    sender adapter and "Transaction isolation level". Is there any workaround for this?
    Thanks
    Regards
    Chris

    Stefan Grube wrote:>
    > What happens, when new values have entered db meanwhile?
    The job that change the DB will be fixed on a certain time. We need to configure
    Availability Time Planning to be sure, that we start our select at another time.

    > > In ideal case the data records are still in statpi=0 and get picked up after
    > > the database team has fixed the problem and the adapter polls again.
    >
    > If the flag is not set, the JDBC adapter would poll the same data again and again.
    The adapter should poll every hour. Of course we will have some errors before the
    support is able to fix this problem, but because of one message each hour this should
    not be the main problem.
    > - You could do following: pass the values with an error flag, so you can handle this in receiver application,
    I am using the function formatNumber for the field that could raised the error. But to chekc if I am able
    to do a workaround here and let the target system fix the error sounds like an interessting possibility.
    > - Do a split mapping and create a file where you drop any wrong lines
    Also interessting. You mean that all "good" record should be mapped to struc1 and the bad one to struc2.
    I am thinking of how to determine which record is wrong. Perhaps with an UDF that checks for this special
    error.
    > - Use XML validation in sender adpter, so the messages are not processed.
    You are full of good ideas. I am not using validation yet and the mentioned field is define as string, but that
    is changeable. A good possibility to check the new capability of 7.1.
    > - use a stored procedure in DB whee you check data quality to send out.
    not sure what this is, but I will discuss with DB team.

  • JDBC sender adapter - 3 calls in PO 7.4

    Hi Experts,
    I have a scenario to fetch database records from ORACLE database using SAP PO 7.4 - JDBC adapter
    There are 3 calls to make in order to fetch the data
    a) Call a procedure before the fetch
    b) fetch the record
    c) Call another procedure after the fetch
    How can we achieve this ?
    thx
    mike

    Hi All,
    I am opening this up for a follow up qs on this topic. Is it true that we can't directly invoke a stored procedure from PI 7.4 sender JDBC adapter for retrieving data from ORACLE DB and we have to rely on table functions.
    I was looking at some blogs on sender JDBC stored procedure calls for SAP PI 7.1/7.3/7.4
    Executing stored procedure from Sender adapter in SAP PI 7.1
    Oracle Table Functions and JDBC Sender Adapter
    And the note Michael was referring to 941317 - XI / PI JDBC Adapter: Known Problems / Incompatibilities  has the following piece of code for invoking a stored procedure from a package function returning collection of elements.
               ---------- pkg1 ----------
    CREATE PACKAGE pkg1 AS
      TYPE numset_t IS TABLE OF NUMBER;
      FUNCTION f1(x NUMBER) RETURN numset_t PIPELINED;
    END pkg1;
    CREATE PACKAGE BODY pkg1 AS
    -- FUNCTION f1 returns a collection of elements (1,2,3,... x)
    FUNCTION f1(x NUMBER) RETURN numset_t PIPELINED IS
      BEGIN
        FOR i IN 1..x LOOP
          PIPE ROW(i);
        END LOOP;
        RETURN;
      END;
    END pkg1;
    ---------- pkg1 ----------
               This function has to be invoked from the sender channel configuration (SELECT statement) as follows:
               SELECT * FROM TABLE(pkg1.f1(5));
    If I can't call stored procedure directly from PI sender JDBC adapter in 7.4,
    I have to ask the Oracle DB guy to write a stored procedure which wraps all 3 procedures into one and again wrap it up using the package functions as well if required. So, please let me know.
    thx
    mike

  • How to update two tables in a single call using JDBC Sender adapter

    Hello All,
    The scenario is, database entries have to be selected from two tables and at the same time those tables have to be udpated with the flag.
    We are using JDBC sender adapter and in Select Query, we are fetching the data by joinin the two tables.
    Update Statemtent: We can only update one table using this statement.
    Is it possible to update two tables using the Update Statement without using Stored Procedures.
    Let me know.
    Regards,
    Sreenivas.

    Hi Sreenivas,
    > Is it possible to update two tables using the Update Statement without using Stored Procedures.
    Yes its possible through join statement
    Check this links
    Update in JDBC Sender adapter for more than one table
    data from 2 tables for jdbc sender adapter
    Regards
    Ramesh

  • Event Handling in JDBC sender adapter

    Hi,
    please help me in this scenario.
    Scenario is Third Party will update the Header and Item values in to Database table.
    Once the update is done , a program will run in Thrid party system and it will update the Event Table with the primary key value of the DB table.
    So my JDBC sender should be looking for the event table updation. Whenever there is an update in the event table the JDBC sender should automatically kicked off and it should select all the field in the DB table where the primary key = Event table.primary key and the values will be generated as an Idoc.
    1.How will i achive this scenario.
    2.How to configure the JDBC sender Adapter which gets triggered automatically when there is an updation in event table.
    please advice.
    Thanks,
    Sujatha

    Hi,
    >>2.How to configure the JDBC sender Adapter which gets triggered automatically when there is an updation in event table.
    There is way to control the Communciation Channel externally. Refer this help document http://help.sap.com/saphelp_nw04/helpdata/EN/45/0c86aab4d14dece10000000a11466f/content.htm.
    Or alternately you can create a query that always queries only the updated record and configure the JDBC adapter which would periodiocally look the DB...
    ~SaNv...

  • JDBC Sender Adapter

    Hi everybody
    I have the following error in my JDBC to JDBC scenario; I  configured the JDBC sender adapter and receive the following message back. In the Configuration I set “Document Name” to MT_ScanningStatus:
      <?xml version="1.0" encoding="utf-8" ?>
    <MT_ScanningStatus>
    <row>
      <ScannerNb>1</ScannerNb>
      <Status>0</Status>
      </row>
    <row>
      <ScannerNb>2</ScannerNb>
      <Status>2</Status>
      </row>
    <row>
    <ScannerNb>3</ScannerNb>
      <Status>0</Status>
      </row>
    <row>
      <ScannerNb>4</ScannerNb>
      <Status>2</Status>
      </row>
      </MT_ScanningStatus>
    I defined the  corresponding datatype as follow:
    DT_ScanningStatus Complex Type
            row              Element 1...unbounded
              ScannerNb      Element 1
              STatus         Element 1
    In the following Mapping I tried to Map this structure to the Structure used to send an Update SQL Statement to the JDBC Receiver to update the same table.  A normal Test in the Mapping Tool runs fine but when I enter under source the above incoming Message from the JDBC Adapter I got the following error. I think the incoming message cannot be interpreted. Can someone support me? I read the documentation for the JDBC adapter and also a lot of weblogs and discussion threads. Maybe someone knows a weblog describing more detailed the sender adapter and how to handle the incoming Message!!
    Thanks in advance Oliver
    14:58:03 Start of test
    Compilation of MM_JDBC_to_JDBC_test successful
    Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XML Declaration not allowed here.(:main:, row:1, col:8)
    com.sap.aii.utilxi.misc.api.BaseRuntimeException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XML Declaration not allowed here.(:main:, row:1, col:8)
    at com.sap.aii.mappingtool.tf3.rt.xparser.MTSaxHandler.run(MTSaxHandler.java:130)
    at com.sap.aii.mappingtool.tf3.rt.xparser.XParser.run(XParser.java:68)
    Root Cause:
    com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XML Declaration not allowed here.(:main:, row:1, col:8)(:main:, row=1, col=8) -> com.sap.engine.lib.xml.parser.ParserException: XML Declaration not allowed here.(:main:, row:1, col:8)
    at com.sap.engine.lib.xml.parser.XMLParser.scanPI(XMLParser.java:2009)
    at com.sap.engine.lib.xml.parser.XMLParser.scanProlog(XMLParser.java:2657)
    at com.sap.engine.lib.xml.parser.XMLParser.scanDocument(XMLParser.java:2713)
    at com.sap.engine.lib.xml.parser.XMLParser.parse0(XMLParser.java:162)
    at com.sap.engine.lib.xml.parser.AbstractXMLParser.parseAndCatchException(AbstractXMLParser.java:132)
    at com.sap.engine.lib.xml.parser.AbstractXMLParser.parse(AbstractXMLParser.java:142)
    at com.sap.engine.lib.xml.parser.AbstractXMLParser.parse(AbstractXMLParser.java:245)
    at com.sap.engine.lib.xml.parser.Parser.parseWithoutSchemaValidationProcessing(Parser.java:276)
    at com.sap.engine.lib.xml.parser.Parser.parse(Parser.java:338)
    at com.sap.engine.lib.xml.parser.SAXParser.parse(SAXParser.java:125)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
    at com.sap.aii.mappingtool.tf3.rt.xparser.MTSaxHandler.run(MTSaxHandler.java:128)
    at com.sap.aii.mappingtool.tf3.rt.xparser.XParser.run(XParser.java:68)
    at com.sap.engine.lib.xml.parser.SAXParser.parse(SAXParser.java:144)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
    at com.sap.aii.mappingtool.tf3.rt.xparser.MTSaxHandler.run(MTSaxHandler.java:128)
    at com.sap.aii.mappingtool.tf3.rt.xparser.XParser.run(XParser.java:68)
    Caused by: com.sap.engine.lib.xml.parser.ParserException: XML Declaration not allowed here.(:main:, row:1, col:8)
    at com.sap.engine.lib.xml.parser.XMLParser.scanPI(XMLParser.java:2009)
    at com.sap.engine.lib.xml.parser.XMLParser.scanProlog(XMLParser.java:2657)
    at com.sap.engine.lib.xml.parser.XMLParser.scanDocument(XMLParser.java:2713)
    at com.sap.engine.lib.xml.parser.XMLParser.parse0(XMLParser.java:162)
    at com.sap.engine.lib.xml.parser.AbstractXMLParser.parseAndCatchException(AbstractXMLParser.java:132)
    at com.sap.engine.lib.xml.parser.AbstractXMLParser.parse(AbstractXMLParser.java:142)
    at com.sap.engine.lib.xml.parser.AbstractXMLParser.parse(AbstractXMLParser.java:245)
    at com.sap.engine.lib.xml.parser.Parser.parseWithoutSchemaValidationProcessing(Parser.java:276)
    at com.sap.engine.lib.xml.parser.Parser.parse(Parser.java:338)
    at com.sap.engine.lib.xml.parser.SAXParser.parse(SAXParser.java:125)
    ... 3 more
    Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XML Declaration not allowed here.(:main:, row:1, col:8)

    Hi Oliver,
    >>>>source the above incoming Message from the JDBC Adapter I got the following error. I think the incoming message cannot be interpreted.
    do this:
    in the test tab try your mapping once more
    (the correct one)
    then save the source xml as file
    next compare this saved file with the one
    you get from the jdbc sender
    >>>>>Declaration not allowed here.(:main:, row:1, col:8)
    and compare the first lines in those two XML files
    are they the same?
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>

  • JDBC Sender adapter - Oracle - Stored Procedure - Error

    Hello,
    Need few clarifications on JDBC sender adapter and stored procedures when connecting to Oracle DB.
    My scenario is, Oracle to SAPBW. So in sender JDBC adapter, we have used a SP having multiple SQL statements it, esp. one of the SELECT statment having Joins on a table and View.
    My questions are,
    1) Is it possible to have more SQL statements in SP for Sender JDBC?
    2) Is the SP of Oracle DB returns resultset or cursor?
    I have tried in searching the forum perticularly for connecting to Oracle as Sender and below like said  that there is a limitation of XI JDBC when connecting to Oracle.
    Executing an Oracle Stored Procedure from Sender JDBC adapter
    So please clarify the doubts and help me.
    With regards,
    Jilan

    Hi Jilan,
    Unlike what was mentioned in the link given by you that oracle returns cursor and not resultset is not completely true. It may be difficult but certainly not impossible.
    Refer : http://www.enterprisedt.com/publications/oracle/result_set.html
    regards
    joel

Maybe you are looking for