Performance issue in BI due to direct query on BKPF and BSEG tables
Hi,
We had a requirement that FI document number fieldshould be extracted in BI.
Following code was written which has the correct logic but performance is bad.
It fetched just 100 records in more than 4-5 hrs.
The reason is there was a direct qury written on BSEG and BKPF tables(without WHERE clause).
Is there any way to improve this code like adding GJAHR field in where clause? I dont want to change the logic.
Following is the code:
WHEN '0CO_OM_CCA_9'." Data Source
TYPES:BEGIN OF ty_bkpf,
belnr TYPE bkpf-belnr,
xblnr TYPE bkpf-xblnr,
bktxt TYPE bkpf-bktxt,
awkey TYPE bkpf-awkey,
bukrs TYPE bkpf-bukrs,
gjahr TYPE bkpf-gjahr,
AWTYP TYPE bkpf-AWTYP,
END OF ty_bkpf.
TYPES : BEGIN OF ty_bseg1,
lifnr TYPE bseg-lifnr,
belnr TYPE bseg-belnr,
bukrs TYPE bseg-bukrs,
gjahr TYPE bseg-gjahr,
END OF ty_bseg1.
DATA: it_bkpf TYPE STANDARD TABLE OF ty_bkpf,
wa_bkpf TYPE ty_bkpf,
it_bseg1 TYPE STANDARD TABLE OF ty_bseg1,
wa_bseg1 TYPE ty_bseg1,
l_s_icctrcsta1 TYPE icctrcsta1.
"Extract structure for Datasoure 0co_om_cca_9.
DATA: l_awkey TYPE bkpf-awkey.
DATA: l_gjahr1 TYPE gjahr.
DATA: len TYPE i,
l_cnt TYPE i.
l_cnt = 10.
tables : covp.
data : ref_no(20).
SELECT lifnr
belnr
bukrs
gjahr
FROM bseg
INTO TABLE it_bseg1.
DELETE ADJACENT DUPLICATES FROM it_bseg1 COMPARING belnr gjahr .
SELECT belnr
xblnr
bktxt
awkey
bukrs
gjahr
AWTYP
FROM bkpf
INTO TABLE it_bkpf.
IF sy-subrc EQ 0.
CLEAR: l_s_icctrcsta1,
wa_bkpf,
l_awkey,
wa_bseg1.
LOOP AT c_t_data INTO l_s_icctrcsta1.
MOVE l_s_icctrcsta1-fiscper(4) TO l_gjahr1.
select single AWORG AWTYP INTO CORRESPONDING FIELDS OF COVP FROM COVP
WHERE belnr = l_s_icctrcsta1-belnr.
if sy-subrc = 0.
if COVP-AWORG is initial.
concatenate l_s_icctrcsta1-refbn '%' into ref_no.
READ TABLE it_bkpf INTO wa_bkpf WITH KEY awkey(10) =
l_s_icctrcsta1-refbn
awtyp = COVP-AWTYP
gjahr = l_gjahr1.
IF sy-subrc EQ 0.
MOVE wa_bkpf-belnr TO l_s_icctrcsta1-zzbelnr.
MOVE wa_bkpf-xblnr TO l_s_icctrcsta1-zzxblnr.
MOVE wa_bkpf-bktxt TO l_s_icctrcsta1-zzbktxt.
MODIFY c_t_data FROM l_s_icctrcsta1.
READ TABLE it_bseg1 INTO wa_bseg1
WITH KEY
belnr = wa_bkpf-belnr
bukrs = wa_bkpf-bukrs
gjahr = wa_bkpf-gjahr.
IF sy-subrc EQ 0.
MOVE wa_bseg1-lifnr TO l_s_icctrcsta1-lifnr.
MODIFY c_t_data FROM l_s_icctrcsta1.
CLEAR: l_s_icctrcsta1,
wa_bseg1,
l_gjahr1.
ENDIF.
ENDIF.
ELSE. " IF AWORG IS NOT BLANK -
concatenate l_s_icctrcsta1-refbn COVP-AWORG into ref_no.
READ TABLE it_bkpf INTO wa_bkpf WITH KEY awkey(20) =
ref_no
awtyp = COVP-AWTYP
gjahr = l_gjahr1.
IF sy-subrc EQ 0.
MOVE wa_bkpf-belnr TO l_s_icctrcsta1-zzbelnr.
MOVE wa_bkpf-xblnr TO l_s_icctrcsta1-zzxblnr.
MOVE wa_bkpf-bktxt TO l_s_icctrcsta1-zzbktxt.
MODIFY c_t_data FROM l_s_icctrcsta1.
READ TABLE it_bseg1 INTO wa_bseg1
WITH KEY
belnr = wa_bkpf-belnr
bukrs = wa_bkpf-bukrs
gjahr = wa_bkpf-gjahr.
IF sy-subrc EQ 0.
MOVE wa_bseg1-lifnr TO l_s_icctrcsta1-lifnr.
MODIFY c_t_data FROM l_s_icctrcsta1.
CLEAR: l_s_icctrcsta1,
wa_bseg1,
l_gjahr1.
ENDIF.
ENDIF.
endif.
endif.
CLEAR: l_s_icctrcsta1.
CLEAR: COVP, REF_NO.
ENDLOOP.
ENDIF.
Hello Amruta,
I was just looking at your coding:
LOOP AT c_t_data INTO l_s_icctrcsta1.
MOVE l_s_icctrcsta1-fiscper(4) TO l_gjahr1.
select single AWORG AWTYP INTO CORRESPONDING FIELDS OF COVP FROM COVP
WHERE belnr = l_s_icctrcsta1-belnr.
if sy-subrc = 0.
if COVP-AWORG is initial.
concatenate l_s_icctrcsta1-refbn '%' into ref_no.
READ TABLE it_bkpf INTO wa_bkpf WITH KEY awkey(10) =
l_s_icctrcsta1-refbn
awtyp = COVP-AWTYP
gjahr = l_gjahr1.
Here you are interested in those BKPF records that are related to the contents of c_t_data internal table.
I guess that this table does not contain millions of entries. Am I right?
If yes, the the first step would be to pre-select COVP entries:
select BELNR AWORG AWTYP into lt_covp from COVP
for all entries in c_t_data
where belnr = c_t_data-belnr.
sort lt_covp by belnr.
Once having this data ready, you build an internal table for BKPF selection:
LOOP AT c_t_data INTO l_s_icctrcsta1.
clear ls_bkpf_sel.
ls_bkpf_sel-awkey(10) = l_s_icctrcsta1-refbn.
read table lt_covp with key belnr = l_s_icctrcsta1-belnr binary search.
if sy-subrc = 0.
ls_bkpf_sel-awtyp = lt_covp-awtyp.
endif.
ls_bkpf_sel-gjahr = l_s_icctrcsta1-fiscper(4).
insert ls_bkpf_sel into table lt_bkpf_sel.
ENDLOOP.
Now you have all necessary info to read BKPF:
SELECT
belnr
xblnr
bktxt
awkey
bukrs
gjahr
AWTYP
FROM bkpf
INTO TABLE it_bkpf
for all entries in lt_bkpf_sel
WHERE
awkey = lt_bkpf_sel-awkey and
awtyp = lt_bkpf_sel-awtype and
gjahr = lt_bkpf_sel-gjahr.
Then you can access BSEG with the bukrs, belnr and gjahr from the selected BKPF entries. This will be fast.
Moreover I would even try to make a join on DB level. But first try this solution.
Regards,
Yuri
Similar Messages
-
Query with tables of BKPF and BSEG and Structures COBL, RF05A
hi experts,
I want to create query with the tables of BKPF and BSEG and Structures COBL, RF05A
How can i proceed?
Please give me complete points
Edited by: Alvaro Tejada Galindo on Feb 14, 2008 2:52 PMcheck the common fields and required fields and the write SELECT query useing Inner Joins or For all entries
<REMOVED BY MODERATOR>
Edited by: Alvaro Tejada Galindo on Feb 14, 2008 2:52 PM -
SAP QUERY using ASSHR and ASSOB tables
We currently have SAP query that reports on additional payments (Info type 0015). The user wants to report the cost center held on the cost assignment (Tables ASSOB and ASSHR).
The existing query uses infoset created using PNP logical database.
How do I add or join the ASSOB and ASSHR tables to Info type 0015 to report the cost center?
Thanks in advance
ShamshudinHi Sham
You may need to create custom fields in the infoset and create some code to pull out and display details from ASSHR and ASSOB corresponding to the ifnotype record. -
Performance issue: looping over queries with a query results set
I have code that works, but I think I should be able to run the code faster. I could try a stored procedure but there are so many variables to set. I tried with wrapping cftransation around the code, but it didn't make a noticeable difference. I need to go through the data singularly to fill my query object.
Here's an ABBREVIATED sample of the code:
<cfset tot_AllActiveListing = QueryNew(
"AnnounceNum, JP_PDLoc, JP_JS_Title, JP_JS_KWID, JP_JS, JP_Open, JP_Close, JP_CloseType, JP_CloseName, JP_PosNeed, JP_DirectHire, JP_Desc, JP_Draft, JP_Archived, JP_State, JP_AreaID, JP_AreaName, JP_AreaAlias, JP_Fac_SU, JP_Fac_Facility, JP_FAC_ID, JP_Grade1, JP_Grade2, JP_Grade3, JP_Grade4, JP_Grade5, JP_Posted, JP_TypeHire, JP_HRemail",
"VARCHAR,VARCHAR,VARCHAR,INTEGER,INTEGER,TIMESTAMP,TIMESTAMP,INTEGER,VARCHAR,INTEGER,BIT,V ARCHAR,BIT,BIT,VARCHAR,INTEGER,VARCHAR,VARCHAR,VARCHAR,VARCHAR,INTEGER,VARCHAR,VARCHAR,VAR CHAR,VARCHAR,VARCHAR,TIMESTAMP,INTEGER,VARCHAR")
/>
<cfquery name="getAllActiveListing" datasource="#request.at_datasource#">
SELECT j.JOB_AnnounceNum, j.JOB_PDLoc, j.fk_JS_code, j.Job_JPOpen, j.Job_JPClose, j.fk_CloseType, j.JOB_JPPosNeed, j.JOB_DirectHire, j.JOB_JPDesc, j.Job_JPDraft, j.JOB_JPArchived, j.JOB_State,
j.fk_FACID, j.Posted, j.JOB_IHSvITU, f.Fac_Area, f.Fac_ServiceUnit, f.fac_Facility, f.Fac_Addr1, f.Fac_Addr2, f.Fac_City, f.Fac_State, f.Fac_Zip
from JOB_JP j INNER JOIN #generaldb#IHSFacility f
ON j.fk_FACID = f.Fac_ID
WHERE
JOB_JPDraft = 0
and (Job_JPClose = #Now()# or Job_JPClose > #Now()# or fk_CloseType = 2 or fk_CloseType = 3)
and (JOB_JPArchived = 0 or JOB_JPArchived IS NULL)
<cfif IsDefined("qAltPostID") and qAltPostID.recordcount gt "0">
and JOB_AnnounceNum IN (<cfqueryparam list="yes" cfsqltype="CF_SQL_varchar" value="#ValueList(qAltPostID.fk_Job_AnnounceNum)#">)
<cfelseif option is "JPPostListing" and StructKeyExists(session,"IHSUID")>
and j.WhoCreated = #session.IHSUID#
</cfif>
Order by j.Job_JPOpen desc
</cfquery>
<cfloop from="1" to="#session.getAllActiveListing.recordcount#" index="i">
<cfquery name="getAllActiveListingGrade" datasource="#request.at_datasource#">
SELECT fk_Job_AnnounceNum, Grade
from Job_JP_Grade
Where Job_JP_Grade.fk_Job_AnnounceNum = '#session.getAllActiveListing.Job_AnnounceNum[i]#'
</cfquery>
<cfif IsDefined("session.getAllActiveListing") and session.getAllActiveListing.recordcount neq "0">
<cfquery name="getAllActiveListingIHSArea" datasource="#at_datasource#">
SELECT JOBIHSArea_ID, JOBIHSArea_Name, JOBIHSArea_Alias
from JOB_IHSArea_LKUP
where JOBIHSArea_Alias = '#session.getAllActiveListing.Fac_Area[i]#'
</cfquery>
</cfif>
<cfset session.getAllActiveListingGrade = getAllActiveListingGrade />
<cfquery name="getAllActiveListingCloseName" datasource="#at_datasource#">
SELECT JOB_CloseName
from JOB_CloseType_LKUP
where JOB_CloseType_LKUP.JOB_CloseType = #session.getAllActiveListing.fk_CloseType[i]#
</cfquery>
<cfscript>
newRow=QueryAddRow(tot_AllActiveListing);
QuerySetCell(tot_AllActiveListing, "AnnounceNum", "#session.getAllActiveListing.Job_AnnounceNum[i]#");
QuerySetCell(tot_AllActiveListing, "JP_PDLoc", "#session.getAllActiveListing.JOB_PDLoc[i]#");
QuerySetCell(tot_AllActiveListing, "JP_Draft", "#session.getAllActiveListing.Job_JPDraft[i]#");
QuerySetCell(tot_AllActiveListing, "JP_Archived", "#session.getAllActiveListing.Job_JParchived[i]#");
QuerySetCell(tot_AllActiveListing, "JP_Posted", "#session.getAllActiveListing.Posted[i]#");
QuerySetCell(tot_AllActiveListing, "JP_PosNeed", "#session.getAllActiveListing.JOB_JPPosNeed[i]#");
QuerySetCell(tot_AllActiveListing, "JP_DirectHire", "#session.getAllActiveListing.JOB_DirectHire[i]#");
</cfscript>
</cfloop>
Any ideas will be greatly appreciated. If stored procedures are the best way to handle this and will run appreciably faster, I'll try it.
Thanks.
JoyRoseThanks for your reply.
So now here is the entire code written with LEFT JOIN:
<cfquery name="getAllActiveListing" datasource="#request.at_datasource#">
SELECT j.JOB_AnnounceNum, j.JOB_PDLoc, j.fk_JS_code, j.Job_JPOpen, j.Job_JPClose, j.fk_CloseType, j.JOB_JPPosNeed, j.JOB_DirectHire, j.JOB_JPDesc, j.Job_JPDraft, j.JOB_JPArchived, j.JOB_State,
j.fk_FACID, j.Posted, j.JOB_IHSvITU, f.Fac_Area, f.Fac_ServiceUnit, f.fac_Facility, f.Fac_Addr1, f.Fac_Addr2, f.Fac_City, f.Fac_State, f.Fac_Zip, g.Grade, a.JOBIHSArea_ID, a.JOBIHSArea_Name, a.JOBIHSArea_Alias, c.JOB_CloseName, s.Title, p.HRContact, p.HRContactType, e.Email, k.fk_KWID, k.fk_AnnounceNum, w.JOB_KWName, w.JOB_KWID
from JOB_JP j INNER JOIN #generaldb#IHSFacility f
ON j.fk_FACID = f.Fac_ID
LEFT OUTER JOIN JOB_JP_Grade g
ON j.JOB_AnnounceNum = g.fk_Job_AnnounceNum
LEFT OUTER JOIN JOB_IHSArea_LKUP a
ON j.Fac_Area = a.JOBIHSArea_Alias
LEFT OUTER JOIN JOB_CloseType_LKUP c
ON j.fk_CloseType = c.JOB_CloseType
LEFT OUTER JOIN JOB_Series_LKUP s
ON j.fk_js_code = s.fk_js_code
LEFT OUTER JOIN JOB_JPContacts p
ON j.JOB_AnnounceNum = p.fk_Job_AnnounceNum
LEFT OUTER JOIN #globalds#Email e
ON p.HRContact = e.table_ID
LEFT OUTER JOIN JOB_JPKW k
ON j.JOB_AnnounceNum = k.fk_AnnounceNum
LEFT OUTER JOIN JOB_KW_LKUP w
ON k.fk_KWID = w.JOB_KWID
WHERE
JOB_JPDraft = 0
and (Job_JPClose = #Now()# or Job_JPClose > #Now()# or fk_CloseType = 2 or fk_CloseType = 3)
and (JOB_JPArchived = 0 or JOB_JPArchived IS NULL)
<cfif IsDefined("qAltPostID") and qAltPostID.recordcount gt "0">
and JOB_AnnounceNum IN (<cfqueryparam list="yes" cfsqltype="CF_SQL_varchar" value="#ValueList(qAltPostID.fk_Job_AnnounceNum)#">)
<cfelseif option is "JPPostListing" and StructKeyExists(session,"IHSUID")>
and j.WhoCreated = #session.IHSUID#
</cfif>
Order by j.Job_JPOpen desc
</cfquery>
I'm concerned about the queries below that I converted to the LEFT JOIN code above..
<cfquery name="getAllActiveListingHRContact" datasource="#at_datasource#">
SELECT HRContact, HRContactType
from JOB_JPContacts
where fk_Job_AnnounceNum = '#session.getAllActiveListing.JOB_AnnounceNum[i]#'
</cfquery>
<cfif CompareNoCase(getAllActiveListingHRContact.HRContactType,"HRContactID") is 0>
<cfquery name="getAllActiveListingHREmail" datasource="#globalds#">
SELECT Email
from Email
where Table_ID = #getAllActiveListingHRContact.HRContact#
</cfquery>
<cfset session.getAllActiveListingHREmail = getAllActiveListingHREmail />
</cfif>
<cfquery name="getAllActiveListingMasterKey" datasource="#at_datasource#">
SELECT fk_KWID, fk_AnnounceNum, JOB_KWName, JOB_KWID
from JOB_JPKW, JOB_KW_LKUP
where JOB_JPKW.fk_AnnounceNum = '#session.getAllActiveListing.JOB_AnnounceNum[i]#'
and JOB_KW_LKUP.JOB_KWID = JOB_JPKW.fk_KWID
</cfquery>
I appreciate your help with this. -
Infoset query logical database and transparent table
Hi!
We have an infoset with the data source logical database=PNP.
We get some fields from the infotype 0768, P0768-PERNR, P0768-BEGDA, etc.
Now we need add another table to make a join within infotype 0768 and table T5F99SE.
For instance, in infotype 0768 I have one record with the fields PERNR and BEGDA and in the T5F99SE I have 3 records related to the unique record of infotype 0768, the fields of the table are PERNR, BEGDA, ACTDT and ADDAT .
The fields values in the example can be:
Infotype 0768: PERNR=00101800, BEGDA=20110401, DICOT=20, BACHE=1200
Table T5F99SE: record 1 PERNR=00101800, BEGDA=20110401, ACTDT=20110401, ADDAT=PB E
record 2 PERNR=00101800, BEGDA=20110101, ACTDT=20110405, ADDAT=PC E01
record 3 PERNR=00101800, BEGDA=20110401, ACTDT=20110409, ADDAT=PA E
The result we want get with infoset query is
PERNR BEGDA DICOT BACHE ADDAT
00101800 20110101 20 1200 PB E
00101800 20110101 20 1200 PC E01
00101800 20110101 20 1200 PA E
I would like to get the fields of the infotype and some fields of the table T5F99SE.
Is possible do this action with ABAP modifying an infoset that already exists adding the fields of the transparent table?
What should I do?
Kind regards,
Julian.My guess is that it would not be possible to include a transparent table into the LDBs PNP and PNPCE. Would need input from a technical expert there.
However, instead of using the LDB, why don't you explore just using a direct table join? You may need to join PA0000, PA0001, PA0002 along with PA0768 and your other tables. An infoset can then be created on this table join.
To go to the mode where you can create the table join, in your infoset transactions, choose 'Table join' instead of 'LDB'. -
Select query for KONV and VBAK table
hy Experts.
Please Help me For this Query, i got error on it.
I wnt to take KONV-KBETR (RATE FIELD) for particular SO number. and i used following query but it gives error i cant relate VBAK & KONV table.
Please do needful
SELECT KBETR KNUMV FROM KONV INTO (ITAB-KBETR, ITAB-KNUMV) WHERE VBAK-KNUMV = KONV-KNUMV AND VBAK-VBELN IN VBELN.
Thnks
Bhavesh Panchal.Hello Thnks For Reply,
but still i cant take solution. i am making a Sales order Rports. i got all field but i cant fetch filed for RATE and Pending Order Value.
Please check following Code. if need to change u can.
Thnks
Bhavesh Panchal.
REPORT ZTESTCODE.
TYPE-POOLS:slis.
TABLES: VBEP , VBAP , VBPA , VBKD , VBAK , LIKP , LIPS , VBUP , VBBE, KONV, KNA1.
DATA :BEGIN OF itab OCCURS 0,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBAP-POSNR,
EDATU LIKE VBEP-EDATU,
KNUMV LIKE VBAK-KNUMV,
WMENG LIKE VBEP-WMENG,
BMENG LIKE VBEP-BMENG,
LFIMG LIKE LIPS-LFIMG,
OMENG LIKE VBBE-OMENG,
POSAR LIKE VBAP-POSAR,
NETWR LIKE VBAP-NETWR,
NTGEW LIKE VBAP-NTGEW,
KBETR LIKE KOMV-KBETR,
KUNNR LIKE VBAK-KUNNR,
NAME1 LIKE KNA1-NAME1,
*BRGEW LIKE VBAP-BRGEW,
BSTKD LIKE VBKD-BSTKD,
BSTDK LIKE VBKD-BSTDK,
LFSTA LIKE VBUP-LFSTA,
*KNUMV LIKE VBAK-KNUMV,
*posnr LIKE LIPS-POSNR,
*NETWR LIKE VBAK-NETWR,
BRGEW LIKE VBAP-BRGEW,
LFDAT LIKE LIKP-LFDAT,
*NTGEW LIKE LIKP-NTGEW,
DELIVERY LIKE LIPS-VBELN,
WEIGHT like VBAP-NTGEW,
END OF itab.
*variable for Report ID
DATA: v_repid LIKE sy-repid .
*declaration for fieldcatalog
DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
DATA: it_listheader TYPE slis_t_listheader.
declartion for layout
DATA: alv_layout TYPE slis_layout_alv.
*Title displayed when the alv list is displayed
*DATA: i_title_main TYPE lvc_title VALUE 'FIRST LIST DISPLAYED'.
DATA: i_title_main TYPE lvc_title VALUE 'Reports : Bhavesh Pacnhal'.
INITIALIZATION.
v_repid = sy-repid.
PERFORM build_fieldcatlog.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : VBELN FOR VBAK-VBELN ,
KUNNR FOR VBPA-KUNNR ,
EDATU for ITAB-EDATU.
SELECTION-SCREEN: END OF BLOCK b1.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_listheader USING it_listheader.
PERFORM display_alv_report.
FORM build_fieldcatlog.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'VBELN'.
wa_fieldcat-seltext_m = 'SalesOrderNo'.
wa_fieldcat-outputlen = '12'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Field for Customer Name.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'NAME1'.
wa_fieldcat-seltext_m = 'Customer Name'.
wa_fieldcat-outputlen = '30'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Field For Po Number.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'BSTKD'.
wa_fieldcat-seltext_m = 'PO No'.
wa_fieldcat-outputlen = '20'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
Field For Order Value
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'NETWR'.
wa_fieldcat-seltext_m = 'Order Value '.
wa_fieldcat-outputlen = '12'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Field For Po Date.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'BSTDK'.
wa_fieldcat-seltext_m = 'PO Date'.
wa_fieldcat-outputlen = '20'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'POSNR'.
wa_fieldcat-seltext_m = 'Item No'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'EDATU'.
wa_fieldcat-seltext_m = 'Delivery Date'.
wa_fieldcat-outputlen = '12'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-tabname = 'VBAP'.
wa_fieldcat-fieldname = 'KWMENG'.
wa_fieldcat-seltext_m = 'Order QTY VABP.'.
wa_fieldcat-outputlen = '14'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Field For Order Qty.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'WMENG'.
wa_fieldcat-seltext_m = 'Ord.QT.WMEN.'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Field For Order Qty.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'BMENG'.
wa_fieldcat-seltext_m = 'Ord.QT.BMEN.'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
field For Delivery Qty.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'LFMING'.
wa_fieldcat-seltext_m = 'DEL QTY.'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Field For Open Qty from ITAB.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'OMENG'.
wa_fieldcat-seltext_m = 'OPEN QTY.'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Field For Pending Weight from ITAB.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'BRGEW'.
wa_fieldcat-seltext_m = 'Pending Weight'.
wa_fieldcat-outputlen = '12'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
Field For netweight.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'NTGEW'.
wa_fieldcat-seltext_m = 'Net Weight'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
Field For Actual Delivery.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'LFDAT'.
wa_fieldcat-seltext_m = 'Actual Delivery'.
wa_fieldcat-outputlen = '12'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'KBETR'.
wa_fieldcat-seltext_m = 'RATE'.
wa_fieldcat-outputlen = '20'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
Field For Actual Delivery.
wa_fieldcat-tabname = 'LIPS'.
wa_fieldcat-fieldname = 'POSNR'.
wa_fieldcat-seltext_m = 'Delivery ITEM'.
wa_fieldcat-outputlen = '20'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
Field For Pending Value.
VBUP-LFSTA
wa_fieldcat-tabname = 'VBUP'.
wa_fieldcat-fieldname = 'LFSTA'.
wa_fieldcat-seltext_m = 'Pending Value'.
wa_fieldcat-outputlen = '20'.
append wa_fieldcat to i_fieldcat.
clear wa_fieldcat.
Field For pending weight.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-fieldname = 'ITAB-OMENG * KOMV-KBETR'.
wa_fieldcat-seltext_m = 'Pending VALUE'.
wa_fieldcat-outputlen = '20'.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat.
ENDFORM. "BUILD_FIELDCATLOG
FORM data_retrieval.
SELECT VBELN NETWR KUNNR FROM VBAK INTO (ITAB-VBELN,ITAB-NETWR,ITAB-KUNNR) WHERE VBELN IN VBELN .
SELECT POSNR POSAR BRGEW FROM VBAP INTO (ITAB-POSNR,ITAB-POSAR,ITAB-BRGEW) WHERE VBELN = ITAB-VBELN .
SELECT EDATU FROM VBEP INTO (ITAB-EDATU) WHERE VBELN = ITAB-VBELN AND POSNR = ITAB-POSNR.
SELECT NAME1 FROM KNA1 INTO (ITAB-NAME1) WHERE KUNNR = ITAB-KUNNR .
SELECT BSTKD BSTDK FROM VBKD INTO (ITAB-BSTKD,ITAB-BSTDK) WHERE VBELN = ITAB-VBELN AND POSNR = ITAB-POSNR.
SELECT VBELN LFIMG FROM LIPS INTO (ITAB-DELIVERY, ITAB-LFIMG) WHERE VGBEL = ITAB-VBELN AND VGPOS = ITAB-POSNR.
SELECT LFDAT NTGEW FROM LIKP INTO (ITAB-LFDAT,ITAB-NTGEW) WHERE VBELN = ITAB-DELIVERY .
SELECT WMENG BMENG FROM VBEP INTO (ITAB-WMENG,ITAB-BMENG) WHERE VBELN IN VBELN .
SELECT SINGLE OMENG FROM VBBE INTO (ITAB-OMENG) WHERE VBELN IN VBELN.
SELECT SINGLE NETWR FROM VBAK INTO (ITAB-NETWR) WHERE VBELN IN VBELN.
SELECT KNUMV FROM VBAK INTO (ITAB-KNUMV) WHERE VBELN IN VBELN.
*SELECT KBETR KNUMV FROM KONV INTO (ITAB-KBETR, ITAB-KNUMV) WHERE KNUMV = VBAK-KNUMV.
*assign VAR1 = itab-kbetr.
*append itab.
*ENDSELECT.
SELECT KBETR KNUMV FROM KONV INTO (ITAB-KBETR, ITAB-KNUMV)WHERE KNUMV = VBAK-KNUMV.
ITAB-KBETR = KONV-KBETR.
ENDSELECT.
APPEND ITAB.
ENDSELECT.
ENDSELECT.
ENDSELECT.
ENDSELECT.
ENDSELECT.
ENDSELECT.
ENDSELECT.
ENDSELECT.
ENDSELECT.
*ENDSELECT.
ENDFORM. "data_retrieval
FORM build_listheader USING it_listheader TYPE slis_t_listheader.
DATA HLINE TYPE SLIS_LISTHEADER.
DATA: ls_line TYPE slis_listheader.
bhavesh
HLINE-INFO = 'report Developed by Bhavesh'.
HLINE-TYP = 'H'.
Header
Bhavesh
CLEAR ls_line.
ls_line-typ = 'H'.
LS_LINE-KEY: not used for this type
ls_line-info = 'Sales ORDER Report'.
APPEND ls_line TO it_listheader.
bhavesh
***Selection
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-key = 'Key 1'.
ls_line-info = 'SFEL'.
APPEND ls_line TO it_listheader.
ls_line-key = 'Key 2'.
ls_line-info = 'SFEL'.
APPEND ls_line TO it_listheader.
***Action
CLEAR ls_line.
ls_line-typ = 'A'.
LS_LINE-KEY: not used for this type
ls_line-info = 'Status list'.
APPEND ls_line TO it_listheader.
ENDFORM. "BUILD_LISTHEADER
*ENDFORM. "build_listheader
FORM display_alv_report.
v_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = v_repid
I_CALLBACK_PF_STATUS_SET = 'STATUS'(002)
i_callback_user_command = 'USER_COMMAND'
i_callback_top_of_page = 'TOP_OF_PAGE'
i_grid_title = 'SFEL SALES EXPEDITING REPORT'
i_background_id = 'ALV_BACKGROUND'
I_GRID_SETTINGS =
IS_LAYOUT = LAYO
IS_LAYOUT = ALV_LAYOUT
it_fieldcat = i_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
i_default = 'ZLAY1'
I_SAVE = 'A'
is_variant = i_variant
IT_EVENTS = V_EVENTS
TABLES
t_outtab = itab[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "display_alv_report
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listheader[].
i_logo = 'ENJOYSAP_LOGO'.
I_END_OF_LIST_GRID =
ENDFORM. "TOP_OF_PAGE -
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 -
Query regarding passivation and PS_TXN tables
Hi All ,
I am working on a read only Dashboard UI where the DB user has only read privileges.
The jbo.server.internal_connection uses the same DB connection to create PS_TXN & PS_TXN_SEQ tables which fails for obvious reasons & I get the error -
"Couldnot create persistence table PS_TXN_seq".
I have disabled passivation at all the VO levels and also disabled jbo.isSupportsPassivation to be false at the AMLocal level , but still I am getting this error.
I have also increased the initial AM pool size in bc4j.xcfg & Connection Pool at the weblogic server level to avoid snapshots been written to this table.
Is there any way I can prevent any interaction with this table as the client too is not interested in any kind of passivation to happen for the time being.
ThanksThanks for your reply Chris.
Chris Muir wrote:
You might be taking the wrong approach to solving this. Rather than disabling the AM pooling (which btw is not supported by Oracle) to the database, instead you can get ADF to passivate to file or memory of the app server.I am confused as to what exactly jbo.ampool.issupportspassivation = false does then ? I read on one of the blogs that its a viable use case for Programatic VOs ?
Also regarding passivating to file system as per http://download.oracle.com/docs/cd/E12839_01/web.1111/b31974/bcstatemgmt.htm#ADFFD1307 , its not really a recommended approach.. hence was not going for that.
Can you please throw some more light ?
Thanks -
Performance tuning on BKPF and BSEG for my code.
Please provide alternative code for the following code so that processing is fast.
my select queries are as follows. It take a lot of time and system gets loaded when it is scheduled.
select BUKRS
BELNR
GJAHR
BLART
BLDAT
BUDAT
TCODE
XBLNR
STBLG
WAERS
KURSF
AWKEY
STGRD
into CORRESPONDING FIELDS OF TABLE
IT_BKP from bkpf where bukrs = p_bukrs
and gjahr in s_gjahr
AND BLART NE 'SA'
and budat in s_date.
select BELNR
KOART
SHKZG
MWSKZ
DMBTR
KTOSL
SGTXT
VBELN
HKONT
KUNNR
MATNR
MENGE
FROM BSEG INTO CORRESPONDING FIELDS OF TABLE it_bseg
for all entries in it_bkpf
where bukrs = it_bkpf-bukrs
and belnr = it_bkpf-belnr
and gjahr = it_bkpf-gjahr
and MWSKZ in s_MWSKZ .
Please help.Hi,
Declare internal table same fields as the you are selecting from table and
remove corresponding fields of and also check ur t_bkpf table is not initial
before using for all enteries.
foe e.g.
select BUKRS
BELNR
GJAHR
BLART
BLDAT
BUDAT
TCODE
XBLNR
STBLG
WAERS
KURSF
AWKEY
STGRD
into TABLE
IT_BKP from bkpf where bukrs = p_bukrs
and gjahr in s_gjahr
AND BLART NE 'SA'
and budat in s_date.
IF IT_BKPF[] IN NOT INITIAL.
select BELNR
KOART
SHKZG
MWSKZ
DMBTR
KTOSL
SGTXT
VBELN
HKONT
KUNNR
MATNR
MENGE
FROM BSEG INTO TABLE it_bseg
for all entries in it_bkpf
where bukrs = it_bkpf-bukrs
and belnr = it_bkpf-belnr
and gjahr = it_bkpf-gjahr
and MWSKZ in s_MWSKZ .
ENDIF.
reward if useful. -
SQL Query with a little bit more complicated WHERE clause performance issue
Hello, I have some performance issue in this case:
Very simplified query:
SELECT COUNT(*) FROM Items
WHERE
ConditionA OR
ConditionB OR
ConditionC OR ...
Simply I have to determine how many Items the user has access through some complicated conditions.
When there is a large number of records (100,000+) in the Items table and say ~10 complicated conditions concatenated in WHERE clause, I get the result about 2 seconds in my case. The problem is when very few conditions are met, f.e. when I get only
10 Items from 100,000.
How can I improve the performace in this "Get my items" case?
Additional information:
the query is generated by EF 6.1
MS SQL 2012 Express
Here is the main part of the real SQL Execution Plan:Can you post table/index DDL? Query?
Sample query:
exec sp_executesql N'SELECT
[GroupBy1].[A1] AS [C1]
FROM ( SELECT
COUNT(1) AS [A1]
FROM [dbo].[Tickets] AS [Extent1]
LEFT OUTER JOIN [dbo].[Services] AS [Extent2] ON [Extent1].[ServiceId] = [Extent2].[Id]
WHERE (@p__linq__0 = 1) OR ([Extent1].[SubmitterKey] = @p__linq__1) OR ([Extent1].[OperatorKey] = @p__linq__2) OR (([Extent1].[OperatorKey] IS NULL) AND (@p__linq__2 IS NULL)) OR ([Extent1].[SolverKey] = @p__linq__3) OR (([Extent1].[SolverKey] IS NULL) AND (@p__linq__3 IS NULL)) OR ([Extent1].[Incident2ndLineSupportKey] = @p__linq__4) OR (([Extent1].[Incident2ndLineSupportKey] IS NULL) AND (@p__linq__4 IS NULL)) OR ((@p__linq__5 = 1) AND ((1 = CAST( [Extent1].[TicketType] AS int)) OR ((@p__linq__6 = 1) AND (((2 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[IncidentManager] = @p__linq__7) OR (([Extent2].[IncidentManager] IS NULL) AND (@p__linq__7 IS NULL)))) OR ((3 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[ServiceRequestManager] = @p__linq__8) OR (([Extent2].[ServiceRequestManager] IS NULL) AND (@p__linq__8 IS NULL)))) OR ((4 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[ProblemManager] = @p__linq__9) OR (([Extent2].[ProblemManager] IS NULL) AND (@p__linq__9 IS NULL)))) OR ((5 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[ChangeManager] = @p__linq__10) OR (([Extent2].[ChangeManager] IS NULL) AND (@p__linq__10 IS NULL)))))) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceDeputyManagers] AS [Extent3]
WHERE ([Extent1].[ServiceId] = [Extent3].[ServiceId]) AND ( CAST( [Extent3].[TicketType] AS int) = CAST( [Extent1].[TicketType] AS int)) AND ([Extent3].[UserProviderKey] = @p__linq__11)
)))) OR ((2 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsIncidents] = 1) OR ((201 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableIncidentTakeFromQueueAction] <> cast(1 as bit)))) AND ([Extent2].[Incident1stLineSupportLimitedAccess] <> cast(1 as bit))) OR ((3 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsServiceRequests] = 1) OR ((301 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableServiceRequestTakeFromQueueAction] <> cast(1 as bit)))) AND ([Extent2].[ServiceRequestLimitedAccess] <> cast(1 as bit))) OR ((4 = CAST( [Extent1].[TicketType] AS int)) AND ([Extent2].[AllowAccessToOtherOperatorsProblems] = 1) AND ([Extent2].[ProblemLimitedAccess] <> cast(1 as bit))) OR ((5 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsChanges] = 1) OR ((501 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableChangeTakeFromQueueAction] <> cast(1 as bit)))) AND ([Extent2].[ChangeLimitedAccess] <> cast(1 as bit))) OR ((2 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsIncidents] = 1) OR ((201 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableIncidentTakeFromQueueAction] <> cast(1 as bit)))) AND (( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperators] AS [Extent4]
WHERE ([Extent1].[ServiceId] = [Extent4].[ServiceId]) AND (2 = CAST( [Extent4].[TicketType] AS int)) AND ([Extent4].[UserProviderKey] = @p__linq__12) AND (1 = [Extent4].[SupportLine])
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[OperatorGroupUsers] AS [Extent5]
WHERE ([Extent5].[UserProviderKey] = @p__linq__13) AND ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperatorGroups] AS [Extent6]
WHERE ([Extent6].[ServiceId] = [Extent1].[ServiceId]) AND (2 = CAST( [Extent6].[TicketType] AS int)) AND (1 = [Extent6].[SupportLine]) AND ([Extent6].[OperatorGroupId] = [Extent5].[OperatorGroupId])
)))) OR ((2 = CAST( [Extent1].[TicketType] AS int)) AND ([Extent1].[IncidentFunctionEscalatedTo2ndLineSupport] = 1) AND ([Extent1].[Incident2ndLineSupportKey] IS NULL) AND (([Extent2].[Incident2ndLineSupportLimitedAccess] <> cast(1 as bit)) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperators] AS [Extent7]
WHERE ([Extent1].[ServiceId] = [Extent7].[ServiceId]) AND (2 = CAST( [Extent7].[TicketType] AS int)) AND ([Extent7].[UserProviderKey] = @p__linq__14) AND (2 = [Extent7].[SupportLine])
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[OperatorGroupUsers] AS [Extent8]
WHERE ([Extent8].[UserProviderKey] = @p__linq__15) AND ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperatorGroups] AS [Extent9]
WHERE ([Extent9].[ServiceId] = [Extent1].[ServiceId]) AND (2 = CAST( [Extent9].[TicketType] AS int)) AND (2 = [Extent9].[SupportLine]) AND ([Extent9].[OperatorGroupId] = [Extent8].[OperatorGroupId])
)))) OR ((3 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsServiceRequests] = 1) OR ((301 = CAST( [Extent1].[TicketState] AS int)) AND ([Extent2].[WfDisableServiceRequestTakeFromQueueAction] <> cast(1 as bit)))) AND (( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperators] AS [Extent10]
WHERE ([Extent1].[ServiceId] = [Extent10].[ServiceId]) AND (3 = CAST( [Extent10].[TicketType] AS int)) AND ([Extent10].[UserProviderKey] = @p__linq__16)
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[OperatorGroupUsers] AS [Extent11]
WHERE ([Extent11].[UserProviderKey] = @p__linq__17) AND ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperatorGroups] AS [Extent12]
WHERE ([Extent12].[ServiceId] = [Extent1].[ServiceId]) AND (3 = CAST( [Extent12].[TicketType] AS int)) AND ([Extent12].[OperatorGroupId] = [Extent11].[OperatorGroupId])
)))) OR ((4 = CAST( [Extent1].[TicketType] AS int)) AND ([Extent2].[AllowAccessToOtherOperatorsProblems] = 1) AND (( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperators] AS [Extent13]
WHERE ([Extent1].[ServiceId] = [Extent13].[ServiceId]) AND (4 = CAST( [Extent13].[TicketType] AS int)) AND ([Extent13].[UserProviderKey] = @p__linq__18)
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[OperatorGroupUsers] AS [Extent14]
WHERE ([Extent14].[UserProviderKey] = @p__linq__19) AND ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperatorGroups] AS [Extent15]
WHERE ([Extent15].[ServiceId] = [Extent1].[ServiceId]) AND (4 = CAST( [Extent15].[TicketType] AS int)) AND ([Extent15].[OperatorGroupId] = [Extent14].[OperatorGroupId])
)))) OR ((5 = CAST( [Extent1].[TicketType] AS int)) AND (([Extent2].[AllowAccessToOtherOperatorsChanges] = 1) OR ((501 = [Extent1].[TicketStateValue]) AND ([Extent2].[WfDisableChangeTakeFromQueueAction] <> cast(1 as bit)))) AND (( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperators] AS [Extent16]
WHERE ([Extent1].[ServiceId] = [Extent16].[ServiceId]) AND (5 = CAST( [Extent16].[TicketType] AS int)) AND ([Extent16].[UserProviderKey] = @p__linq__20)
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[OperatorGroupUsers] AS [Extent17]
WHERE ([Extent17].[UserProviderKey] = @p__linq__21) AND ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[ServiceOperatorGroups] AS [Extent18]
WHERE ([Extent18].[ServiceId] = [Extent1].[ServiceId]) AND (5 = CAST( [Extent18].[TicketType] AS int)) AND ([Extent18].[OperatorGroupId] = [Extent17].[OperatorGroupId])
)))) OR ( EXISTS (SELECT
1 AS [C1]
FROM [dbo].[TicketInvitations] AS [Extent19]
WHERE ([Extent19].[TicketId] = [Extent1].[Id]) AND (([Extent19].[InvitedUserProviderKey] = @p__linq__22) OR (([Extent19].[InvitedUserProviderKey] IS NULL) AND (@p__linq__22 IS NULL)))
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM (SELECT
[Extent20].[CustomerId] AS [CustomerId]
FROM [dbo].[CustomerUsers] AS [Extent20]
WHERE ([Extent20].[UserProviderKey] = @p__linq__23) AND ([Extent20].[CanAccessOthersTickets] = 1)
INTERSECT
SELECT
[Extent21].[CustomerId] AS [CustomerId]
FROM [dbo].[CustomerUsers] AS [Extent21]
WHERE [Extent21].[UserProviderKey] = [Extent1].[SubmitterKey]) AS [Intersect1]
)) OR ( EXISTS (SELECT
1 AS [C1]
FROM (SELECT
[Extent22].[InternalGroupId] AS [InternalGroupId]
FROM [dbo].[InternalGroupUsers] AS [Extent22]
WHERE ([Extent22].[UserProviderKey] = @p__linq__24) AND ([Extent22].[CanAccessOthersTickets] = 1)
INTERSECT
SELECT
[Extent23].[InternalGroupId] AS [InternalGroupId]
FROM [dbo].[InternalGroupUsers] AS [Extent23]
WHERE [Extent23].[UserProviderKey] = [Extent1].[SubmitterKey]) AS [Intersect2]
) AS [GroupBy1]',N'@p__linq__0 bit,@p__linq__1 varchar(8000),@p__linq__2 varchar(8000),@p__linq__3 varchar(8000),@p__linq__4 varchar(8000),@p__linq__5 bit,@p__linq__6 bit,@p__linq__7 varchar(8000),@p__linq__8 varchar(8000),@p__linq__9 varchar(8000),@p__linq__10 varchar(8000),@p__linq__11 varchar(8000),@p__linq__12 varchar(8000),@p__linq__13 varchar(8000),@p__linq__14 varchar(8000),@p__linq__15 varchar(8000),@p__linq__16 varchar(8000),@p__linq__17 varchar(8000),@p__linq__18 varchar(8000),@p__linq__19 varchar(8000),@p__linq__20 varchar(8000),@p__linq__21 varchar(8000),@p__linq__22 varchar(8000),@p__linq__23 varchar(8000),@p__linq__24 varchar(8000)',@p__linq__0=0,@p__linq__1='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__2='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__3='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__4='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__5=1,@p__linq__6=0,@p__linq__7='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__8='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__9='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__10='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__11='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__12='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__13='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__14='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__15='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__16='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__17='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__18='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__19='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__20='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__21='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__22='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__23='31555851-b89d-4a15-bb05-5a6fd42f9552',@p__linq__24='31555851-b89d-4a15-bb05-5a6fd42f9552'
Generated DDL for related tables: (indexes are primary on PKs and FKs)
CREATE TABLE [dbo].[CustomerUsers](
[UserProviderKey] [varchar](184) NOT NULL,
[CustomerId] [int] NOT NULL,
[CanAccessOthersTickets] [bit] NOT NULL,
CONSTRAINT [PK_dbo.CustomerUsers] PRIMARY KEY CLUSTERED
[UserProviderKey] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[InternalGroupUsers] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[InternalGroupUsers](
[UserProviderKey] [varchar](184) NOT NULL,
[InternalGroupId] [int] NOT NULL,
[CanAccessOthersTickets] [bit] NOT NULL,
CONSTRAINT [PK_dbo.InternalGroupUsers] PRIMARY KEY CLUSTERED
[UserProviderKey] ASC,
[InternalGroupId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[OperatorGroupUsers] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[OperatorGroupUsers](
[UserProviderKey] [varchar](184) NOT NULL,
[OperatorGroupId] [int] NOT NULL,
CONSTRAINT [PK_dbo.OperatorGroupUsers] PRIMARY KEY CLUSTERED
[UserProviderKey] ASC,
[OperatorGroupId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[ServiceDeputyManagers] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ServiceDeputyManagers](
[UserProviderKey] [varchar](184) NOT NULL,
[ServiceId] [int] NOT NULL,
[TicketType] [int] NOT NULL,
CONSTRAINT [PK_dbo.ServiceDeputyManagers] PRIMARY KEY CLUSTERED
[UserProviderKey] ASC,
[ServiceId] ASC,
[TicketType] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[ServiceOperatorGroups] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[ServiceOperatorGroups](
[ServiceId] [int] NOT NULL,
[OperatorGroupId] [int] NOT NULL,
[TicketTypeValue] [int] NOT NULL,
[SupportLine] [int] NOT NULL,
[TicketType] [int] NOT NULL,
CONSTRAINT [PK_dbo.ServiceOperatorGroups] PRIMARY KEY CLUSTERED
[ServiceId] ASC,
[OperatorGroupId] ASC,
[TicketTypeValue] ASC,
[SupportLine] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[ServiceOperators] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ServiceOperators](
[UserProviderKey] [varchar](184) NOT NULL,
[ServiceId] [int] NOT NULL,
[TicketTypeValue] [int] NOT NULL,
[SupportLine] [int] NOT NULL,
[TicketType] [int] NOT NULL,
CONSTRAINT [PK_dbo.ServiceOperators] PRIMARY KEY CLUSTERED
[UserProviderKey] ASC,
[ServiceId] ASC,
[TicketTypeValue] ASC,
[SupportLine] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[Services] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Services](
[Id] [int] IDENTITY(1,1) NOT NULL,
[ParentId] [int] NULL,
[Name] [nvarchar](256) NOT NULL,
[Description] [nvarchar](max) NULL,
[Disabled] [bit] NOT NULL,
[NewTicketLimitedAccess] [bit] NOT NULL,
[Incident1stLineSupportLimitedAccess] [bit] NOT NULL,
[Incident2ndLineSupportLimitedAccess] [bit] NOT NULL,
[ServiceRequestLimitedAccess] [bit] NOT NULL,
[ProblemLimitedAccess] [bit] NOT NULL,
[ServiceRequestManager] [varchar](184) NOT NULL,
[IncidentManager] [varchar](184) NOT NULL,
[ProblemManager] [varchar](184) NOT NULL,
[Deleted] [bit] NOT NULL,
[WfDisableIncidentAssignedState] [bit] NOT NULL,
[WfDisableIncidentConfirmedState] [bit] NOT NULL,
[WfDisableIncidentTakeFromQueueAction] [bit] NOT NULL,
[WfDisableIncidentFinishSolutionAction] [bit] NOT NULL,
[WfDisableServiceRequestAssignedState] [bit] NOT NULL,
[WfDisableServiceRequestConfirmedState] [bit] NOT NULL,
[WfDisableServiceRequestTakeFromQueueAction] [bit] NOT NULL,
[WfDisableServiceRequestFinishSolutionAction] [bit] NOT NULL,
[WfDisableServiceRequestPostponeAction] [bit] NOT NULL,
[ChangeLimitedAccess] [bit] NOT NULL,
[ChangeManager] [varchar](184) NOT NULL,
[WfDisableChangeTakeFromQueueAction] [bit] NOT NULL,
[WfDisableChangeAssignedState] [bit] NOT NULL,
[WfDisableChangeStartPreparationAction] [bit] NOT NULL,
[IsDepartment] [bit] NOT NULL,
[InheritsFromDepartment] [bit] NOT NULL,
[AllowSelectSolverBySubmitterForIncidents] [bit] NOT NULL,
[AllowSelectSolverBySubmitterForServiceRequests] [bit] NOT NULL,
[AllowSelectSolverBySubmitterForProblems] [bit] NOT NULL,
[AllowSelectSolverBySubmitterForChanges] [bit] NOT NULL,
[AllowAccessToOtherOperatorsIncidents] [bit] NOT NULL,
[AllowAccessToOtherOperatorsServiceRequests] [bit] NOT NULL,
[AllowAccessToOtherOperatorsProblems] [bit] NOT NULL,
[AllowAccessToOtherOperatorsChanges] [bit] NOT NULL,
[AllowChangeDeadlineForIncidents] [bit] NOT NULL,
[AllowChangeDeadlineForServiceRequests] [bit] NOT NULL,
[AllowChangeDeadlineForProblems] [bit] NOT NULL,
[AllowChangeDeadlineForChanges] [bit] NOT NULL,
[AllowSelectPriorityForServiceRequests] [bit] NOT NULL,
[WfDisableIncidentCompletedState] [bit] NOT NULL,
[WfDoIncidentCompleteActionBySubmittersMessage] [bit] NOT NULL,
[WfDisableServiceRequestCompletedState] [bit] NOT NULL,
[WfDoServiceRequestCompleteActionBySubmittersMessage] [bit] NOT NULL,
CONSTRAINT [PK_dbo.Services] PRIMARY KEY CLUSTERED
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[TicketInvitations] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[TicketInvitations](
[Id] [int] IDENTITY(1,1) NOT NULL,
[TicketId] [int] NOT NULL,
[InitiatorUserProviderKey] [varchar](184) NULL,
[InitiatorFullName] [nvarchar](max) NULL,
[InvitedUserProviderKey] [varchar](184) NULL,
[InvitedFullName] [nvarchar](max) NULL,
[Type] [int] NOT NULL,
[CreatedUTC] [datetime] NOT NULL,
CONSTRAINT [PK_dbo.TicketInvitations] PRIMARY KEY CLUSTERED
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Table [dbo].[Tickets] Script Date: 7.5.2014 8:39:38 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Tickets](
[Id] [int] IDENTITY(1,1) NOT NULL,
[ParentId] [int] NULL,
[ServiceId] [int] NULL,
[ServiceMailboxId] [int] NULL,
[TicketTypeValue] [int] NOT NULL,
[TicketTypeIdREF] [int] NOT NULL,
[SubmitterKey] [varchar](184) NOT NULL,
[SubmitterFullName] [nvarchar](256) NULL,
[CustomerId] [int] NULL,
[SolverKey] [varchar](184) NULL,
[SolverFullName] [nvarchar](256) NULL,
[Subject] [nvarchar](max) NULL,
[CreatedUTC] [datetime] NOT NULL,
[Archived] [bit] NOT NULL,
[MarkedAsSolvedUTC] [datetime] NULL,
[ArchivedUTC] [datetime] NULL,
[TicketSourceValue] [int] NOT NULL,
[OperatorKey] [varchar](184) NULL,
[DeadlineUTC] [datetime] NULL,
[DeadlineLastNotificatedPercentage] [int] NULL,
[UrgencyValue] [int] NULL,
[ImpactValue] [int] NULL,
[PriorityValue] [int] NULL,
[TicketStateValue] [int] NOT NULL,
[IncidentFunctionEscalatedTo2ndLineSupport] [bit] NOT NULL,
[Incident2ndLineSupportKey] [varchar](184) NULL,
[Incident2ndLineSupportFullName] [nvarchar](max) NULL,
[TicketType] [int] NOT NULL,
[Source] [int] NOT NULL,
[TicketState] [int] NOT NULL,
[Urgency] [int] NULL,
[Impact] [int] NULL,
[TicketSummaryState] [int] NOT NULL,
[ResolutionText] [nvarchar](max) NULL,
[ResolutionModifiedUTC] [datetime] NULL,
[ResolutionEdited] [bit] NOT NULL,
[ResolutionUserProviderKey] [varchar](184) NULL,
[ResolutionFullName] [nvarchar](max) NULL,
[TicketSubType] [int] NULL,
[ChangeRiskProbabilityValue] [int] NULL,
[ChangeImpactValue] [int] NULL,
[ChangeRiskCategoryValue] [int] NULL,
[RfcText] [nvarchar](max) NULL,
[RfcModifiedUTC] [datetime] NULL,
[RfcEdited] [bit] NOT NULL,
[RfcUserProviderKey] [varchar](184) NULL,
[RfcFullName] [nvarchar](max) NULL,
[ManualDeadline] [bit] NOT NULL,
[ContactInformation] [nvarchar](256) NULL,
[Imported] [bit] NOT NULL,
[ForceClosed] [bit] NOT NULL,
CONSTRAINT [PK_dbo.Tickets] PRIMARY KEY CLUSTERED
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
/****** Object: Index [IX_CustomerId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_CustomerId] ON [dbo].[CustomerUsers]
[CustomerId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_InternalGroupId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_InternalGroupId] ON [dbo].[InternalGroupUsers]
[InternalGroupId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_OperatorGroupId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_OperatorGroupId] ON [dbo].[OperatorGroupUsers]
[OperatorGroupId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ServiceId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ServiceId] ON [dbo].[ServiceDeputyManagers]
[ServiceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_OperatorGroupId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_OperatorGroupId] ON [dbo].[ServiceOperatorGroups]
[OperatorGroupId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ServiceId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ServiceId] ON [dbo].[ServiceOperatorGroups]
[ServiceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ServiceId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ServiceId] ON [dbo].[ServiceOperators]
[ServiceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ParentId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ParentId] ON [dbo].[Services]
[ParentId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_TicketId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_TicketId] ON [dbo].[TicketInvitations]
[TicketId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_TicketInvitations_InvitedUserProviderKey_TicketId] Script Date: 7.5.2014 8:39:38 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_TicketInvitations_InvitedUserProviderKey_TicketId] ON [dbo].[TicketInvitations]
[InvitedUserProviderKey] ASC,
[TicketId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_CustomerId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_CustomerId] ON [dbo].[Tickets]
[CustomerId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ParentId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ParentId] ON [dbo].[Tickets]
[ParentId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ServiceId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ServiceId] ON [dbo].[Tickets]
[ServiceId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_ServiceMailboxId] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_ServiceMailboxId] ON [dbo].[Tickets]
[ServiceMailboxId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_SolverFullName] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_SolverFullName] ON [dbo].[Tickets]
[SolverFullName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_SolverKey] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_SolverKey] ON [dbo].[Tickets]
[SolverKey] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_SubmitterFullName] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_SubmitterFullName] ON [dbo].[Tickets]
[SubmitterFullName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
SET ANSI_PADDING ON
GO
/****** Object: Index [IX_SubmitterKey] Script Date: 7.5.2014 8:39:38 ******/
CREATE NONCLUSTERED INDEX [IX_SubmitterKey] ON [dbo].[Tickets]
[SubmitterKey] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
/****** Object: Index [IX_Tickets_TicketType_TicketTypeIdREF] Script Date: 7.5.2014 8:39:38 ******/
CREATE UNIQUE NONCLUSTERED INDEX [IX_Tickets_TicketType_TicketTypeIdREF] ON [dbo].[Tickets]
[TicketType] ASC,
[TicketTypeIdREF] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
ALTER TABLE [dbo].[CustomerUsers] WITH CHECK ADD CONSTRAINT [FK_dbo.CustomerUsers_dbo.Customers_CustomerId] FOREIGN KEY([CustomerId])
REFERENCES [dbo].[Customers] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[CustomerUsers] CHECK CONSTRAINT [FK_dbo.CustomerUsers_dbo.Customers_CustomerId]
GO
ALTER TABLE [dbo].[InternalGroupUsers] WITH CHECK ADD CONSTRAINT [FK_dbo.InternalGroupUsers_dbo.InternalGroups_InternalGroupId] FOREIGN KEY([InternalGroupId])
REFERENCES [dbo].[InternalGroups] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[InternalGroupUsers] CHECK CONSTRAINT [FK_dbo.InternalGroupUsers_dbo.InternalGroups_InternalGroupId]
GO
ALTER TABLE [dbo].[OperatorGroupUsers] WITH CHECK ADD CONSTRAINT [FK_dbo.OperatorGroupUsers_dbo.OperatorGroups_OperatorGroupId] FOREIGN KEY([OperatorGroupId])
REFERENCES [dbo].[OperatorGroups] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[OperatorGroupUsers] CHECK CONSTRAINT [FK_dbo.OperatorGroupUsers_dbo.OperatorGroups_OperatorGroupId]
GO
ALTER TABLE [dbo].[ServiceDeputyManagers] WITH CHECK ADD CONSTRAINT [FK_dbo.ServiceDeputyManagers_dbo.Services_ServiceId] FOREIGN KEY([ServiceId])
REFERENCES [dbo].[Services] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ServiceDeputyManagers] CHECK CONSTRAINT [FK_dbo.ServiceDeputyManagers_dbo.Services_ServiceId]
GO
ALTER TABLE [dbo].[ServiceOperatorGroups] WITH CHECK ADD CONSTRAINT [FK_dbo.ServiceOperatorGroups_dbo.OperatorGroups_OperatorGroupId] FOREIGN KEY([OperatorGroupId])
REFERENCES [dbo].[OperatorGroups] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ServiceOperatorGroups] CHECK CONSTRAINT [FK_dbo.ServiceOperatorGroups_dbo.OperatorGroups_OperatorGroupId]
GO
ALTER TABLE [dbo].[ServiceOperatorGroups] WITH CHECK ADD CONSTRAINT [FK_dbo.ServiceOperatorGroups_dbo.Services_ServiceId] FOREIGN KEY([ServiceId])
REFERENCES [dbo].[Services] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ServiceOperatorGroups] CHECK CONSTRAINT [FK_dbo.ServiceOperatorGroups_dbo.Services_ServiceId]
GO
ALTER TABLE [dbo].[ServiceOperators] WITH CHECK ADD CONSTRAINT [FK_dbo.ServiceOperators_dbo.Services_ServiceId] FOREIGN KEY([ServiceId])
REFERENCES [dbo].[Services] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[ServiceOperators] CHECK CONSTRAINT [FK_dbo.ServiceOperators_dbo.Services_ServiceId]
GO
ALTER TABLE [dbo].[Services] WITH CHECK ADD CONSTRAINT [FK_dbo.Services_dbo.Services_ParentId] FOREIGN KEY([ParentId])
REFERENCES [dbo].[Services] ([Id])
GO
ALTER TABLE [dbo].[Services] CHECK CONSTRAINT [FK_dbo.Services_dbo.Services_ParentId]
GO
ALTER TABLE [dbo].[TicketInvitations] WITH CHECK ADD CONSTRAINT [FK_dbo.TicketInvitations_dbo.Tickets_TicketId] FOREIGN KEY([TicketId])
REFERENCES [dbo].[Tickets] ([Id])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[TicketInvitations] CHECK CONSTRAINT [FK_dbo.TicketInvitations_dbo.Tickets_TicketId]
GO
ALTER TABLE [dbo].[Tickets] WITH CHECK ADD CONSTRAINT [FK_dbo.Tickets_dbo.Customers_CustomerId] FOREIGN KEY([CustomerId])
REFERENCES [dbo].[Customers] ([Id])
GO
ALTER TABLE [dbo].[Tickets] CHECK CONSTRAINT [FK_dbo.Tickets_dbo.Customers_CustomerId]
GO
ALTER TABLE [dbo].[Tickets] WITH CHECK ADD CONSTRAINT [FK_dbo.Tickets_dbo.ServiceMailboxes_ServiceMailboxId] FOREIGN KEY([ServiceMailboxId])
REFERENCES [dbo].[ServiceMailboxes] ([Id])
GO
ALTER TABLE [dbo].[Tickets] CHECK CONSTRAINT [FK_dbo.Tickets_dbo.ServiceMailboxes_ServiceMailboxId]
GO
ALTER TABLE [dbo].[Tickets] WITH CHECK ADD CONSTRAINT [FK_dbo.Tickets_dbo.Services_ServiceId] FOREIGN KEY([ServiceId])
REFERENCES [dbo].[Services] ([Id])
GO
ALTER TABLE [dbo].[Tickets] CHECK CONSTRAINT [FK_dbo.Tickets_dbo.Services_ServiceId]
GO
ALTER TABLE [dbo].[Tickets] WITH CHECK ADD CONSTRAINT [FK_dbo.Tickets_dbo.Tickets_ParentId] FOREIGN KEY([ParentId])
REFERENCES [dbo].[Tickets] ([Id])
GO
ALTER TABLE [dbo].[Tickets] CHECK CONSTRAINT [FK_dbo.Tickets_dbo.Tickets_ParentId]
GO -
Query Performance Issue based on the same Multiprovider
Hi All,
I am facing a performance issue with one of the BEx Query 1 based on a particular Multiprovider.
I have done all the kind of testing and came o a conclusion that the OLAP: Data Transfer time for the query is the max at around 820 Secs.
The surprising part is another Query 2 based on the same multiprovider runs absolutely fine without any hassles with OLAP : Data Transfer time with merely 3 Sec.
Another, surprise is that Query 2 has even more Restricted Key Figures and Calculated Key Figures but it runs smoothly.
Both the queries use cache memory.
Please suggest a solution to this.
Thanks.Hi Rupesh,
There is no much difference between the 2 queries.
Query 1 - which has performance issue has the same filters as that of Query 2 - which is working fine.
The only difference is that the selection of Fiscal Week is in the Default Values Pane for Query 2 whereas its in Characteristics Restrictions in Query 1. I doubt whether this setting will have any effect on the performance.
Both restriction i.e Fiscal Week restriction is based on Customer exit and the rows include Hierarchy for both the queries.
I assume creating aggregates on hierarchy for the Cube can be a solution. -
Performance Issue with sql query
Hi,
My db is 10.2.0.5 with RAC on ASM, Cluster ware version 10.2.0.5.
With bsoa table as
SQL> desc bsoa;
Name Null? Type
ID NOT NULL NUMBER
LOGIN_TIME DATE
LOGOUT_TIME DATE
SUCCESSFUL_IND VARCHAR2(1)
WORK_STATION_NAME VARCHAR2(80)
OS_USER VARCHAR2(30)
USER_NAME NOT NULL VARCHAR2(30)
FORM_ID NUMBER
AUDIT_TRAIL_NO NUMBER
CREATED_BY VARCHAR2(30)
CREATION_DATE DATE
LAST_UPDATED_BY VARCHAR2(30)
LAST_UPDATE_DATE DATE
SITE_NO NUMBER
SESSION_ID NUMBER(8)
The query
UPDATE BSOA SET LOGOUT_TIME =SYSDATE WHERE SYS_CONTEXT('USERENV', 'SESSIONID') = SESSION_ID
Is taking a lot of time to execute and in AWR reports also it is on top in
1. SQL Order by elapsed time
2. SQL order by reads
3. SQL order by gets
So i am trying a way to solve the performance issue as the application is slow specially during login and logout time.
I understand that the function in the where condition cause to do FTS, but i can not think what other parts to look at.
Also:
SQL> SELECT COUNT(1) FROM BSOA;
COUNT(1)
7800373
The explain plan for "UPDATE BSOA SET LOGOUT_TIME =SYSDATE WHERE SYS_CONTEXT('USERENV', 'SESSIONID') = SESSION_ID" is
{code}
PLAN_TABLE_OUTPUT
Plan hash value: 1184960901
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | UPDATE STATEMENT | | 1 | 26 | 18748 (3)| 00:03:45 |
| 1 | UPDATE | BSOA | | | | |
|* 2 | TABLE ACCESS FULL| BSOA | 1 | 26 | 18748 (3)| 00:03:45 |
Predicate Information (identified by operation id):
2 - filter("SESSION_ID"=TO_NUMBER(SYS_CONTEXT('USERENV','SESSIONID')))
{code}Hi,
There are also triggers before update and AUDITS on this table.
CREATE OR REPLACE TRIGGER B2.TRIGGER1
BEFORE UPDATE
ON B2.BSOA REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
:NEW.LAST_UPDATED_BY := USER ;
:NEW.LAST_UPDATE_DATE := SYSDATE ;
END;
CREATE OR REPLACE TRIGGER B2.TRIGGER2
BEFORE INSERT
ON B2.BSOA REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
:NEW.CREATED_BY := USER ;
:NEW.CREATION_DATE := SYSDATE ;
:NEW.LAST_UPDATED_BY := USER ;
:NEW.LAST_UPDATE_DATE := SYSDATE ;
END;
And also there is an audit on this table
AUDIT UPDATE ON B2.BSOA BY ACCESS WHENEVER SUCCESSFUL;
AUDIT UPDATE ON B2.BSOA BY ACCESS WHENEVER NOT SUCCESSFUL;
And the sessionid column in BSOA has height balanced histogram.
When i create an index i get the following error. As i am on 10g I can't use DDL_LOCK_TIMEOUT . I may have to wait for next down time.
SQL> CREATE INDEX B2.BSOA_SESSID_I ON B2.BSOA(SESSION_ID) TABLESPACE B2 COMPUTE STATISTICS;
CREATE INDEX B2.BSOA_SESSID_I ON B2.BSOA(SESSION_ID) TABLESPACE B2 COMPUTE STATISTICS
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified
Thanks -
Performance Issue for BI system
Hello,
We are facing performance issues for BI System. Its a preproductive system and its performance is degrading badly everyday. I was checking system came to know program buffer hit ratio is increaasing everyday due to high Swaps. So asked to change the parameter abap/buffersize which was 300Mb to 500Mb. But still no major improvement is found in the system.
There is 16GB Ram available and Server is HP-UX and with Netweaver2004s with Oracle 10.2.0.4.0 installed in it.
The Main problem is while running a report or creating a query is taking way too long time.
Kindly help me.Hello SIva,
Thanks for your reply but i have checked ST02 and ST03 and also SM50 and its normal
we are having 9 dialog processes, 3 Background , 2 Update and 1 spool.
No one is using the system currently but in ST02 i can see the swaps are in red.
Buffer HitRatio % Alloc. KB Freesp. KB % Free Sp. Dir. Size FreeDirEnt % Free Dir Swaps DB Accs
Nametab (NTAB) 0
Table definition 99,60 6.798 20.000 29.532 153.221
Field definition 99,82 31.562 784 2,61 20.000 6.222 31,11 17.246 41.248
Short NTAB 99,94 3.625 2.446 81,53 5.000 2.801 56,02 0 2.254
Initial records 73,95 6.625 998 16,63 5.000 690 13,80 40.069 49.528
0
boldprogram 97,66 300.000 1.074 0,38 75.000 67.177 89,57 219.665 725.703bold
CUA 99,75 3.000 875 36,29 1.500 1.401 93,40 55.277 2.497
Screen 99,80 4.297 1.365 33,35 2.000 1.811 90,55 119 3.214
Calendar 100,00 488 361 75,52 200 42 21,00 0 158
OTR 100,00 4.096 3.313 100,00 2.000 2.000 100,00 0
0
Tables 0
Generic Key 99,17 29.297 1.450 5,23 5.000 350 7,00 2.219 3.085.633
Single record 99,43 10.000 1.907 19,41 500 344 68,80 39 467.978
0
Export/import 82,75 4.096 43 1,30 2.000 662 33,10 137.208
Exp./ Imp. SHM 89,83 4.096 438 13,22 2.000 1.482 74,10 0
SAP Memory Curr.Use % CurUse[KB] MaxUse[KB] In Mem[KB] OnDisk[KB] SAPCurCach HitRatio %
Roll area 2,22 5.832 22.856 131.072 131.072 IDs 96,61
Page area 1,08 2.832 24.144 65.536 196.608 Statement 79,00
Extended memory 22,90 958.464 1.929.216 4.186.112 0 0,00
Heap memory 0 0 1.473.767 0 0,00
Call Stati HitRatio % ABAP/4 Req ABAP Fails DBTotCalls AvTime[ms] DBRowsAff.
Select single 88,59 63.073.369 5.817.659 4.322.263 0 57.255.710
Select 72,68 284.080.387 0 13.718.442 0 32.199.124
Insert 0,00 151.955 5.458 166.159 0 323.725
Update 0,00 378.161 97.884 395.814 0 486.880
Delete 0,00 389.398 332.619 415.562 0 244.495
Edited by: Srikanth Sunkara on May 12, 2011 11:50 AM -
Database migrated from Oracle 10g to 11g Discoverer report performance issu
Hi All,
We are now getting issue in Discoverer Report performance as the report is keep on running when database got upgrade from 10g to 11g.
In database 10g the report is working fine but the same report is not working fine in 11g.
The query i have changed as I have passed the date format TO_CHAR("DD-MON-YYYY" and removed the NVL & TRUNC function from the existing query.
The report is now working fine in Database 11g backhand but when I am using the same query in Discoverer it is not working and report is keep on running.
Please advise.
Regards,Pl post exact OS, database and Discoverer versions. After the upgrade, have statistics been updated ? Have you traced the Discoverer query to determine where the performance issue is ?
How To Find Oracle Discoverer Diagnostic and Tracing Guides [ID 290658.1]
How To Enable SQL Tracing For Discoverer Sessions [ID 133055.1]
Discoverer 11g: Performance degradation after Upgrade to Database 11g [ID 1514929.1]
HTH
Srini -
Slow Moving Items in 0IC_MC01 Performance issue
Hi i am creating slow moving items report (Report which shows materials for which no transaction has been done for last 3 years) on MP 0IC_MC01 in BI7.0.
MP is based on cube 0IC_C03 and Infoobject 0MATERIAL .
In query i put rowcount in coloumn with Infoprovider 0material with constant selection but i dont get the option "Display values not posted" . and Issues value and Recved value .
in rows i put plant , material and material type
n put one condition values for issued and Recid = 0 .
and in filter we have calender year restriction .
But the proble is dere are around 25000 materials for each plant and its taking a lot of time to exceute for multiple plants for 1-2 years , can anyone suggest the best way for this report or how performance of this report can be improved .
Help will be appreciated .Its rather better to use infoset on 0IC_MC01 and Material than using MP. The performance issue is coming because of a join between cube and infoobject, which SAP dont suggest to use.
You ahve to use left outer join to get slow moving items.
http://help.sap.com/saphelp_nw04/Helpdata/EN/67/7e4b3eaf72561ee10000000a114084/content.htm
Thanks...
Shambhu
Maybe you are looking for
-
Google Voice APP and Google Voice will use cell phone minutes.
My Verizon contract has 1400 minutes shared with 3 cell phones. I noticed that my cell number was using minutes from the calling plan. I normally call the other two cell phones, and my home number (which is on my friends of family calling list). My o
-
Hi Experts, While executing the scenario,I got the following error. Attempt to establish database connection failed with SQL error com.sap.aii.adapter.jdbc.sql.DriverManagerException: Cannot establish connection to URL 'jdbc:oracle://aljs047:1521/EMP
-
How to fix a security warning on a web form?
hi, I have added a new form which I have modified, and it is coming up with a security warning (see attached screenshot) Is there any reason why this is happening and is there anything I can do to make it secure? Form is here: (www.eastsidestudios.co
-
Acrobat 9 dynamic stamp customized transfer from previous version
client of mine made a custom dynamic stamp and they can get it set up fine (dynamic field inserted in the stamp) and in the correct folder where it pulls the other stamps, but it is not finding it in the stamp list in the program, is what they've tol
-
I am perfectly aware of how to do this using the old version of itunes. however i just got a new macbook pro retina... and it came with the latest version of itunes. and i was trying to import/export garage band files between my ipad and mac via itun