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...
Similar Messages
-
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!
GlennThank 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 -
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> -
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: 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
ChrisStefan 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. -
Can we proceed even if no ResultSet Returned In JDBC Sender Adapter ?
Hi friends ,
My scenario is JDBC to RFC . I am reading table using JDBC Sender Adapter and i am passing values to RFC .
If my select Query has not returned any row then it won't come to Pipeline right ?
What i want is
<b> If no rows returned then call one RFC to insert the remarks .
If rows found call another RFC to insert the values </b>
How can i handle the Situtation ?
Expecting your reply asap
Regards.,
V.RangarajanHi Rangarajan,
i answered your question and shown up a solution: If Connection Lost in JDBC or no resultset returned how to handle ?.
Double postings makes it difficult for all involved people to inform theirselfes about the point of discussion.
The polling sender adapter is doing nothing, if no rows selected. So how do want to send a message?
You have to use the JDBC receiver adapter, invoke the message by a job in ERP, for example with a self written RFC or a proxy. You can decide at ERP side, which function module it to be called. Of coz there are other possibilities, for example to put the logic into a business process, but you wont have success with the sender adapter.
Regards,
Udo -
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 -
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 -
JDBC Sender Adapter - No Namespace found
Hello
I am currently using PI 7.1. The scenario is JDBC to ECC ABAP Client Proxy. When the JDBC Sender Adapter sends the data to the Integration Server, the root element does not contain the xmlns attribute. This root element is constructed from the Document Name of the JDBC Sender Adapter attribute.
I am getting the following error:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!-- Request Message Mapping
-->
- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
<SAP:Category>Application</SAP:Category>
<SAP:Code area="MAPPING">EXCEPTION_DURING_EXECUTE</SAP:Code>
<SAP:P1>com/sap/xi/tf/_MM_HIS_Material_Consumption_</SAP:P1>
<SAP:P2>com.sap.aii.mappingtool.tf7.IllegalInstanceExcepti</SAP:P2>
<SAP:P3>on: Cannot create target element /ns0:MT_Material_</SAP:P3>
<SAP:P4>Consumption_ECC/Material. Values missing in queue~</SAP:P4>
<SAP:AdditionalText />
<SAP:Stack>Runtime exception occurred during application mapping com/sap/xi/tf/_MM_HIS_Material_Consumption_; com.sap.aii.mappingtool.tf7.IllegalInstanceException: Cannot create target element /ns0:MT_Material_Consumption_ECC/Material. Values missing in queue~</SAP:Stack>
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
When I perform a test at RWB, the message gets posted successfully. Once posted, the payload of this message contains the xmlns attribute.
Here is the root element from both the instances:
From RWB: <ns0:MT_Material_Consumption_JDBC xmlns:ns0="http://xxx.com/xxx/finance">
From JDBC Adapter: <ns0:MT_Material_Consumption_JDBC>
Could you please let me know, what has to be done to obtain the xmlns in the sender payload?
Thank you in advance.
John Jeyaraj
Edited by: John jeyaraj on Apr 7, 2011 8:22 AMHi Hiren
When I test the MM without the xmlns attribute, I get the following error:
The prefix "ns0" for element "ns0:MT_Material_Consumption_JDBC" is not bound.
When I add the xmlns attribute, the mapping is successful.
Thanks
John -
How to use sql variables in jdbc send adapter??
Hi,
i wanna use a variable in the sql statement in the jdbc send adapter.
i know i can key sql statement in the "Query SQL Statement" in the jdbc send adapter.but i dont know how to use variables in the sql statement.
i mean, for example, the sql statement is "SELECT * FROM t_student WHERE READFLAG = 0", but now i wanna instead of "0"(the value of the READFLAG) using a variable.
and if i can use a variable to replace the "0"(the value of the READFLAG above sql statement), then how can i send a value to the variable??
request help in the regard.
thx in advance.
BrianHi,
Use the place holders to pass the data at runtime. Check the below structure for more details.
Hope this helps.
Thanks and Regards,
Kalpesh
<root>
<stmt>
<Student action="SQL_QUERY">
<access> SELECT * FROM t_student WHERE READFLAG = '$FLAG$ </access>
<key>
<FLAG>0</FLAG>
</key>
</Student>
</stmt>
</root> -
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,
AndreasHi,
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> -
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. -
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,
VishakHi
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 - 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,
JilanHi 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
-
I have now learned that our 2G IPods will not update any further to the latest ISO. but now that I just rebooted my son's Ipod he has lost a LOT of apps because they are no longer compatible with the softwear version on the IPod! Is there a way to g
-
PRS-T1 stuck in infinite reboot loop after failed firmware update
Hi, I tried to update the firmware, but failed when updating to version 1.0.07.05070. Tried to 2 times. The first time it failed I simply tried again. The second time, it took a lot longer to reach the failed to update message, but it did cause the e
-
PO Approval Date in SSP Approval screen
Hi, We are using ECS with SRM4.0. All the Purchase Orders in Awaiting Approval status shows the pending Approval Date as today's date. But the PO Approval WorkItem is lying with Approver for the past 10 days. Pls advise so that the correct approval i
-
Accessing static members of subclasses
So here is my problem. I have two beans (one extends the other), and I have one DAO class for each to access their tables (using Hibernate). In most cases the queries will be identical so I also have an abstract DAO class (extended by the other two D
-
Loadbalancing ldaps on ACE module
Is it possible to configure loadbalancing of ldaps with end-to-end mode (encryption from end to end) on ACE module ? And if yes, do i have to use a special script for health checking ?