Inner Join Condition For Database Tables in JDBC Adapter
Hi
Is there any restriction for Number of database tables to Write Inner join Condition in JDBC.
Thanks
Venkat,
No there is no restriction in Inner join. If your query executes perfectly in target Database then the same query will exceute perfectly while calling through XI.
Best regards,
raj.
Similar Messages
-
More than one join condition for 2 tables in obiee
Hello,
I am using obiee 11g.
There are 2 tables tableA and tableB where the join condition is like (tableA.col1=tableB.col1) or (tableA.col1 is null and tableB.col1 is null)
where should i do these type of joins.
I tried putting in physcial layer->f(x) but giving error like here only columns an d opertaors are allowed.
Thanksok here it goes.
I have a tableA with columns col1(pk),col2 and other columns
I have tableB with columns col1(pk),col2..Only these 2 columns.
Now distinct tableA.col2 values are put in tableB.col2. For those distinct values i have put the tableB.col1 values.
Now tableA.col2 as well as tableB.col2 can be null beacuse there may be null values in tableA.col2.
Now in tableB i have added one more row which has col1 as value and col2 as null.
Now when in physical layer when i do tableA.col2=tableB.col2 i dont get the null values.
What i want is whenever the tableA.col2 and tableB.col2 is null then take tableB.col1 for those vales.
So when i query i do
select * from tableA,tableB where
((tableA.col2=tableB.col2) or (tableA.col2 is null and tableB.col2 is null))
What i want is when i do a join i should be able to give this OR condition in rpd thats it.
because when i do in where clause of content tab it goes like a AND condition and not OR.
Thanks
Edited by: user123 on Jul 5, 2011 1:57 PM -
Populating SAP Database table using JDBC adapter
Hi Folks,
I have a requirement to populate a SAP database table say ZTABLE using XI. The Model is the table has to be populated through a file which will be processed by SAP XI. Basically this is a File to JDBC scenario. The database used is ORACLE. Kindly provide me some idea to go ahead.I tried to place the MS access table in the shared folder of the Application server system but still it seems the table is not being populated.
did you check the log in your receiver channel? (/people/sameer.shadab/blog/2005/10/24/connecting-to-ms-access-using-receiver-jdbc-adapter-without-dsn)
The requirement is to update the tables directly as those are the custom tables.
i would still say that do not update SAP tables directly from XI/ PI.....this is not a standard architecture/ solution.... -
Inserting Multiple Rows into Database Table using JDBC Adapter - Efficiency
I need to insert multiple rows into a database table using the JDBC adapter (receiver).
I understand the traditional way of repeating the statement multiple times, each having its <access> element. However, I am just wondering whether this might be performance-inefficient, as it might insert records one by one.
Is there a way to ensure that the records are inserted into the table as a block, rather than record-by-record?Hi Bhavesh/Kanwaljit,
If we have multiple ACCESS tags then what happens is that the connection to the database is made only once. But the data is inserted row by row.
Why i am saying this?
If we add the following in JDBC Adapter..logSQLStatement = true. Then incase of multiple inserts we can see that there are multiple
<i>Insert into tablename(EMP_NAME,EMP_ID) VALUES('J','1000')
Insert into tablename(EMP_NAME,EMP_ID) VALUES('J','2000')</i>
Doesnt this mean that rows are inserted one by one?
Correct me if i am wrong.
This does not mean that the transaction is not guaranted. Either all the rows will be inserted or rolled back.
Regards,
Sumit -
Inner joins Vs for all entries
Hi All,
Pls let me know
the differences b/w innerjoins and for all entries,,,,which is the best option and Y??
Thanks in Advance,
ByeHi!
INNER JOIN is used if we want to retrieve some data from more than one table.
FOR ALL ENTRIES is used if we want some data from a table based on some conditions of some other table.
Using several nested INNER JOIN statements can be inefficient and cause time out if the tables become too big in the future."
In ABAP, these joins are first split by the ABAP processor and then sent to the database, with the increase in DATA in production system, these joins tend to give way if your database keeps growing larger and larger.
You should rather use "FOR ALL ENTRIES IN" (Tabular conditions), which is a much efficient way as far as performance is concerned.
Check these links:
inner joins and for all entries
inner join and for all entries
Reward points if it helps.
Regards
Sudheer -
INNER JOIN with FOR ALL ENTRIES IN Performance ?
I am using following the following <b>Select using Inner join with For All Entries in.</b>
SELECT kebeln kebelp kvbeln kvbelp
FROM ekkn AS k INNER JOIN ekbe AS b ON kebeln = bebeln
AND kebelp = bebelp
INTO TABLE gi_purchase
FOR ALL ENTRIES
IN gi_sales
WHERE k~mandt EQ sy-mandt
AND k~vbeln EQ gi_sales-vbeln
AND k~vbelp EQ gi_sales-posnr
AND b~budat EQ p_date.
If i am not doing inner join then I will have to do 2 select with for all entries in on ekkn and ekbe tables and then compare them.
<b>I want to know which one has better performance
Inner join with for all entries in
or
2 Selects with for all entries in</b>the join is almost aways faster:
<a href="/people/rob.burbank/blog/2007/03/19/joins-vs-for-all-entries--which-performs-better">JOINS vs. FOR ALL ENTRIES - Which Performs Better?</a>
<a href="http://blogs.ittoolbox.com/sap/db2/archives/for-all-entries-vs-db2-join-8912">FOR ALL ENTRIES vs DB2 JOIN</a>
Rob -
Inner Join with For All Entries - Performance ?
I am using following the following <b>Select using Inner join with For All Entries in.</b>
SELECT kebeln kebelp kvbeln kvbelp
FROM ekkn AS k INNER JOIN ekbe AS b ON kebeln = bebeln
AND kebelp = bebelp
INTO TABLE gi_purchase
FOR ALL ENTRIES
IN gi_sales
WHERE k~mandt EQ sy-mandt
AND k~vbeln EQ gi_sales-vbeln
AND k~vbelp EQ gi_sales-posnr
AND b~budat EQ p_date.
If i am not doing inner join then I will have to do 2 select with for all entries in on ekkn and ekbe tables and then compare them.
<b>I want to know which one has better performance
Inner join with for all entries in
or
2 Selects with for all entries in</b><b></b>An Inner Join with for all entries should be done if you add this....
IF NOT gi_sales[] IS INITIAL.
SELECT k~ebeln k~ebelp k~vbeln k~vbelp
FROM ekkn AS k INNER JOIN ekbe AS b ON k~ebeln = b~ebeln
AND k~ebelp = b~ebelp
INTO TABLE gi_purchase
FOR ALL ENTRIES
IN gi_sales
WHERE k~mandt EQ sy-mandt
AND k~vbeln EQ gi_sales-vbeln
AND k~vbelp EQ gi_sales-posnr
AND b~budat EQ p_date.
ENDIF.
Also, while you use an index or the complete key for the SELECT, your not going to suffer from lack of performance -;)
Greetings,
Blag. -
Inner Join between two big tables
Hi There,
I have a situation where in which I have to write an inner join between two table of the order of (30k to 60 rows).
My query is as simple as,
select A.a,B.b from A ,B where A.a = B.b;
N.B: a and b are of type varchar
But the problem is it takes nearly 15 mins to run. Is there any better way of doing an inner join between such bigger tables?
Thanks,
Jose John.Thank you all for your help.....Indexing works....:)
--JJ -
Join multi access database tables
Anybody knows how to join multi Access database tables
by using LAbview SQL tool kit? It seems Labview SQL does not support "JOIN" feature.
ThanksBut I still dont know how to join multiple tables.
I've tried:
SELECT pd.NAME, pp.PART_ID, pp.MATERIAL, pt.NAME
FROM PRODUCT pd INNER JOIN LOOKUP_PRODUCTPART pp
ON pd.PRODUCT_ID=pp.PRODUCT_ID INNER JOIN PART pt
ON pp.PART_ID=pt.PART_ID
But it doesn't work.
Hm.. the following (joinig two tables) works. It's shows that INNER JOIN works in LabVIEW:
SELECT pd.NAME, pp.PART_ID, pp.MATERIAL, pt.NAME
FROM PRODUCT pd INNER JOIN LOOKUP_PRODUCTPART pp
ON pd.PRODUCT_ID=pp.PRODUCT_ID -
Coupling INNER JOIN with FOR ALL ENTRIES statement
Hi All,
I am coupling INNER JOIN with FOR ALL ENTRIES statement .....
Would you please highlight its implications ?? Is it a best practise ?
Is it advicable to use MULTIPLE INNER JOINs with a FOR ALL ENTRIES ???
SORT itab BY matnr.
IF NOT itab[] IS INITIAL.
SELECT epmatnr epebeln ep~ebelp
epwerks epmenge ep~netpr
ekps_psp_pnr ebbelnr eb~menge
INTO TABLE iekpo
FROM ekpo AS ep
INNER JOIN ekkn AS ek
ON ekebeln = epebeln
AND ekebelp = epebelp
INNER JOIN ekbe AS eb
ON ebebeln = epebeln
AND ebebelp = epebelp
AND eb~bwart = '101'
FOR ALL ENTRIES IN itab
WHERE ep~matnr = itab-matnr.
IF sy-subrc EQ 0.
SORT iekpo BY matnr werks.
LOOP AT itab ASSIGNING <itab>.
READ TABLE iekpo WITH KEY matnr = <itab>-matnr
werks = <itab>-werks
BINARY SEARCH.
IF sy-subrc EQ 0.
MOVE iekpo-matnr TO itab1-matnr.
MOVE iekpo-ebeln TO itab1-ebeln.
MOVE iekpo-ebelp TO itab1-ebelp.
MOVE iekpo-netpr TO itab1-poprice.
MOVE iekpo-werks TO itab1-werks.
MOVE iekpo-menge TO itab1-menge1.
MOVE iekpo-menge1 TO itab1-menge2.
MOVE iekpo-belnr TO itab1-belnr.
MOVE iekpo-ps_psp_pnr TO itab1-pspel.
MOVE <itab>-pspel TO itab1-tpspel.
MOVE <itab>-sobkz TO itab1-sobkz.
MOVE <itab>-fo_qty TO itab1-fo_qty.
MOVE <itab>-schgt TO itab1-schgt.
MOVE <itab>-postp TO itab1-postp.
MOVE <itab>-beskz TO itab1-beskz.
pend_qty = iekpo-menge1 - iekpo-menge2.
MOVE pend_qty TO itab1-pending.
APPEND itab1.
pend_qty = 0.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
Regards
Jaman
Edited by: ABAP Techie on Sep 15, 2008 12:39 PM
Edited by: ABAP Techie on Sep 15, 2008 12:41 PMbest practise ... don't know ... it is allowed and o.k.
If possible you should of coourse to have no FOR ALL ENTRIES at all !
Joins, there is no general rule, check indexes etc.
The first SORT, I don't that it help for anything, use it together with the delete adjacent duplicates if you expect duplicates in the driver table.
o.k., it can help, if there is a loop afterwards and an append inside, because the new table itab1 is then sorted.
Siegfried -
Temporary data carriers for Database tables
hi Gurus,
How can we find temporary Data Carriers for database tables. For eg. when we craete a BOM in CS01/CS02 the data first goes to RC29P structure and when system finishes it goes to STPO.
This is one example. how canw e find other structures and theirs corresponding Database Tables?
Any idea?
RegardsHi Greg,
Those are the aggregated tables. If they are not filled with data although the Portal Activity Report is activated, you should check whether the aggregation finished successfully.
In the older SPs there were some problems that were fixed in later SPs of 7.0.
In order to have the latest version of Portal Activity report, you can check SAP note 1084379 - Portal Activity Report - Latest Version (SDA file).
You can compare the SP via the MANIFAST file, as it contains the version and SP number.
In order to troubleshoot problems in Activity Report, you can follow SAP note: 1690023 - Portal Activity Report - Component-specific Note
Some basic checks that you can do:
Run query on the raw data tables to check since when there is data in those tables:
select min(timestamphour) from SAP<SystemID>DB.WCR_WEBCNODESTAT;
If there is too much data from long time ago, then you should delete the old data, and leave only the new data (there is anyways retention time for the data to be kept).
If there is no data, then it means that the Portal Activity Report does not collect data, and not really activated (usually this is not the case).
The aggregation runs every top of the hour, so you can check in the default traces for an error during that time.
In most of the cases something went wrong while aggregating the data.
As a result the aggregation is not finished, so the transaction is not being committed, and the aggregated tables stay empty.
If there is a DuplicateKeyException in the trace, you can follow SAP note 1054145 - Duplicate Key Exception.
If you have any more questions, please don't hesitate to ask.
I hope this information helps,
Thanks & regards,
Michal Zilcha-Lang -
Reg: Join Conditions for Tables to create a View for Generic Extraction
Hi Experts,
Am trying to extract the data from Solman, for this purpose am creating a Generic Extractor based on three tables. So, can anyone please help me out by providing the join conditions to create a view based upon the following three tables,
1. CRM_ORDERM_H
2. DNOD_NOTIF
3. DNOD_NOTIF_S
Anyways i require the following fields in the extractor finally:
CRM CHANGED AT
GUID
SAP COMPONENT
RELEASE
REPORTED BY
These are the some of the major fields that i require in the final extractior. Please help me out ASAP with the table join conditions..
Will Assign Points for the helpfull answer...
Thanks,
Gattu.Hi,
I don't know the table CRM_ORDERM_H however you can link DNOD_NOTIF and DNOD_NOTIF_S
DNOD_NOTIF_S-CLIENT = DNOD_NOTIF-CLIENT
DNOD_NOTIF_S-GUIDS = DNOD_NOTIF-GUIDS
For the third table could you please paste here its definition like the hereunder?
Transp. table DNOD_NOTIF Active
Short Text Notification Header
Field KeyInitData element Data TyLengthDecimaShort Text
CLIENT X X MANDT CLNT 3 0Client
GUIDH X X DNOT_GUIDH RAW 16 0GUID Notification
.INCLUDE DNOS_NOTIF_INT STRU 0 0Notifications (Header, Internal Fields)
OBJNR DNOT_OBJNR CHAR 22 0Status Management Object Number
STATUS DNOT_STATUS CHAR 1 0Notification Status
DELETED DNOT_DELE_N CHAR 1 0Deletion Indicator Notification
PROCESSOR DNOT_PROC CHAR 12 0Current Processor
TYPE_PROC DNOT_TYPE_PRC CHAR 2 0Type of Processor
REPORTER DNOT_REPORTER CHAR 12 0Reported By
TYPE_REPO DNOT_TYPE_REP CHAR 2 0Type of Notification Creator
CREA_TSTMP DNOT_CREA_TSTMP DEC 15 0Entry Time Stamp
CHNG_TSTMP DNOT_CHNG_TSTMP DEC 15 0Time of Last Change
START_TSTMP DNOT_START_TSTMPDEC 15 0Initial Response Time - Time Stamp
END_TSTMP DNOT_END_TSTMP DEC 15 0Requested End of Processing - Time Stamp
CLO_TSTMP DNOT_CLO_TSTMP DEC 15 0Completion Time Stamp
.INCLUDE DNOS_NOTIF_EXT STRU 0 0Notifications (Header, External Fields)
NUMB DNOT_NUM CHAR 12 0Notification Number (External)
REFNUM DNOT_REFNUM CHAR 20 0External Reference Number
TYPE_NOTIF DNOT_TYPE_N CHAR 6 0Message category
CATEGORY DNOT_CATEGORY CHAR 12 0Topic, Area
SUBJECT DNOT_SUBJECT CHAR 60 0Re:
PRIORITY DNOT_PRIORITY CHAR 1 0Notification priority
LANGUAGE DNOT_LANG_N LANG 1 0Notification Language
hope this helps...
Olivier. -
Join conditions for the given tables
Hi,
I would like to join the below tables
FA_INVOICE_DETAILS_V FID
,AP_INVOICE_PAYMENT_HISTORY_V AIP
,PO_DISTRIBUTIONS_all PD
,AP_BATCHES_ALL AB
,PO_HEADERS_ALL POH
,PO_LINES_ALL POL
,FA_ADDITIONS_V FAA
can anyone give me the conditions to join the above tables. Its an urgent please suggest me
Thanks in advanceOnly you can know how to join those tables. We don't know your business, your data, or your requirements.
If you would like us to help you, you need to provide the definitions of all the tables and which columns match between these tables. Then you have to tell us if you want inner joins, outer joins, theta joins, etc.
Please see the following link:
Urgency in online postings -
actuall i knew how to club the two database tables using innerjoin.
ther conditios is
select--fields----- into itab from (dtab) inner join (dtab)
on condition
where so and so---
the thing is that i need to add another table data(database table).what is the code and syntax.
please reply with example in detail.thanku.Hi,
Better to use FOR ALL ENTRIES, dont use inner join.
refer below code
*& Form sub_read_mara *
This form will Select the material number material type material *
group & batch management indicator from table mara using given *
material number *
FORM sub_read_mara .
*--Select query to pick the material number material group material type
and batch management from table MARA
SELECT matnr "Material Number
mtart "Material Type
matkl "Material Group
xchpf "Batch Management
FROM mara "Material Master
INTO TABLE i_mara
WHERE matnr IN s_matnr
AND mtart IN s_mtart
AND matkl IN s_matkl .
*--Check Subrc
IF sy-subrc <> 0.
*--No data found for the given selection criteria.
MESSAGE i001.
LEAVE TO LIST-PROCESSING.
ELSE.
*--Sort table by Material Number
SORT i_mara BY matnr.
ENDIF.
ENDFORM. "sub_read_mara
*& Form sub_read_marc *
This form will Select the material number plant purchasing group & *
MRP controller from table MARC using given material number plant & *
purchasing group. *
FORM sub_read_marc .
IF NOT i_mara[] IS INITIAL.
*--Select query to pick the material number plant purchasing group &
MRP controller from table MARC
SELECT matnr "Material Number
werks "Plant
ekgrp "Purchasing Group
dispo "MRP Controller
FROM marc "Material Master
INTO TABLE i_marc
FOR ALL ENTRIES IN i_mara
WHERE matnr = i_mara-matnr
AND werks IN s_werks
AND ekgrp IN s_ekgrp
AND dispo IN s_dispo.
*--Check Subrc
IF sy-subrc <> 0.
MESSAGE i001.
LEAVE TO LIST-PROCESSING.
ELSE.
*--Sort table by Material Number Plant
SORT i_marc BY matnr werks.
ENDIF.
ENDIF.
ENDFORM. "sub_read_marc
Regards,
Prashant -
Inner Joins vs For All Entries - performance query
Hi All,
I'm a bit confused here... I see lots and lots (and lots...) of postings from people asking how to get data from multiple tables.
To me the immediate answer is to use joins in my select statement to reduce the database load but more and more I see people suggesting FOR ALL ENTRIES is better from a performance perspective.
Now, simple question time, which is more efficient in the real world when doing something like the following:- (this is a basic example but I'm sure you know what I mean.)
Select *
into table lt_sales_data
from vbap as vbap
inner join vbak as vbak
on vbak~vbeln eq vbap~vbeln
where vbak~vbeln in so_vbeln.
or
Select *
into table lt_vbak_data
from vbak
where vbeln in so_vbeln.
if lt_vbak_data[] is not initial.
select *
into table lt_vbap_data
from vbap
for all entries in lt_vbak_data
where vbeln eq lt_vbak_data-vbeln.
endif.
Basically I want to know whether joins or for all entries is better from a database performance perspective.
I want to know why as well so please don't just post links, random cut and paste answers or one liners. I'm convinced for all entries is slower but am willing to be persuaded otherwise if someone can show me proof.
Thanks,
Gareth.Thanks to all the opinions so far... You've backed up what I suspected although I maybe wasn't clear enough with my question and desired result. I was hoping someone could produce some hard and fast guidelines from SAP themselves dictating which is the better method. I know 10 years ago I was taught to use joins and to keep my database access to minimal levels, using keyed reads where applicable and using internal tables to filter data where I couldn't use key fields.
Gautham, I am aware of SM30 but that doesn't answer the general question I was asking. I've obviously used SM30 to run some comparisons but I was really hoping someone could give me a definitive answer based on hard facts or from attending some training at SAP recently. And no points for asking for them
Tamás, I agree with what you are saying about runing many comparisons - it appears to be dependant on any number of criteria which means each case may require different code. I've not managed to find a consistent comparison of the two methods that would lead me to use one method or the other...
Karan, thanks for your feelings but it doesn't really help me! Why/how does it retrieve the data faster than a join? Have you got testing/proof to back this up?
Raam, thanks for those links - they are interesting reads and seem to go through the same arguments I'm currently considering. Although I still don't have a definitie answer!
Amit, I understand exactly what yuo are saying about myths and urban legends That was my motivation for this post. To bo honest, it seems to me that a lot of the "newer" ABAP coders always go for FOR ALL ENTRIES but I wanted to know - is there a reason or do they all just cut and paste off SDN?! Are they all just scared of complex inner joins?! What would you all make of this Select statement for example? -
select afvc~arbid
afko~aufnr
aufk~objnr
afko~plnnr
afko~plnal
afko~aufpl
afko~zaehl
afpo~matnr
makt~maktx
afvc~vornr
afvc~ltxa1
afvu~aplzl
afvu~usr10
afvv~meinh
afvv~bmsch
afvv~vge02
afvv~vgw02
afvv~mgvrg
afab~aplzl_vor
into table lt_recipe_orders
from afko as afko
inner join aufk as aufk
on aufk~aufnr eq afko~aufnr
inner join afpo as afpo
on afpo~aufnr eq afko~aufnr
inner join makt as makt
on makt~matnr eq afpo~matnr
inner join afvc as afvc
on afvc~aufpl eq afko~aufpl
inner join afvu as afvu
on afvu~aufpl eq afvc~aufpl
and afvu~aplzl eq afvc~aplzl
inner join afvv as afvv
on afvv~aufpl eq afvu~aufpl
and afvv~aplzl eq afvu~aplzl
left outer join afab as afab
on afab~aufpl_nch eq afvu~aufpl
and afab~aplzl_nch eq afvu~aplzl
for all entries in t_resources
where afko~gltrs ge v_start_date
and afko~gstrs le v_start_date
and afko~plnty eq gc_task_list_type_2
and afpo~dwerk eq v_werks
and makt~spras eq sy-langu
and afvc~arbid eq t_resources-objid.
Twinkal, I've always thought less DB hits is a better performing program too - the above example compares 2 db hits to 1... I don't have issues with complex joins because I've used them so long so can discount that problem but do agree that less DB hits is the ultimate goal. Providing of course the Selects you write are actually efficient in themselves.
Murthy, if you build your select statement correctly duplicate records can be avoided in most cases. How can you say a join statement will hit the database more when in my example there is 1 DB hit compared to 2 for a for all entries? And I'd love to know the reasoning behind never using a join on more than 2 tables?! Is that just an urban myth?!
Thomas, I've just been looking at some of Siegfried's posts and like what I am reading. As you say, using full keys via joins is essential.
Gareth.
Maybe you are looking for
-
Hello Experts, My BW system is connected to a SRM system. In a confirmation details report, the Confirmation Number is not appearing for the Purchase Order Number. I have checked in the back-end and the Confirmation exists for the particular PO, in t
-
i have synced a family members iphone to my accont on itunes! how do i take it off mine and sync it to his account?
-
How to get JDK installation path
Hi, I would like to get JDK installation path in linux, is there any way to get the same. For example I have installed JDK in "/usr/java/j2sdk1.4.1" I need this path.. It would be great if any one help me solve this. Thanks in advance. Regards, Venka
-
Unable to view my full wish list after update
I can not figure out how to view my full wish list now after the update. I will scroll all the way over to the right of this wish list, and it just stops, and there is no "View all" link like there used to be. So even after scrolling over as far as I
-
My daughters ipod touch is locked and she does not know the password. The laptop that it was originally connected to no longer works. I have an iphone connected to my computer and was thinking I could hook hers up to mine and some how restore hers?