Select query problem in JDBC sender adapter

Hello Experts,
We have a problem with PI sender adapter that PI has started to miss records in database some database records are missing and we are using the below selet query :
SELECT * FROM [database name].[dbo].[Material_Movement] WHERE [Process_Order_Number] = (Select TOP 1 [Process_Order_Number] FROM [database name].[dbo].[Material_Movement] WHERE ([PI_Read_Date] IS NULL AND [Movement_Type] = (SELECT TOP 1 [Movement_Type] FROM [database name].[dbo].[Material_Movement] WHERE [Transaction_Code] = 'xyz' AND [PI_Read_Date] IS NULL ORDER BY Created_Date ASC))) AND [Transaction_Code] = 'xyz' AND [Movement_Type] = (SELECT TOP 1 [Movement_Type] FROM [database name].[dbo].[Material_Movement] WHERE [Transaction_Code] = 'xyz' AND [PI_Read_Date] IS NULL ORDER BY Created_Date ASC) AND [PI_Read_Date] IS NULL ORDER BY [Transaction_ID] ASC
I am weak in select query could you please check and suggest how the query can be modified to avoid this issue .
Thanks,
Somenath

Hi ,
After looking into These Query .. I found ...
Your Query Will run such Kind of scenario ..
1.)   Movement Type will be fetched from from below Query
        SELECT TOP 1 Movement_Type
        FROM database name.dbo.Material_Movement
        WHERE Transaction_Code = 'xyz'
       AND PI_Read_Date IS NULL
        ORDER BY Created_Date ASC
2.) on the  basis of abovr fetched  moment code . your Query will fetch 1 Process Order number
Select TOP 1 Process_Order_Number
FROM database name.dbo.Material_Movement
WHERE ( PI_Read_Date IS NULL
              AND Movement_Type =  Moment Type will be same as 1.
3.)
After  Getting 1 and 2 . Query will fetch Data  from table " dbo.Material_Movement "
On the basis of ..
Movement_Type = value from 1.
Process_order_type = value from 2.
Transaction_Code = 'xyz'
ORDER BY Transaction_ID ASC
So check Missed record Fullfill this Condition or not ....................
If not ... You will get why they are not picked by your given Query ...........
Hope it helps ..
regards
Prabhat Sharma.

Similar Messages

  • Problem with JDBC Sender adapter

    hi guys!
    I´ve problem in PI 7.0, with the JDBC Sender Adapter, execute select sentence and update status in Oracle database.
    In RWB Message Monitoring and SXMB_MONI I can't see any message.
    Someone have any idea how to fix it?
    Thanks in advance.

    Hi David,
    First check on the sender communication channel, if no data has been picked up by PI on channel,
    then check the configuration of channel in the ID, especially select query.
    If that is ok, then ask the sender application team(oracle database team) to run the query on their side
    and to check if they are getting any data.
    There could be the possibility of error in data also.
    -Supriya.

  • 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

  • Fundamnental question on jdbc sender adapter

    Hi ,
    I have a scneario like
    DB System „³ JDBC Adapter „³ XI  -„³ RFC Adapter „³ SAP R/3 --„³ True „³ response thru same RFC adapter „³ XI BPM will call JDBC Apdapter with Update statement
                                                                                    False „³ response thru same RFC Adapter „³ XI BPM will call File adapter with Append
    now when i use send jdbc adapter , i wld need to have a status flag in my database which would be update when ever data is transmitted sucessfully else the same data would always be picked up .
    i want to know do i need to create a reciever jdbc adapater too for this . because when ever i use sender jdbc adapter and this must be a very common situation . that i have to update the table so that the rows are not picked up again . jdbc senser  has an update statement . writtng an updtae query will it not solve my problem.

    Hi Amit,
    A JDBC sender adapter has 2 essential fields,
    1. SQL Statement
    2. Update Statement
    Your SQL statement will contain your SELECT statement and once your SQL statement is executed, UPDATE statement is executed. This is done so that records that have been selected by the SQL statement should not be selected again as the JDBC sender adapter will poll over the database for every poll interval.
    If you want to SELECT something from your Database, then you will have to go for a JDBC sender adapter.
    But, if you want to insert/update your Database, then you can go for a JDBC receiver adapter.
    Multiple insertions are possible for a JDBC receiver, but multiple Selection queries (different select queries) are not possible for a single JDBC sender adapter.
    Just check these links to understand how JDBC adapters work,
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm">Configuring the Sender JDBC Adapter</a>
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/content.htm">Configuring the Receiver JDBC Adapter</a>
    A few initial steps required to be followed for your Scenario are:
    1. Then create a sender agreement using jdbc o/b interface.
    In receiver determination specify ur bpm as receiver.
    In interface determination specify the abstract interface tht u created for jdbc.
    (u should copy the jdbc interface and then create abstarct interfce of it)
    No receiver agreement required for BPM.
    2. Create receiver determination, using BPM and the abstract interface for legacy tht u created,
    Receiver as legacy system.
    Create Interface determination and receiver agreements.
    Also see through this blog which talks about <a href="/people/saravanakumar.kuppusamy2/blog/2005/01/19/rdbms-system-integration-using-xi-30-jdbc-senderreceiver-adapter sender and receiver adapters</a>
    Regards,
    Abhy

  • 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

  • JDBC sender adapter - driver problems

    Hi.
    Iu2019m struggling with a little problem regarding the JDBC sender adapter, querying an Oracle database.
    Iu2019m making a simple SELECT statement, where one of the fields is of the typeu201DTIMESTAMP(0) WITH LOCAL TIMEu201D.
    Making the query in a SQL client works just fine, but in the JDBC sender adapter, it generates this error u201DError during conversion of query result to XML: java.sql.SQLException: Session Time Zone not set!u201D
    Iu2019ve searched for answers on numerous forums, and found one place, where the following where the solution:
    >>> Hi. The issue is that the driver itself needs to have a time zone
    >>> set. You have to call setSessionTimeZone() on the connection object.
    Unfortunately it is a bit hard to call this function in the adapter.
    Any of you guys have an idea what to do?
    I can add, that making a query, where no date fields are selected, works fine in the adapter.
    Regards...
    Peter

    Problem solved...
    Put a conversion (CONCAT, SUBSTR, TO_CHAR, etc.) around the date field you are about to fetch, and it works just fine.

  • PI 7.1 JDBC sender adapter huge load from DB select

    Hi,
    We have the problem that the JDBC sender adapter is selecting a huge amount of data from a Oracle DB. The Adapter seems to be able to cope the load but when sending to the integration server it causes problems. We found values to adjust but I dont think increasing them is a good solution.
    My question is:
    Is there any way to send the data in blocks with using the PI standard JDBC adapter ?
    Thank you and regards,
    Andreas

    Hi,
    You can use the below parameter in JDBC sender.
       Specify additional Parameter Names and Parameter Values in the table.
    Due to messages of large size it may cause issue
    Following are the parameters to be set in the table to limit the message size per polling:
    ●      msgLimit :
    ●      maxMsgSize :  SAP note 1253826.
    ●      maxRowSize : SAP note 1253826.
    Additional parameters are published in SAP Note 801367.
    Refer the link.
    Defining Additional Parameters in Advanced mode
    http://help.sap.com/saphelp_nw73/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm

  • 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>

  • JDBC Sender adapter - can VIEW be used in Query statement

    Hi,
    In JDBC Sender adapter, can we use a VIEW sql query in the "Query SQL Statement" placeholder?
    For eg:
    CREATE VIEW <view name> as SELECT * from <table name> WHERE <condition>
    instead of the usual:
    SELECT * from <table name> WHERE <condition>
    Thanks,
    Vishak

    Hi
    What exactly is your use of creating a view, if you are going to fetch data from different tables, then you can use the view through stored procedures.
    Hope this clears your doubts
    Thanks
    Saiyog

  • 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

  • In JDBC Sender Adapter , the server is Microsoft SQL .I need to pass current date as the input column while Executing stored procedure, which will get me 10 Output Columns. Kindly suggest me the SQL Query String

    In JDBC Sender Adapter , the server is Microsoft SQL .I need to pass current date as the input column while Executing stored procedure, which will get me 10 Output Columns. Kindly suggest me the SQL Query String , for executing the Stored Procedure with Current date as the input .

    Hi Srinath,
    The below blog might be useful
    http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/03/06/executing-stored-procedure-from-sender-adapter-in-sap-pi-71
    PI/XI: Sender JDBC adapter for Oracle stored procedures in 5 days
    regards,
    Harish

  • 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 outofmemory error

    Dear friends,
    We are getting following error on JDBC sender Adapter: Error during conversion of query result to XML: java.lang.OutOfMemoryError: Java heap space (failed to allocate 1073741848 bytes)
    I have read blogs where there have been suggestions to limit the amount of data picked by using WHERE condition and not using SELECT *
    In our scenario we are creating GL IDOCs . In SQL when PI picks it up it needs to get all the corresponding Header and line items together. We cannot randomly pick 1000 records at a time. The SQL table has 500,000 rows in the following format
    H H H  L1 L1 L1
    H H H L2 L2 L2
    H H H  L3 L3 L3
    H1 H1 H1 L1 L1 L1
    H1 H1 H1 L2 L2 L2
    H1 H1 H1 L3 L3 L3
    Please let me know how can we solve this issue?
    Thank you,
    Teresa
    Edited by: Teresa lytle on Sep 27, 2011 3:13 PM

    If you are using oracle database, uses ROWNUM field to fetch first set of records and you can update those records with the flag as true.
    similarly If you are using MS SQL database, uses SELECT TOP command to fetch first set of records and you can update those records with the flag as true.
    Like File/FTP adapter, the next poll interval would be as scheduled. The Administrator can then alter the table contents, to ensure lesser no of records are picked up.
    Here You need to limit the no of rows if you again face the problem. Please chec the SAP Note
    https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=1296819

  • JDBC Sender Adapter to Oracle Server

    Hi Friends,
    Iam using JDBC Sender Adapter to connect to Oracle Server. I have mentioned all the parameters in the Configuration(sender communication channel) correctly.My Adapter Monitoring in RWB shows a message that "Processing finished successfully"...But I cannot see the data in SXMB_MONI. I mean the data is not getting picked from the Database..I have worked on the similar scenario previously and it was working fine...
    I have specified the datatype structure correctly.
    resultset
    >row
    >>field1
    >>field2
    wat is the problem.
    regards,
    raju...

    Hi,
    Can you check the following,
    1. Check the SELECT query in your Sender JDBC adapter. Does it actually return any rows?
    2. The values enterd for Documentname and DocumentNamespace in your Sender JDBC adapter. You have to enter the name of the Datatype and the namespace in these fields.
    3.Have you enterd these details while doing the  adapter configuration,
    <b>jdbc:oracle:thin:@<IP adress>:<listener port>:<instance name (database name)>
    Driver oracle.jdbc.driver.OracleDriver</b>
    Regards,
    Bhavesh

  • JDBC Sender Adapter - SQL-Statement

    Hi,
    I'm using the JDBC-Sender-Adapter and need to use a SQL-Statement like this:
    SELECT * FROM myTable WHERE myDate = <current_date>
    Is such a dynamic-sql possible, or can I only use static sql-statements. And if yes how can I solve this problem.
    many thx

    Hi Werner,
    inside the <b>Query SQL Statement</b> you can use <b>SQL EXECUTE</b>
    which can execute a stored procedure
    in which you can do
    SELECT * FROM myTable WHERE myDate = <current_date>
    http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm
    Regards,
    michal
    <a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions">XI FAQ - Frequently Asked Questions</a>

Maybe you are looking for

  • How to open a PDF file in a iFrame using JSP

    I'm developing a EDM system and I need to upload a PDF file and later show it on the browser but in a iFrame. as the file is not in the system directory but into server directory. I tryed JavaScript: document.location.href="file://directory"; because

  • Problem in using iBook

    I cannot access to my iBook! When I touch it I just see a white screen....I cannot use my PDFs .... What's the problem in your idea?? What should I do?

  • Font characters are not spaced

    Hi We receive pdf documents from overseas people on a regular basis. The problem is that we are unable to read the text clearly, as it is not spaced . I have provided a screen shot of the problem. Is there a setting in Adobe Reader to auto correct th

  • Fn mod for date

    xperts, any fn mod available for getting dates like; if i am exec on Mon; Sun Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat (10 days) if i am executing it on Wed. Sun Mon Tue Wed Thu Fri Sat Sun Mon Tue Wed Thu Fri Sat (8 days) wat i need is th

  • 802.1x Authentication on IPAD and Mac book

    We have a few Mac book Air and IPADs (1&2) on our wireless network. They frequently loose connection to the network and the following errors have been come up: DOT1X-3-MAX_EAP_RETRIES: DOT1X-3-MAX_EAP_RETRANS DOT1X-3-INVALID_WPA_KEY_MSG_STATE DOT1X-3