Joins query between itab and database table..
Hi all,
Is it posible to use joins query between internle table and data base table...
Hi Mehboob,
No thats impossible to join the internal table and the database table.
Alternatively what you need to do is you need to execute a Queryin Database Table and use the For All Entries in itab.
Eg: Select * from marc into table it_marc
for all entries in it_matnr
where matnr = it_matnr-matnr.
Thanks,
Chidanand
Similar Messages
-
Inner join query used with 7 Database tables
HI All,
In a report they used the Inner join Query with 6 Data base table..now there is a performance issue with at query.
its taking so much of time to trigger that query. Please help how to avoid that performance issue for that.
In that 2 database tables containing lakhs of records..
According to my knowledge it can be avoided by using secondary indexs for those 2 database tables..
and by replacing the Inner join Query with FOR ALL ENTRIES statement.
i want how to use the logic by using FORALL ENTRIES statement for this..
So, please give you proper suggestion to avoid this issue..
Thanking you.
Moderator message: Please Read before Posting in the Performance and Tuning Forum
Edited by: Thomas Zloch on Oct 16, 2011 10:27 PMHi,
And what do you mean with "they used"? If "SAP used" then yo will need to ask a SAP for note
FOR ALL ENTRIES is quite good described in help. Please search forum also.
Without query it won't be possible to tell how it can be optimized, however you can try to use SE30/SAT and ST05. Maybe it will help you.
BR
Marcin Cholewczuk -
Optimization of Join statement between MKPF and MSEG table for improving pe
Hi All,
I had a issue where we are executing one custom report and it is getting timed out after 45 minutes. We further executed with trace on and got to the conclusion with the help of BASIS that about 42 minutes of the 45 minutes tracetime are spent by a join over the tables MKPF en MSEG.
This join is done by the abap statement:
SELECT mkpf~mblnr
mkpf~mjahr
mkpf~bldat
mkpf~blart
mseg~matnr
mseg~werks
INTO CORRESPONDING FIELDS OF TABLE i_matdoc_we
FROM mkpf INNER JOIN mseg ON mkpfmblnr = msegmblnr
AND mkpfmjahr = msegmjahr
FOR ALL entries IN i_list
WHERE mkpf~mblnr BETWEEN lv_interval-fromnumber
AND lv_interval-tonumber
AND mkpf~blart = 'WE'
AND mkpf~bldat LE gv_last_day_fisc_period
AND mseg~matnr = i_list-matnr
AND mseg~werks IN s_werks.
Here, I_LIST comprises of stock for specific period as entered in the selection screen for that particular Material and plant
LV_INTERVAL is range of all goods receipts for material and gv_last_day_fisc_period is current date.
During the tracetime this statement was executed more than 20.000 times, until the transaction timed out.
The individual executions of this select stmnt varied (roughly) between 50 and 1200 miliseconds. (depends wheter the requested database block is in the buffercache or must be read from disk).
The acesspath used to execute the query ( see below) is optimal, given the present indexes.
Index MSEG~M is covering al the specified selection criteria for MSEG.
Index MKPF-0 is used to search the specified MBLNR criterium in MKPF.
The remaining selection criteria MKPF-BLART and MKPF-BLDAT are not indexed, and imho this would also not make sense for this query.
BLART has only 3 different values n the MKPF table, and the selected value 'WE' has more than 1 million occurences.
BLDAT is selected with =<20110903, so this is not distinctive as well.
Can any one suggest some better way to write this query.
Regards,
SubhajitActually there are 2 select statements where JOIN have been introduced and especially the time out is occurring in the second JOIN.
Find all goods receipts for material
PERFORM get_number_range_matdoc USING '03'
CHANGING lv_interval.
SELECT mkpf~mblnr
mkpf~mjahr
mkpf~bldat
mkpf~blart
mseg~matnr
mseg~werks
INTO CORRESPONDING FIELDS OF TABLE i_matdoc_we
FROM mkpf INNER JOIN mseg ON mkpfmblnr = msegmblnr
AND mkpfmjahr = msegmjahr
FOR ALL entries IN i_list
WHERE mkpf~mblnr BETWEEN lv_interval-fromnumber
AND lv_interval-tonumber
AND mkpf~blart = 'WE'
AND mkpf~bldat LE gv_last_day_fisc_period
AND mseg~matnr = i_list-matnr
AND mseg~werks IN s_werks.
CLEAR lv_interval.
PERFORM get_number_range_matdoc USING '02'
CHANGING lv_interval.
Find all goods issues for material
SELECT mkpf~mblnr
mkpf~mjahr
mkpf~bldat
mkpf~blart
mseg~matnr
mseg~werks
INTO CORRESPONDING FIELDS OF TABLE i_matdoc_wa
FROM mkpf INNER JOIN mseg ON mkpfmblnr = msegmblnr
AND mkpfmjahr = msegmjahr
FOR ALL entries IN i_list
WHERE mkpf~mblnr BETWEEN lv_interval-fromnumber
AND lv_interval-tonumber
AND ( mkpfblart = 'WA' OR mkpfblart = 'WI' )
AND mkpf~bldat LE gv_last_day_fisc_period
AND mseg~matnr = i_list-matnr
AND mseg~bwart NE '561'
AND mseg~bwart NE '562'
AND mseg~bwart NE '961'
AND mseg~bwart NE '962'
AND mseg~werks IN s_werks.
Mainly the second JOIN is creating the problem... In the backend ORACLE is being used as database.
Please suggest how I can improve the performance of these joins as its taking more than 45 mins.. -
Difference between Infotype and Database table
Hi all,
in SAP ABAP-HR we have the concept of INFOTYPE. will anybpdy please tell me , in simple word, what exactly is it? and what are the difference of INFOTYPE with DATABASE TABLE.
Anirban Bhattacharjeehi,
infotypes contains group of logically related fields on a single screen (just like TABLE) and which is bounded by TIME CONSTRIANT (no time constrint for table).
main diffarence is TIME CONSTRAINT, means validity period of data records in infotypes based on time constrint only.
for more information on time constrint follow this link.........
http://help.sap.com/saphelp_erp2005/helpdata/en/48/35c9f24abf11d18a0f0000e816ae6e/content.htm
each infotype contains, its corresponding database table.
ex: 0002---> personal information.
its database table: pa0002.
the table pa0002 contains four strctures pakey, pshd1, ps0002 and ci_p0002.
pakey-->contains key fields information.
psdh1--->contains last logon detils (usename....)
ps0002--->contains infotype specific fields.
ci_p0002--> for furthur addinf an any extra fields
Edited by: Ashok Reddy on Jun 25, 2008 2:12 PM -
What is the joining condition between hz_cust_site_uses_all and pa_agreements_all table? How hz_cust_site_uses_all and pa_agreements_all table can be joined?
Hi,
What happens if you simply use a DISTINCT clause, something like:
SELECT DISTINCT pa.customer_id ,hcs.cust_acct_site_id
FROM hz_cust_acct_sites_all hca,
hz_cust_site_uses_all hcs,pa_agreements_all pa
WHERE hcs.cust_acct_site_id = hca.cust_acct_site_id
AND hca.cust_account_id = pa.customer_id
Thanks &
Best Regards, -
Join condition between PO_REQUISITION_HEADERS_ALL and WF_NOTIFICATIONS
Hi,
Could anyone tell me what is the join condition between PO_REQUISITION_HEADERS_ALL and WF_NOTIFICATIONS?
I joined these two tables by WF_NOTIFICATIONS.ITEM_KEY = PO_REQUISITION_HEADERS_ALL .WF_ITEM_KEY.But I cannot found some approved requisitions item key in WF_NOTIFICATIONS table.
Please help.
I paste my query below:
SELECT PRH.ORG_ID ORG_ID,
WF.ITEM_KEY,
WF.FROM_ROLE,
PRH.WF_ITEM_KEY,
WF.RECIPIENT_ROLE APPROVERS_NAME,
TRUNC(NVL(PRH.APPROVED_DATE, '')) DATE_APPROVED,
WF.SUBJECT SUBJECT,
PRH.DESCRIPTION REQ_DESC,
PRH.SEGMENT1,
(SUM(NVL(PRL.AMOUNT, 0)) +
SUM(NVL(PRL.UNIT_PRICE, 0) * NVL(PRL.QUANTITY, 0))) REQ_AMT,
GL.SEGMENT1 || '.' || GL.SEGMENT2 || '.' || GL.SEGMENT3 || '.' ||
GL.SEGMENT4 || '.' || GL.SEGMENT5 || '.' || GL.SEGMENT6 || '.' ||
GL.SEGMENT7 || '.' || GL.SEGMENT8 CHARGE_ACCT
FROM APPS.WF_NOTIFICATIONS WF,
APPS.PO_REQUISITION_HEADERS_ALL PRH,
APPS.PO_REQUISITION_LINES_ALL PRL,
APPS.PO_REQ_DISTRIBUTIONS_ALL PRD,
APPS.GL_CODE_COMBINATIONS GL
WHERE WF.FROM_ROLE IN ('GHAWKINS', 'GHALVERSON', 'NCERNOTTA', 'DCOLLOPY', 'RHAY')
AND BEGIN_DATE > SYSDATE - 60
AND WF.MESSAGE_TYPE = 'REQAPPRV'
AND WF.ITEM_KEY = PRH.WF_ITEM_KEY --added
AND PRH.AUTHORIZATION_STATUS = 'APPROVED'
AND PRL.REQUISITION_HEADER_ID = PRH.REQUISITION_HEADER_ID
AND PRD.REQUISITION_LINE_ID = PRL.REQUISITION_LINE_ID
AND PRD.CODE_COMBINATION_ID = GL.CODE_COMBINATION_ID
GROUP BY PRH.ORG_ID,
WF.ITEM_KEY,
WF.FROM_ROLE,
PRH.WF_ITEM_KEY,
WF.BEGIN_DATE,
WF.SUBJECT,
WF.RECIPIENT_ROLE,
PRH.APPROVED_DATE,
PRH.DESCRIPTION,
PRH.SEGMENT1,
PRL.REQUISITION_HEADER_ID,
GL.SEGMENT1 || '.' || GL.SEGMENT2 || '.' || GL.SEGMENT3 || '.' ||
GL.SEGMENT4 || '.' || GL.SEGMENT5 || '.' || GL.SEGMENT6 || '.' ||
GL.SEGMENT7 || '.' || GL.SEGMENT8Pl see if these MOS Docs can help -
603232.1 - How to Diagnose Purchasing Document Approval Routing
579522.1 - Forward Document Form FAQ
431767.1 - How To View Requisition From The Email Notifications For Which Workflow Data Is Purged
HTH
Srini -
Hi,
What is the Join condition between mtl_system_items_b and mtl_onhand_quantities_detail?
Thanks & Regards,
Hari BabuPlease see the query in (Consolidate Onhand Quantity /Sum Quantity Zero in MTL_ONHAND_QUANTITIES_DETAIL (MOQD) / Concurrent Program Consolidate Inventory Onhand Quantities / Datafix for 0 Quantity Displayed For Finished Goods (Doc ID 353345.1)), is shows how to join those 2 tables.
http://etrm.oracle.com
Thanks,
Hussein -
How can I set the data binding between Web Dynpro & Database table
Dear friend,
I am a beginner of Web Dynpro. I want to develop my simple project like these:
1. Create my own database table via Dictionary Project such as TAB_USER and have 3 fields: USER_ID, USER_NAME, USER_POSITION and I have already deployed & archived it.
2. Create my own Web Dynpro Project, and create the input fields as User ID, User name, User position and icon 'Save' on the selection screen and I have deployed it already.
For the process, I want to input data at the screen and save the data in the table, please give me the guide line like these:
1. How can I set the data binding between Web Dynpro and Database table ?
2. Are there any nescessary steps that I will concern for this case?
Sorry if my question is simple, I had try to find solution myself, but it not found
Thanks in advances,
SeMsHi,
You can write your own connection class for establishing the connection with DB.
Ex:
public class ConnectionClass {
static Connection con = null;
public static Connection getConnection() {
try{
Context ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("jdbc/TSPAGE");
con = ds.getConnection();
return con;
}catch(Exception e){
return null;
You can place the above class file in src folder and you can use this class in webdynpro.
You can have another UserInfo class for reading and writing the data into the DB .
Regards, Anilkumar
PS : Refer
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/java/simple java bean generator for database.pdf
Message was edited by: Anilkumar Vippagunta -
Search static pages AND database tables
Hi,
I'm working on a project in which I have static content
pages, plus I'm creating a set of dynamic pages that display jobs
and events listings etc. The dynamic pages are going to run off an
access database.
I'm need to create a search facility on the site. At present
I'm planning to use a drop down box (or radio buttons ?) to allow
the user to select which part of the site to search (main site,
jobs or events), the selection will determine which search page the
form query is passed to (site text search or database query search
page).
Am I approaching this correctly.
Can anyone comment on possibly a better or alternative way of
providing such a search option ? (searching both static pages and
database tables)
Thanks in advance.I guess something like <cffile action="read"
file="C:\docs\shopping.html" variable="shoppingList">. Is there
a way to do multiple files at once? -
Link between vbpa and vbak tables
Hi,
I would like to know the link between VBAK and VBPA tables.
VBELN field in both these fields are the same?
If I give the VBELN field got from the VBAK table into the VBPA table will I get the customer number(KUNNR) of that particular SAles document?
Thanks & Regards,
Soumya.You can get Kunnr directly from the VBAK table, if you wanna do the Join still you can go forward and do it there is no harm but remeber to give the Partner Function(PARVW) as well as VBELN.
Hope That Helps
Anirban M. -
Urgent - I have written select query between loop and endloop, Ple help out
Can any one help out me on this select query. I have written select query between loop and endloop. When I execute the program it will take too much time in this query. Please help me out. Its very urgent.
LOOP AT l_i_invoices ASSIGNING <l_invoices>.
CLEAR alv_wa.
alv_wa-bukrs = <l_invoices>-bukrs.
alv_wa-gsber = <l_invoices>-gsber.
CLEAR l_instid.
CONCATENATE <l_invoices>-belnr <l_invoices>-gjahr INTO l_instid.
SELECT top_wi_id FROM sww_wi2obj INTO TABLE l_i_swwwihead
WHERE catid = c_catid_business_object
AND instid = l_instid
AND typeid = c_typeid_invoice
AND removed = space
AND ( wi_rh_task = c_task_buyer_message
OR wi_rh_task = c_task_buyer_message2 ).
IF sy-subrc = 0.
<l_invoices>-flag = 'X'.
ELSE.
<l_invoices>-flag = ' '.
ENDIF.
MODIFY l_i_invoices FROM <l_invoices> TRANSPORTING flag
WHERE belnr = <l_invoices>-belnr
AND gjahr = <l_invoices>-gjahr.
APPEND alv_wa TO i_alv.
ENDLOOP.
Thanks in advance.Here is a way to solve this problem.
Choose somewhere before this loop processing to use that select. Therefore, you'll need use FOR ALL ENTRIES <that_loop_table> clause, and in the WHERE condition you need to specify that same fields.
This way, you will have an internal table with all data you'll need to check.
Then, inside your loop statement, use the READ TABLE command with the clause WITH KEY field = value, to read that record and use the value found.
Like this sample:
SELECT bukrs lifnr umsks umskz augdt augbl zuonr gjahr belnr buzei
waers xblnr blart gsber ebeln zfbdt zbd1t zlsch
INTO TABLE tg_bsak
FROM bsak
FOR ALL ENTRIES IN tl_bkpf_sel
WHERE bukrs EQ tl_bkpf_sel-bukrs AND
lifnr IN s_lifnr AND
augbl EQ tl_bkpf_sel-belnr.
LOOP AT tg_bseg INTO wa_bseg.
READ TABLE tg_bsak INTO wa_bsak WITH KEY bukrs = wa_bseg-bukrs
gjahr = wa_bseg-gjahr
belnr = wa_bseg-belnr
BINARY SEARCH.
if sy-subrc = 0.
* do something
endif.
ENDLOOP. -
Relation between Eban and Erev tables
Hi,
What is the Relation between Eban and Erev tables?
Thanks and Regards,
Parvatha ReddyHi,
if you have activated version management for purchase requisitions (spro - mm - purchasing - version mgmt - set up ver mgmt for PR), then if any changes are made to the fields as specified in the customizing, then an entry is made in EREV table. EBAN is the pur. reqn table.
Hope it answers your query.
Regards,
Vivek -
Difference between all_tab_cols and col tables....
Dear All,
Can anyone explain me the difference between between all_tab_cols and col tables......?
Regards
krishnaHi ,
Difference between few columns views
DBA_TAB_COLUMNS has metadata for All columns of all Tables,Views and Clusters in the database.
DBA_TAB_COLUMNS view differs from DBA_TAB_COLS in that hidden columns are filtered out.
ALL_TAB_COLUMNS has metadata for Columns of user's tables, views and clusters .
ALL_TAB_COLS will have hidden columns also , similar to DBA_TAB_COLUMNS
You can also check if this web can help
http://jeffkemponoracle.blogspot.com/2007/07/do-you-know-difference-between.html
Regards
Naveed -
Linking between PP and SD tables
Hai friends,
I want one link between PP and SD tables. My requirement is i have planned order PLAF table. i want to link Sales table. Please guide me.
Thanks and Regards
visvanathHi
You can simply link the Sales order No and ITEM
VBAP-VBELN and VBAP-POSNR with the PP order item table
AFPO-KDAUF and AFPO-KDPOS and get the Pp related info
or in Sales tables there is a field called AUFNR in VBAP
use that for PP order number
SD tables
http://www.erpgenie.com/abap/tables_sd.htm
PP tables
http://www.erpgenie.com/abap/tables_pp.htm
Regards
Kiran Sure -
Can we write a join on a view and a table
Hi all,
can we write a join on a view and a table. i got the requirement from my functional people about the following one
Select CAUFV-AFUNR, CAUFV-AUART, AFVC-VORNR, CAUFV-FTRMI, CRHD-ARBPL
into <ProOrd>, <OrdTyp>, <Opt>, <RelDat>, <WorCen>
from CAUFV, AFVC, CRHD
where CAUFV-WERKS = plant in selection screen
and CAUFV-AFUNR = production order in selection screen
and CAUFV-AUART = production order type in selection screen
and CAUFV-FTRMI = range of release date in selection screen
and CAUFV-AUFPL = AFVC-AUFPL
and AFVC-ARBID = CRHD-OBJID
and CRHD-OBJTY = A
here CAUFV is a view and CRHD and AFVC are transperent tables.
please tell me any feasible solution for this..
Thanks in Advance..Hi
Refer these links:
<u>http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ec84446011d189700000e8322d00/content.htm</u>
<u>http://www.sap-img.com/abap/what-is-the-different-types-and-usage-of-views.htm</u>
<u>http://www.karakas-online.de/forum/viewtopic.php?t=730</u>
Thanks
Vasudha
Message was edited by:
Vasudha L
Maybe you are looking for
-
How do I remove a space between tables?
In dreamweaver there appears to be no space and the page looks fine, however when I go into internet explorer there is a gap between the tables. I want my image to be at the bottom of my table, resting on the footer. I have tried for hours to resolv
-
I have been scouring the Adobe website and even contacted customer service for a list of all the changes made from Livecycle Designer ES2 to ES3 and then ES3 to ES4 with no luck. It seems like something basic that would be available. I am currently
-
Photo Sync Tab dissapeared on itunes 9
I'm trying to sync iphone with new itunes but the photos tab is not there. Do you have it ?
-
FOREACH scenario : usage of Receiver or Interface variable
Hi fellow ccBPMers I have scenario with flat files that must be read and split up into individual files. First file is a Header Flat File containing 4 Header records A xxxxxxxxxxxx B xxxxxxxxxxxx C xxxxxxxxxxxx D xxxxxxxxxxxx Second file is a Detail
-
I want to develop a proxy in windows phone 8 that will handle all data traffic emanating from phone(i.e. browser and Apps). The following procedures were carried out a) Edited the Wifi settings http proxy and port to the loop back proxy running in th