Two select query in sender JDBC adaptor
Hi
We are doing JDFC-RFC scenario, in which i need to fetch the data from two tables (header and item table) whch correspondes to the 2 table parameter of RFC .
Any clues how to configure sender jdbc CC having 2 select query ??????
Regards
Vijay
Swatantra,
You can have a look at the below URL for more info on JOIN.
http://www.w3schools.com/sql/sql_join.asp
Best regards,
raj.
Similar Messages
-
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,
SomenathHi ,
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. -
Hi All,
Many thanks for all kind support so far.
I have two report (sql query)
I want to add both the sql query
1st sql query
select distinct(a.item_number)
,a.quantity - b.quantity
from QUANTITY_ONHAND_ATP a,BACKLOG_ATP_LT_CW b
where a.item_number = b.item_number
order by item_number2nd sql query
select distinct(wb.item_number)
,wb.quantity - be.quantity
,a.quantity - b.quantity
from BACKLOG_WEEK_BEFORE_ATP wb
,BACKLOG_ATP_ET_CW be
,BACKLOG_WEEK_AFTER_ATP a
,BACKLOG_ATP_GT_CW b
where wb.item_number = be.item_number
and a.item_number = b.item_number
and wb.item_number = a.item_number
and be.item_number = a.item_number
and wb.item_number = b.item_number
and be.item_number = b.item_number
order by wb.ITEM_NUMBERIn 1st sql query i have 129 records and in 2nd sql query i have 14 records. I want to combine these two sql query. If the item_number of 1st sql query is not there in 2nd one then display it as it is in 1st sql only.
Any help how to do that.
RegardsHi,
the gerenal approach to combine the results of two or more SQL queries would be the
UNION / UNION ALL
INTERSECT
MINUS
SQL clauses. Union just combines the results; INTERSECT will return the rows which are present
in both result sets and MINUS will reduce the first result set by the rows of the second.
Basically it works like this
select * from emp where deptno = 10
union all(
select * from empo where deptno = 20
All the queries must have identical columns in the result set - same number of columns
and the same data types. So you would have to add a column to your first SQL query ...
select distinct(a.item_number) item_number,
to_number(*,null*) first_value
,a.quantity - b.quantity second_value
from QUANTITY_ONHAND_ATP a,BACKLOG_ATP_LT_CW b
where a.item_number = b.item_number
order by item_number
and in the second query I'd recommend to use the same aliases ....
Does this help
-Carsten
Deutschsprachige APEX-Community: Tipps, Tricks, Best Practice
http://tinyurl.com/apexcommunity
SQL und PL/SQL: Tipps, Tricks & Best Practice
http://sql-plsql-de.blogspot.com
Twitter: @cczarski -
SELECT,UPDATE, DELETE With JDBC Adaptor
Dear All,
I need to execute few Select, update and Delete statement by using JDBC Adaptor.
Suppose While select statement no records selected.
During Update no records exsist with specified key so no update possible.
During delete if no record found with specified key so no deletion possible.
In above cases do I get any error, any where in XI . Either in SXMB_MONI or in RWB.
Regards,
RaghvendraHi
You will be getting SQL error in RWB and not processed flag in SXMB_MONI
Along with this you can use OS level command STDOUT and STDERR to write out the trace.
using JDBC you can even use following Isolated setting.
· Default (default setting of the respective database)
· None
· read_uncommitted (weakest setting)
· read_committed
· repeatable_read
· serializable (strongest setting)
You must only lower the isolation level where necessary and as far as necessary. To avoid data inconsistencies in the database when the isolation level is lowered, ensure that multiple database transactions cannot access the database simultaneously.
With this Do not set Auto Commit enabled indicator if the JDBC driver supports transactions.
Thanks
Gaurav Bhargava -
Hi ABAPers,
Can you please tell me how to concatenate this two select qureies.
select ebeln knumv from ekko INTO
TABLE tt_knumv
where ebeln = p_ebeln.
select ebeln knumv from eslh INTO TABLE
tt_knumv FOR ALL ENTRIES IN tt_esll
where packno = tt_esll-sub_packno.
Regards
Abhinab MishraHi,
I dont think inner join is possible in this case since you are selecting the same fields from the two different tables into the single internal table vertically. It can be used to collect the data into the internal table horizontally but that would make no sense in this case. May be you can try something like this
data: t_temp type table of tt_knumv.
select ebeln knumv
from eslh
INTO TABLE tt_knumv
FOR ALL ENTRIES IN tt_esll
where packno = tt_esll-sub_packno.
select ebeln knumv
from ekko
INTO TABLE t_temp
where ebeln = p_ebeln.
loop at t_temp.
move-corresponding t_temp to tt_knumv.
append tt_knumv.
endloop.
Regards,
Vik -
How to write a join sql commend in SAP PI sender JDBC, please give me example.
>> how can I divide this rows in XI in my Integration Process????,
I m not really sure about your actual scenario but if you are looking to club together values based upon some key,you can easily do that in message mapping by using formatByExample standard function.
Please have a look at the below blog to see its functionality.
New functions in the Graphical Mapping Tool XI 3.0 SP13 -
How to call sender JDBC Adaptor, if there is a indication file
Hi All,
I have a requirement need to pull data from Oracle and send it to BI.
Here what i need is like Oracle will give me Indication flat file with 0 records and it will be there in FTP floder, once XI finds that file in the FTP folder then only my JDBC sender adaptor needs to pull data from Oracel and send it BI
Could you pls suggest me how i can achive this hope we can do it with BPM, or any suggestions to do this.
Thanks in advance,
Venkat.Hi,
True that i am new to XI.
Here the problem is i will get 0 bites flat file i will not get any data in that file, so how i can handle that flat file, and once the flat file is there after that i need to start the JDBC sender adaptor to pull the data
1. Receive step for the Flat File
2. Synchronous Send step for Calling JDBC (so you will get some JDBC response back to IP).
3. Asynchronous Send step to send step2 JDBC response to BI system.
as you said the BPM will be like this am i correct
Receive step for File-->Receive step for JDBC-Send step for BI am i correct this process.
could you pls explain me bit more so its like
Thanks inadvance
Venkat -
Dynamic select querry in sender jdbc adapter
Hi,
We are working on a scenario where in we will be using different source database tables , we were trying to see if it is possible that the select querry can be made dynamic so that the same communication channel can be used for all the different source tables.
Request all to come up with suggestions as to if this is possible.
Thanks ,
Pravesh Puria.Hi All,
Thanks VJ for your reply.
Let me reframe my question.
I have multiple database instances at source side. On all instances I have same table name.
My requirement is to poll all these instances table and fetch data.
Do I need to create multiple sender agreements or there is a way to dynamically change the datbase name in sender Communication channel.
Any other solution is also appreciated.
Same is the case with JMS adapter, Multiple instances of JMS are there at source side sending similar structure data in there own queue.
Request you to kindly response.
Regards,
Pravesh -
Dynamic select querry in sender JDBC channel
Hi,
We are working on a scenario where we need to read data from various database tables , we were trying to see if it is possible that the select querry can be set dynamically so that the same channel can be used to read from the various tables.
Request all to please come up with suggestions as to whether this is possible.
Thanks ,
Pravesh Puria.Hi All,
Thanks VJ for your reply.
Let me reframe my question.
I have multiple database instances at source side. On all instances I have same table name.
My requirement is to poll all these instances table and fetch data.
Do I need to create multiple sender agreements or there is a way to dynamically change the datbase name in sender Communication channel.
Any other solution is also appreciated.
Same is the case with JMS adapter, Multiple instances of JMS are there at source side sending similar structure data in there own queue.
Request you to kindly response.
Regards,
Pravesh -
Need help reg sender JDBC adapter
Hi,
I am having a requirement like, i need to fetch the data from two data base tables. and after fetching the data, i need to update those two tables.
For selecting the data from two tables, two select statements i need to write, how i can give two select statements in sender JDBC comm channel.
In sender JDBC channel, only one update query we can give...how i can update two tables?
Regards,
Venkata Ramana.Hello Venkat,
For your requirement, go for stored procedure and find the below thread.
Fetching data from JDBC without using JDBC sender adapter
Re: Executing an Oracle Stored Procedure from Sender JDBC adapter
Re: Sender JDBC adapter not picking up data
Re: Retrive data from two diffirent tables
hope this will help you
Thanks,
Venky -
Retreiving data from 2 tables using a sender JDBC Channel
Hi all,
We got anew requirement where we have to select data from 2 tables and update fields in 2 tables at the sametime.
I have a few queries regarding this.
Can we retrieve data from 2 tables using select query in sender JDBC channel?
If yes, how we can achieve this?
Can we use inner/outer joins in the select query?
Can we update field of 2 tables using the Update query in Sender JDBC channel?
Your help is greatly rewarded.
With Regards
Sudha.Hi,
Even i have the same requirement where data has to be read from 2 tables and later update the falg once done .
SELECT query :
SELECT t1.KUNNR,t1.SETT_KEY,t1.QUART_START,t1.QUART_END,t2.PAY_METH,t2.MAT_NDC,t2.AMOUNT FROM TSAP_REBATE_MEDI t1 INNER JOIN TSAP_REBATE_LINE t2 ON t1.KUNNR=t2.KUNNR AND t1.SETT_KEY=t2.SETT_KEY WHERE t1.PROCESSING_STATUS = 'N' AND t2.PROCESSING_STATUS = 'N'
This is working fine.
Can somebody help me with update query with this. where flag PROCESSING_STATUS has to be updated with 'P'.
I tried a lot but couldnt get the answer
Br,
Manoj -
Dynamic query configuration in sender jdbc adapter
Hi,
According my undertsnading in XI.3.0 dynamic query in sender JDBC adapter is not possible.
could any one confirms the possibility of this feature in XI 7.0 .
Thanks,
venuHi VJ,
sorry for late responding to your answer.
One of our requirements is the query statement that we write in sender communication channel should be changed dynamically, for example in where condition the condition parameters values required to change.
Thanks,
venu -
Select Query in the receiver JDBC
Hello all,
Is it Possible to use the select query in eceiver JDBC.
Thanks,
SrinivasaHi Srinivas,
You can either create the structure or can directly write the SQL_QUERY or| SQL_DML statement where you will specifty the action SQL_QUERY | SQL_DML .
So you can use either XML SQL Format or Native SQL Format. Please see this help srini:
http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
Regards,
---Satish -
Broken pipe error in Sync Send JDBC Receiver: Extremely Serious issue
Hi forum,
I have a serious error in a JDBC->XI--> JDBC scenario,
Step1: I use a sender JDBC channel to select some distinct values from a table say X, and update the same rows,
Query SQL Statement: select distinct Branch from dbo.X where status = 0
Update SQL statement: update dbo.X set Status = 2 where Status = 0
Step 2: enter BPM
Step 3: enter a loop
Step 4:make a synchronous call to the same table X, to fetch some records,
SQL query: select * from X where status = 0 and Branch = i; Update X set status = 9 where Branch = i
Step 5: close loop, this loop iterates for 5 or 6 times depending on i, which is no. of branches selected by the sender JDBC channel
so all the calls are to the same table, same databsse(SQL Server)
the problem is when this sync calls happens in the loop, it some times gives following error, which i se in RWB:
<b>Error Unable to execute statement for table or stored procedure. 'X' (Structure 'STATEMENT_X') due to com.microsoft.sqlserver.jdbc.SQLServerException: An exception occurred during the DBComms.transmit operation. Exception:Broken pipe (errno:32). Context:(2217)</b>
i have no way to trace the cause of the error, the database is perfect and the error logs in the SQL server shows no trace of any error,
Note: It works sometimes
i dont know whom to approach, pls help
the issue is very very serious as its in production system,Hi Sudeep,
SAP Note 846079 - XI 3.0 JDBC Receiver: # of Retries on SQL Error w/o Effect
Please check the following SAP note also - 831162
Some info which i found there and can be relevant in to your scenario.....
Q: I am using a JDBC Receiver Adapter in conjunction with the Lotus Domino Driver for JDBC perform an INSERT or UPDATE operation on a database. When sending a message to the receiver, the Adapter Monitoring shows the following error message:
"java.sql.SQLException: [Lotus][Domino Driver for JDBC]Invalid cursor state"
Is there a fix for this issue?
A: To work around this JDBC driver problem, activate the Advanced Mode for the respective JDBC Receiver channel and configure the setting "Number of Retries of Database Transaction on SQL Error" to a value > 0. Additionally, make sure that the setting "Database Auto-Commit Enabled" is also active as the Lotus Domino Driver for JDBC does not support transactions.
Apply note 846079 before configuring this scenario.
Q: The TCP/IP connection to my database host is running over an unreliable network connection, i.e. the connection is sometimes interrupted. Consequently, I sporadically receive an SQLException regarding a closed connection in the system trace or audit log or the connection as well as the JDBC Adapter channel are hanging.
How can I work around this connectivity issue?
A: Enable the "Advanced Mode" for the respective JDBC Adapter channel and select the option "Disconnect from Database After Processing each Message".
Note that this might put additional load on your DBMS due to the creation of a new database connection for each message.
I dont have access to a database right now, so i am not able to check this.
Also check the JDBC driver compatability as mentioned in the above note.
Cheer's -
How can i use index in select query.. facing problem with the select query.
Hi Friends,
I am facing a serious problem in one of the select query. It is taking a lot of time to fetch data in Production Scenario.
Here is the query:
SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
FROM ztftelat LEFT JOIN ztfzberep
ON ztfzberep~gjahr = st_input-gjahr
AND ztfzberep~poper = st_input-poper
AND ztfzberepcntr = ztftelatrprctr
WHERE rldnr = c_telstra_accounting
AND rrcty = c_actual
AND rvers = c_ver_001
AND rbukrs = st_input-bukrs
AND racct = st_input-saknr
AND ryear = st_input-gjahr
And rzzlstar in r_lstar
AND rpmax = c_max_period.
There are 5 indices present for Table ZTFTELAT.
Indices of ZTFTELAT:
Name Description
0 Primary key( RCLNT,RLDNR,RRCTY,RVERS,RYEAR,ROBJNR,SOBJNR,RTCUR,RUNIT,DRCRK,RPMAX)
005 Profit (RCLNT,RPRCTR)
1 Ledger, company code, account (RLDNR,RBUKRS, RACCT)
2 Ledger, company code, cost center (RLDNR, RBUKRS,RCNTR)
3 Account, cost center (RACCT,RCNTR)
4 RCLNT/RLDNR/RRCTY/RVERS/RYEAR/RZZAUFNR
Z01 Activity Type, Account (RZZLSTAR,RACCT)
Z02 RYEAR-RBUKRS- RZZZBER-RLDNR
Can anyone help me out why it is taking so much time and how we can reduce it ? and also tell me if I want to use index number 1 then how can I use?
Thanks in advance.Hi Shiva,
I am using two more select queries with the same manner ....
here are the other two select query :
***************1************************
SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
FROM ztftelpt LEFT JOIN ztfzberep
ON ztfzberep~gjahr = st_input-gjahr
AND ztfzberep~poper = st_input-poper
AND ztfzberepcntr = ztftelptrprctr
WHERE rldnr = c_telstra_projects
AND rrcty = c_actual
AND rvers = c_ver_001
AND rbukrs = st_input-bukrs
AND racct = st_input-saknr
AND ryear = st_input-gjahr
and rzzlstar in r_lstar
AND rpmax = c_max_period.
and the second one is
*************************2************************
SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
FROM ztftelnt LEFT JOIN ztfzberep
ON ztfzberep~gjahr = st_input-gjahr
AND ztfzberep~poper = st_input-poper
AND ztfzberepcntr = ztftelntrprctr
WHERE rldnr = c_telstra_networks
AND rrcty = c_actual
AND rvers = c_ver_001
AND rbukrs = st_input-bukrs
AND racct = st_input-saknr
AND ryear = st_input-gjahr
and rzzlstar in r_lstar
AND rpmax = c_max_period.
for both the above table program is taking very less time .... although both the table used in above queries have similar amount of data. And i can not remove the APPENDING CORRESPONDING. because i have to append the data after fetching from the tables. if i will not use it will delete all the data fetched earlier.
Thanks on advanced......
Sourabh
Maybe you are looking for
-
I was using my iTunes yesterday, and it was in English, today I opened the program and everything was in Russian. Why did this happen? and how do I change it back, as the language options are also in Russian.
-
Standard User Analyzer - Microsoft Compatibility Toolkit 5.6 - No (valid) log Error
Information: Test machine running Windows 7 Professional 64 bit. Machine is bound to an Active Directory domain Logged in as a standard user. I am testing some applications for compatibility in my company on this machine. I am currently trying to ut
-
Use values of field members from different movies
Hi all, i'm using a different movie in each exercise i'm creating, e.g. exer1.dir, exer2.dir etc etc. I'm putting the same global variable for the students grade in each movie to a field member e.g. field member -> score1 for movie exer1.dir , field
-
Adrelink error: gnumake: Error 128
Dear all, Platform: Windows2k3 Instance: Vision Version: 12.1.1 This is the test instance only. Concurrent manager was running fine on the same setup, as this is test instance today morning when i have started the same instance concurrent manager was
-
Hello all. I'm developing a web page compliant with WCAG 2.0 accessibility requirements. In this page I have a datatable and I need to include de 'id' attribute in the 'th' element, and the 'headers' attribute in each 'td' element. But the 'h:datatab