Union in Crystal
Hi Experts
I want to apply a union query for thhe records
Any ideas?
thanks in advance
AG
HI,
The purpose of the SQL UNION command is to combine the results of two queries together. Example
First query:
Select date, name, address from Table1
Second query :
Select date2, nameofemployee, address from Table2
Syntax is :
Query1
UNION
Query2
Actual:
Select date, name, address from Table1
UNION
Select date2, nameofemployee, address from Table2
The result will combine Table1 and Table2.
Note : all field must be the same datatype: example you cant UNION date with text.
Hope it very clear to you.
regards,
Clint
Similar Messages
-
BO Edge 3.1 run Crystal Report with sub query or Union
I have some reports with subquery and union SQL Command and put them in SAP BO Edge 3.1 server. The results are very disappointed. I scheduled 3 instances of the same report to run at 5:30 a.m. . When I used the Crystal Report 2008 to run the report, it took only 3 minutes. One instance took several minutes but other two never came back. When I came back to the office at 8:30 a.m., they were still running. What is the problem with SAP BO Edge? Any solution? the reports are very important and I have to get up at 5:30 a.m. to check to see the result and re run as needed. Any suggestion?
Thanks.Look at the errors in each instance to help determine the cause
-
Regarding LOV's in Crystal Reports- Business View
Post Author: crystalappu
CA Forum: General
Hi All, I have developed a Business View for our crystal reports, We have like two levels of cascading prompting. In which the user can select ALL option in drop down LOV's in second level. I have added an 'all' object using command object in Business View. But when my Crystal report Developer is accesing my LOV prompt Group he is unable to see ALL in drop down LOV. But when i browse field in my command object i can see my 'ALL' object in it. Any idea upon this?Post Author: synapsevampire
CA Forum: General
Perhaps you should post an example or explain using technical information how you added this command object?
Did you use a UNION ALL?
-k -
Print multiple copies in Crystal Report
Hi All,
I have created layouts with Crystal 2008 . I need to print first copy as original , second as duplicate and the third as triplicate . I know it is possible using PLD but i need it in CR. Is there any work-around for this problem ? I am using SAP Business One 8.8 PL 10 , Crystal Reports Basic 2008 and SQL Server 2008.
Thanks in advance
Regards
ARUNHi Arun
Create a view which has a record for each copy and the docentry. I tested using the view below but it could easily be extended to include the object type and be useful for all documents.
CREATE VIEW [dbo].[Test_Copy]
AS
select 1 as 'CopyNo',
'Original' AS 'CopyDesc',
DocEntry AS 'InvDocentry'
from oinv
union
select 2 as 'CopyNo',
'Duplicate' AS 'CopyDesc',
DocEntry AS 'InvDocentry'
from oinv
union
select 3 as 'CopyNo',
'Triplicate' AS 'CopyDesc',
DocEntry AS 'InvDocentry'
from oinv
Add this view to your layout and inner join to docentry of the OINV table
Add the copy number as the main group level, before the document etc.
You will then need to fiddle around setting the current page header details into the group 1 header and sort the paging out but you will get 3 copies.
Hope this helps
Rob -
How can I search multiple columns in a SQL command of Union tables
Hi:
We have a database with tables that are nearly identical that we use for production and production history.
I have created an SQL command in Crystal 2008 to joins several of the tables and then added a "UNION" to connect the History and Prod tables.
I need to search multiple (3 total) columns for 5 different data types, to return the records being investigated. I tried this using an "OR" statement in the where clause and have had inconsistant results.
The first two or statement function perfectly the third works as long as the value being passed is numeric and the last two fail consistantly with invalid column name errors. It appears that crystal is getting confused and passing the wrong data type especially if I do a new search using a different option for the "?SearchParam"
Can some one offer some insite on how I can search these fields to return the record data needed
-- {?SearchParam} is the search parameter passed by Crystal that is a number 1 thru 5
-- {?Search_Val} is a parameter that is passed by Crystal that is a string of what to search for 1 = Numeric CMP ord #("TBSLI21"."LI21_OR_NO"), 2 = Numeric CI ord # ( "TBSLI33"."LI33_CI_OR_NO"),
-- 3 =String Ext Sys ord string ("TBSLI33"."LI33_EXT_SYS_SL_OR_NO"), 4 = String CMP Grp string ("TBSLI21"."LI21_OP_GRP_NO"), 5 = composit string PP ord string ("TBSOP13"."OP13_CLR_DAY" & "TBSOP13"."OP13_PP_GRP_SEQ_NO" & "TBSOP13"."OP13_CELL_ID")
SELECT "TBSLI21"."LI21_OR_NO",
"TBSLI21"."LI21_SH_DT_SCDL",
"TBSLI21"."LI21_TS_EN_ORIG",
"TBSLI21"."LI21_TS_SHIP",
"TBSLI21"."LI21_SYS_ORD_CD",
"TBSLI21"."LI21_SHIP_ID",
"TBSLI21"."LI21_WRKST_ID",
"TBSLI21"."LI21_LI_NO",
"TBSLI33"."LI33_CI_OR_NO",
"TBSLI33"."LI33_EXT_SYS_SL_OR_NO",
"TBSLI21"."LI21_OP_GRP_NO",
"TBSLI21"."LI21_LI_STAT",
"TBSOP13"."OP13_OP_GRP_STAT",
"TBSLI31"."LI31_LI_EV_DTL_TX",
"TBSLI31"."LI31_DT_EN",
"TBSLI31"."LI31_TM_EN",
"TBSLI31"."LI31_LI_EV",
"TBSLI21"."LI21_OP_WSH_FLNM",
"TBSLI21"."LI21_PR_ITF_CD",
"TBSLI21"."MFG_PLANT_CD",
"MFG_PLANT_LI"."MFG_PLANT_CD" as PrefPlant,
"TBSOP13"."OP13_OP_GRP_DSP_CD",
"TBSLI21"."LI21_LI_DSP_CD",
"TBSOP13"."OP13_CLR_DAY",
"TBSOP13"."OP13_PP_GRP_SEQ_NO",
"TBSOP13"."OP13_CELL_ID",
"MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG",
"TBSLI21"."LI21_OP_GRP_PS_NO1",
"TBSLI21"."LI21_POMS_MERGE_NO",
"TBSLI31"."LI31_OP_ID",
"TBSLI21"."LI21_LI_POR_FG",
"TBSLI21"."LI21_BIN_ID",
"TBSLI21"."LI21_TS_MRSHL",
"TBSLI33"."LI33_CI_LI_NO",
"TBSLI33"."LI33_SH_ADDR_1",
"TBSLI33"."LI33_SH_ADDR_2",
"TBSLI33"."LI33_SH_ADDR_3",
"TBSLI33"."LI33_SH_ADDR_4",
"TBSLI33"."LI33_SH_CITY_NM",
"TBSLI33"."LI33_SH_ST_NM",
"TBSLI33"."LI33_SH_ZIP_CD",
"TBSLI33"."LI33_CU_NM",
"TBSLI33"."LI33_CU_BUS_NM"
FROM ((("CMPREPORTING"."dbo"."TBSLI33" "TBSLI33" FULL OUTER JOIN "CMPREPORTING"."dbo"."TBSLI21" "TBSLI21" ON ("TBSLI33"."LI33_BS_OR_NO"="TBSLI21"."LI21_OR_NO") AND ("TBSLI33"."LI33_BS_LI_NO"="TBSLI21"."LI21_LI_NO")) LEFT OUTER JOIN "CMPREPORTING"."dbo"."TBSOP13" "TBSOP13" ON "TBSLI21"."LI21_OP_GRP_NO"="TBSOP13"."OP13_OP_GRP_NO") LEFT OUTER JOIN "CMPREPORTING"."dbo"."TBSLI31" "TBSLI31" ON ("TBSLI21"."LI21_OR_NO"="TBSLI31"."LI31_OR_NO") AND ("TBSLI21"."LI21_LI_NO"="TBSLI31"."LI31_LI_NO")) LEFT OUTER JOIN "CMPREPORTING"."dbo"."MFG_PLANT_LI" "MFG_PLANT_LI" ON ("TBSLI21"."LI21_OR_NO"="MFG_PLANT_LI"."OR_NO") AND ("TBSLI21"."LI21_LI_NO"="MFG_PLANT_LI"."LI_NO")
WHERE {?aSearchParam} = 1 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI21"."LI21_OR_NO"=Cast( {?Search_Val} as Int)
or {?aSearchParam} = 2 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI33"."LI33_CI_OR_NO"=Cast( {?Search_Val} as numeric(12,0))
or {?aSearchParam} = 3 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(20),"TBSLI33"."LI33_EXT_SYS_SL_OR_NO")= Convert( VarChar(20), {?Search_Val})
or {?aSearchParam} = 4 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8),"TBSLI21"."LI21_OP_GRP_NO") = Convert( VarChar(8), {?GroupNo})
or {?aSearchParam} = 5 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8), ("TBSOP13"."OP13_CLR_DAY" & "TBSOP13"."OP13_PP_GRP_SEQ_NO" & "TBSOP13"."OP13_CELL_ID")) = Convert( VarChar(8), {?GroupNo})
Union
SELECT "TBSLI21_HIST"."LI21_OR_NO",
"TBSLI21_HIST"."LI21_SH_DT_SCDL",
"TBSLI21_HIST"."LI21_TS_EN_ORIG",
"TBSLI21_HIST"."LI21_TS_SHIP",
"TBSLI21_HIST"."LI21_SYS_ORD_CD",
"TBSLI21_HIST"."LI21_SHIP_ID",
"TBSLI21_HIST"."LI21_WRKST_ID",
"TBSLI21_HIST"."LI21_LI_NO",
"TBSLI33_HIST"."LI33_CI_OR_NO",
"TBSLI33_HIST"."LI33_EXT_SYS_SL_OR_NO",
"TBSLI21_HIST"."LI21_OP_GRP_NO",
"TBSLI21_HIST"."LI21_LI_STAT",
"TBSOP13_HIST"."OP13_OP_GRP_STAT",
"TBSLI31_HIST"."LI31_LI_EV_DTL_TX",
"TBSLI31_HIST"."LI31_DT_EN",
"TBSLI31_HIST"."LI31_TM_EN",
"TBSLI31_HIST"."LI31_LI_EV",
"TBSLI21_HIST"."LI21_OP_WSH_FLNM",
"TBSLI21_HIST"."LI21_PR_ITF_CD",
"TBSLI21_HIST"."MFG_PLANT_CD",
"MFG_PLANT_LI_HIST"."MFG_PLANT_CD",
"TBSOP13_HIST"."OP13_OP_GRP_DSP_CD",
"TBSLI21_HIST"."LI21_LI_DSP_CD",
"TBSOP13_HIST"."OP13_CLR_DAY",
"TBSOP13_HIST"."OP13_PP_GRP_SEQ_NO",
"TBSOP13_HIST"."OP13_CELL_ID",
"MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG",
"TBSLI21_HIST"."LI21_OP_GRP_PS_NO1",
"TBSLI21_HIST"."LI21_POMS_MERGE_NO",
"TBSLI31_HIST"."LI31_OP_ID",
"TBSLI21_HIST"."LI21_LI_POR_FG",
"TBSLI21_HIST"."LI21_BIN_ID",
"TBSLI21_HIST"."LI21_TS_MRSHL",
"TBSLI33_HIST"."LI33_CI_LI_NO",
"TBSLI33_HIST"."LI33_SH_ADDR_1",
"TBSLI33_HIST"."LI33_SH_ADDR_2",
"TBSLI33_HIST"."LI33_SH_ADDR_3",
"TBSLI33_HIST"."LI33_SH_ADDR_4",
"TBSLI33_HIST"."LI33_SH_CITY_NM",
"TBSLI33_HIST"."LI33_SH_ST_NM",
"TBSLI33_HIST"."LI33_SH_ZIP_CD",
"TBSLI33_HIST"."LI33_CU_NM",
"TBSLI33_HIST"."LI33_CU_BUS_NM"
FROM ((("CMPREPORTING"."dbo"."TBSLI33_HIST" "TBSLI33_HIST" FULL OUTER JOIN "CMPREPORTING"."dbo"."TBSLI21_HIST" "TBSLI21_HIST" ON ("TBSLI33_HIST"."LI33_BS_OR_NO"="TBSLI21_HIST"."LI21_OR_NO") AND ("TBSLI33_HIST"."LI33_BS_LI_NO"="TBSLI21_HIST"."LI21_LI_NO")) LEFT OUTER JOIN "CMPREPORTING"."dbo"."TBSOP13_HIST" "TBSOP13_HIST" ON "TBSLI21_HIST"."LI21_OP_GRP_NO"="TBSOP13_HIST"."OP13_OP_GRP_NO") LEFT OUTER JOIN "CMPREPORTING"."dbo"."TBSLI31_HIST" "TBSLI31_HIST" ON ("TBSLI21_HIST"."LI21_OR_NO"="TBSLI31_HIST"."LI31_OR_NO") AND ("TBSLI21_HIST"."LI21_LI_NO"="TBSLI31_HIST"."LI31_LI_NO")) LEFT OUTER JOIN "CMPREPORTING"."dbo"."MFG_PLANT_LI_HIST" "MFG_PLANT_LI_HIST" ON ("TBSLI21_HIST"."LI21_OR_NO"="MFG_PLANT_LI_HIST"."OR_NO") AND ("TBSLI21_HIST"."LI21_LI_NO"="MFG_PLANT_LI_HIST"."LI_NO")
WHERE {?aSearchParam} = 1 and "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI21_HIST"."LI21_OR_NO"= Cast( {?Search_Val} as Int)
or {?aSearchParam} = 2 and "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI33_HIST"."LI33_CI_OR_NO"= Cast( {?Search_Val} as numeric(12,0))
or {?aSearchParam} = 3 and "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(20), "TBSLI33_HIST"."LI33_EXT_SYS_SL_OR_NO")= Convert( VarChar(20),{?Search_Val})
or {?aSearchParam} = 4 and "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8),"TBSLI21_HIST"."LI21_OP_GRP_NO")= Convert( VarChar(8), {?GroupNo} )
or {?aSearchParam} = 5 and "MFG_PLANT_LI_HIST"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8), ("TBSOP13_HIST"."OP13_CLR_DAY" & "TBSOP13_HIST"."OP13_PP_GRP_SEQ_NO" & "TBSOP13_HIST"."OP13_CELL_ID")) = Convert( VarChar(8), {?GroupNo})This is actually a fairly easy fix - because of the way the "OR" works in SQL, you need to surround each "set" of statements in the or with parentheses. So, it would look something like this:
Where
({?aSearchParam} = 1 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI21"."LI21_OR_NO"=Cast( {?Search_Val} as Int))
or
({?aSearchParam} = 2 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND "TBSLI33"."LI33_CI_OR_NO"=Cast( {?Search_Val} as numeric(12,0)))
or
({?aSearchParam} = 3 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(20),"TBSLI33"."LI33_EXT_SYS_SL_OR_NO")= Convert( VarChar(20), {?Search_Val}))
or
({?aSearchParam} = 4 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8),"TBSLI21"."LI21_OP_GRP_NO") = Convert( VarChar(8), {?GroupNo}))
or
({?aSearchParam} = 5 and "MFG_PLANT_LI"."PRFR_MFG_PLANT_FLG"='Y' AND Convert( VarChar(8), ("TBSOP13"."OP13_CLR_DAY" & "TBSOP13"."OP13_PP_GRP_SEQ_NO" & "TBSOP13"."OP13_CELL_ID")) = Convert( VarChar(8), {?GroupNo}))
-Dell -
Report containing 15 sub reports crashing - Crystal Reports 2008
I am using Crystal report 2008 with all latest service packs applied. I have more then 20 different reports wich work absolutely fine and never crash. One of my report contains 15 sub reports since its bringing data from 15 different queries. This consistently keeps crashing everytime I try to run it. Not sure what could be the root cause.
We are using Postgres database and connected to it with ODBC connection using Microsoft DSN.
- All Subreport data is being displayed on Report Footer
- All subreports are included in the Main report page header section. (I have also tried doing it on report footer section but it still crashes)
I have tried searching through the forum and did not find similar issue resolutions. Did someone face similar problems before?
The crash message is:
"crw32.exe has encountered a problem and needs to close. We are sorry of the inconvenience."
Error report contains this data:
AppName: crw32.exe AppVer: 12.2.0.290 ModName: psqlodbc35w.dll
ModVer: 9.0.2.0 Offset: 0004c538
I am using Windows XP
Crystal Report Version Details:
CR Developer Version 12.2.0.290
Product Type: Full
Let me know how can I debug this issue? Any help is appreciated.@Don - We performed extensive testing for this crash issue and found that now this crash is not happening only in one scenario. So we have partially fixed this.
Now the report crashes if I get disconnected from database and reconnect. This is what happens
1. open the report in crystal report 2008
2. try to run the report when db is connected- it works fine.
3. Now disconnect the database (we are using ssh tunnel to connect to db so we just close the tunnel)
4. now try to refresh the report - it fails to retrieve data.
5. Now close the report without saving it.
6. Now Close Crystal Report.
7. Now Connect the DB using ssh tunnel so crystal report can connect.
8. Now open Crystal Report
9. Launch the target report.
10 Preview the report - it works for first time.
11. Now do a refresh keeping same parameters - Report crashes here.
- I tried these steps with some of my other reports and they do not crash.
- Now I have only one report which contains a Postgres Query with date range,order by and a union join.
- No subreports now - I am trying to run this one subreport as a standalone report which I created from scratch(using blank report wizard) and just copied the query.
Any more pointers would help. -
How to setup the drill down on union report
Hi,
I'm setting the union report.
I want to set the drill down to another report.
But I can't setup it.
Would you please tell me how to setup.
Thank you.Hi Hemlatha
In Crystal Reports, to prevent the ability to drill down into a subreport when published on the Web, add a text object that is filled with blank spaces, created by pressing the 'Space Bar' and 'Enter' for line returns, to eclipse the subreport.
This workaround is applicable only to subreports that does not grow in size. For example, subreports that display only a chart or graph.
Steps to Add a Text Object over a Subreport
1. In the Crystal Reports Designer of the main report, insert a text object over the subreport.
2. Resize the text object to be the same size or a little larger than the subreport object on the main report.
3. Fill the text object with blank spaces created by pressing the 'Space Bar' and 'Enter'. This is necessary because resizing a text object without
the blank spaces will not maintain its size when it has been published on the Web.
====================
NOTE:
You can format the text object with a hyperlink to another report, another file or a URL.
====================
Now, when the Crystal report is previewed on the Web, the text object that fully eclipses the subreport will prevent the ability to drill down into it.
Regards
Girish -
SAP B1 crystal report: Customer Receivable Aging report
Hi All, I want to write a Customer Receivable Aging report in crystal report. I was using query to union open AR crdit memo and AR invoice. but, I foggot to add incomming payment ORCT. I really have trouble to get Customer Receivable Aging report . Can anyone help me? thanks Is that I did in wrong direction?
SELECT OINV.DocEntry,OINV.DocNum,OINV.ObjType,OINV.CardCode,OCRD.CntctPrsn,OCRD.fax,OINV.NumAtCard,OINV.Address,OCTG.PymntGroup
,OINV.CardName,OINV.DocDate,OINV.DocDueDate,OINV.DocCur,OINV.DocTotalFC,
OINV.DocTotal, (OINV.DocTotal-OINV.PaidToDate) as AmountAUD
FROM SAPLIVE.dbo.OINV OINV join SAPLIVE.dbo.OCTG OCTG
On OINV.GroupNum=OCTG.GroupNum
join SAPLIVE.dbo.OCRD OCRD
On OINV.CardCode=OCRD.CardCode
WHERE OINV.CANCELED='N' AND OINV.DocStatus='O' AND (OINV.DocTotal-OINV.PaidToDate)>0
union
SELECT ORIN.DocEntry,ORIN.DocNum,ORIN.ObjType,ORIN.CardCode,OCRD.CntctPrsn,OCRD.fax,ORIN.NumAtCard,ORIN.Address,OCTG.PymntGroup
,ORIN.CardName,ORIN.DocDate,ORIN.DocDueDate,ORIN.DocCur,ORIN.DocTotalFC,
ORIN.DocTotal,(ORIN.DocTotal-ORIN.PaidToDate)as AmountAUD
FROM SAPLIVE.dbo.ORIN ORIN join SAPLIVE.dbo.OCTG OCTG
On ORIN.GroupNum=OCTG.GroupNum
join SAPLIVE.dbo.OCRD OCRD
On ORIN.CardCode=OCRD.CardCode
WHERE ORIN.CANCELED='N' AND ORIN.DocStatus='O' AND (ORIN.DocTotal-ORIN.PaidToDate)Hello Julian - maybe you can start with the JDT1 table which contains all of the General Ledger Journal Entries...
Hope this helps...
Regards - Zal
--F-BP AR Aging Report Detail Ver 1 ZP 2011 04 16
--DESCRIPTION: SQL uses General Ledger Detail to create an Aging Report which shows
actual invoices, credit memos, and payments by reference date in the JDT1 table.
--AUTHOR(s):
--Version 1 Zal Parchem 16 April 2011
SELECT
T1.CardCode AS 'Cust Num',
T1.CardName AS 'Cust Name',
T0.SysDeb AS 'Debit Amt',
T0.SysCred * -1 AS 'Credit Amt',
CASE
WHEN T0.TransType = 13 THEN 'AR Invoice'
WHEN T0.TransType = 14 THEN 'AR Cred Memo'
WHEN T0.TransType = 24 THEN 'Payment'
ELSE 'Other'
END AS 'Trans Type',
T0.Ref1 AS 'Reference',
FcCurrency AS 'Currency',
CONVERT(VARCHAR(10), RefDate, 103) 'Posting Date',
CONVERT(VARCHAR(10), DueDate, 103) 'Due Date',
CONVERT(VARCHAR(10), TaxDate, 103) 'Doc Date' ,
CASE
WHEN (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 < 31 THEN
CASE
WHEN SysCred < > 0 THEN SysCred * -1
ELSE SysDeb
END
END AS '0-30 Days',
CASE
WHEN (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 > 30
AND (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 < 61 THEN
CASE
WHEN SysCred < > 0 THEN SysCred * -1
ELSE SysDeb
END
END AS '31 to 60 Days',
CASE
WHEN (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 > 60
AND (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 < 91 THEN
CASE
WHEN SysCred < > 0 THEN SysCred * -1
ELSE SysDeb
END
END AS '61 to 90 days',
CASE
WHEN (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 > 90
AND (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 < 121 THEN
CASE
WHEN SysCred < > 0 THEN SysCred * -1
ELSE SysDeb
END
END AS '90 to 120 Days',
CASE
WHEN (DATEDIFF(DD,RefDate,Current_Timestamp)) +1 > 120
THEN
CASE
WHEN SysCred != 0 THEN SysCred * -1
ELSE SysDeb
END
END AS '120 Plus Days'
FROM JDT1 T0
INNER JOIN OCRD T1
ON T0.ShortName = T1.CardCode
AND T1.CardType = 'C'
WHERE
T0.IntrnMatch = '0'
AND T0.BalDueDeb != T0.BalDueCred
ORDER BY
T1.CardCode,
T0.TaxDate
FOR BROWSE -
How to use union statement with declare & set function?
Hi Experts,
i have small query about how to use union statement with declare & set function?
Example as below :
DECLARE @name AS date
Declare @name2 AS date
/* SELECT FROM [2013].[dbo].[OINV] T0 */
/* WHERE */
SET @name = /* T0.DocDate */ '[%1]'
SET @name2 = /* T0.DocDate */ '[%2]'
select '2013',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
datediff(dd,t3.DocDate,t1.Docdate) as Days
from 2013.dbo.orct t1
inner join 2013.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
left join 2013.dbo.oinv t3 on
t3.docentry = t2.baseAbs
inner join 2013.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
inner join [2013].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
where t2.DcntSum <> 0.000000 and t3.DocDate between [%1] and [%2]
Union
/* SELECT FROM [2014].[dbo].[OINV] T0 */
/* WHERE */
SET @name = /* T0.DocDate */ '[%1]'
SET @name2 = /* T0.DocDate */ '[%2]'
select '2014',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
datediff(dd,t3.DocDate,t1.Docdate) as Days
from 2014.dbo.orct t1
inner join 2014.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
left join 2014.dbo.oinv t3 on
t3.docentry = t2.baseAbs
inner join 2014.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
inner join [2014].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
where t2.DcntSum <> 0.000000 and t3.DocDate between [%1] and [%2]You have to create stored procedure in SQL only .
Like u must have create for Crystal .
You can execute procedure in query manager but you have to enter parameter manually..
example
Exec @Test '20140101' '20140501'
Every time user has to enter it manually in yyyymmdd format in case of date parameters.
Example
Create Proc [@Test]
as begin
DECLARE @name AS date
Declare @name2 AS date
/* SELECT FROM [2013].[dbo].[OINV] T0 */
/* WHERE */
select '2013',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
datediff(dd,t3.DocDate,t1.Docdate) as Days
from 2013.dbo.orct t1
inner join 2013.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
left join 2013.dbo.oinv t3 on
t3.docentry = t2.baseAbs
inner join 2013.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
inner join [2013].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
where t2.DcntSum <> 0.000000 and t3.DocDate between @Name and @Name2
Union
/* SELECT FROM [2014].[dbo].[OINV] T0 */
/* WHERE */
select '2014',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
datediff(dd,t3.DocDate,t1.Docdate) as Days
from 2014.dbo.orct t1
inner join 2014.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
left join 2014.dbo.oinv t3 on
t3.docentry = t2.baseAbs
inner join 2014.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
inner join [2014].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
where t2.DcntSum <> 0.000000 and t3.DocDate between
between @Name and @Name2
end -
Re: Crystal Reports 5.0 (32-Bit) and Forte 2.0H16 on NT3.51
Dear Silke,
Crystal's default for identifying a table in the report design is
<schema>.<table>. You can change that by going to the Database Location menu
item and cutting the schema prefix off. You should do that for every table in
the report. The PESetNthTableLogOnInfo function will, I believe, not change
the schema prefix of a table, since it assumes you really want that schema,
i.e., as an override. Also, if you are using the propagateAcrossAllTables
feature of the function make sure that every table has the schema prefix cut
off, otherwise those tables will be skipped, since the propagate feature applies
to all other similar tables only. For example, some of the tables could be
Sybase, etc.
I believe you can change the default behaviour of the CR Report Designer in the
File->Preferences menu, so that when reports are designed the schema prefix is
not automatically attached.
I have compiled some guidelines on designing reports to make them work properly
with Forte. I will try to send them to you next week. Crystal Reports and its
C API are a good product, and you will get good performance once the report
design is set up properly.
Yours very sincerely, John Hodgson.
Schulte, Silke (DVD) wrote:
The problem seems to be, that Crystal stores the database name in the
report. If you want to change the database you have to develop your
report new, although you give the connection-information via the API.
The hotline from Crystal told us, when using subreports you have to use
the PESetNthTableLogOnInfo and to go through all the subreports and
change the connect-string.
Our experience is, you have to do both: change the report and call the
other function for the subreports.
Thank you very much for all the tips.
Regards
Silke Schulte
Union-Investment, Frankfurt / Main, Germany
e-mail: [email protected]
From: Ajith Kallambella M[SMTP:[email protected]]
Sent: Mittwoch, 23. September 1998 15:17
To: [email protected]; ForteUsers; [email protected]
Subject: RE: Crystal Reports 5.0 (32-Bit) and Forte 2.0H16 on NT
3.51
Hi There,
Crystal reports stores Database name as a hard-coded
value in the
report template. So if you have to use an other
database, you will
have to open the report template and modify the
database name. I
think this is why you are getting Crystal API error.
Hope this helps!
Ajith Kallambella M
Forte systems Engineer,
International Business Corporation.
Hello,
I wonder if we have a similar problem.
We are using Crystal Reports 5 and Forte 3.0.F.2. For
the interface
between Forte and Crystal we have in Forte a Lib using
C-wrappering to
the C-API of Crystal.
We have developed a report on a database in our
development-environment. This report comes up with data
and works
correct. It's no different if we have saved the report
in Crystal with
data or without.
If we want to use the same report on another database
in our
test-environment the window from crystal reports comes
up and when
starting there is an error from the Crystal API
function.
Both environments use the same version of an Oracle
Database and are on
Open VMS. The client for the test is in this case
always the same.
From the C-API we use the method PEStartPrintJob after
we have specified
the rest for the report.
Is there a possibility that this is the same error you
mentioned? Or do
you have any other ideas?
Any help is appreciated.
Regards
Silke Schulte
Union-Investment Frankfurt (Germany)
email: [email protected]
From: Katie Carty[SMTP:[email protected]]
Reply To: Katie Carty
Sent: Montag, 21. September 1998 19:14
To: 'Tim Hagemann'; [email protected]
Subject: RE: Crystal Reports 5.0 (32-Bit) and Forte2.0H16 on NT
3.51
Tim,
You need to upgrade to CrystalReports 6.0. There isa bug in the
interaction between Forte and CrystalReports 5.0 (Idon't know on
which side the bug resides, but I think that it is onthe Crystal end,
since the problem occurs both through C-wrapperingand OLE
interaction), which does not allow you to invoke thePrintReport
method unless you have saved data with the report.
As far as I know, there is no workaround, and theonly solution is to
upgrade to CrystalReports 6.0.
FYI, there is no ActiveX control supplied withCrystalReports 5.0 -
you are actually using standard OLE integration.
Hope this helps...
Regards,
-Katie
-----Original Message-----
From: Tim Hagemann [SMTP:[email protected]]
Sent: Monday, September 21, 1998 11:27 AM
To: [email protected]
Subject: Crystal Reports 5.0 (32-Bit) and Forte2.0H16 on NT 3.51
Hi Forte-User !
We got a big problem here using the crystal active-xcontrol. On my
windows-nt 4.0 machine (with
crystal reports installed completely) all works well.On our test
machine (with only the crystal ActiveX
installed), the Forte runtime shuts down afterinvoking a special
method of the ocx (PrintReport).
The cause for shutting down (no stacktrace orsomething like that) is
a generated c++ exception in crystal -
but we don't know the cause of this exception.
Has anyone made the control work under nt 3.51 ? Doesanybody know
(exactly) what dll's we'll have
to use ?
TIA,
Tim Hagemann
Tim Hagemann
Ascom GmbH Email:
[email protected]
Charlottenburger Allee 61 Phone: +49241 96806 273
D-52068 Aachen Fax: +49241 96806 225
>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive
<URL:http://pinehurst.sageit.com/listarchive/>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive
<URL:http://pinehurst.sageit.com/listarchive/>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive
<URL:http://pinehurst.sageit.com/listarchive/>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>-
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>Dear Silke,
Crystal's default for identifying a table in the report design is
<schema>.<table>. You can change that by going to the Database Location menu
item and cutting the schema prefix off. You should do that for every table in
the report. The PESetNthTableLogOnInfo function will, I believe, not change
the schema prefix of a table, since it assumes you really want that schema,
i.e., as an override. Also, if you are using the propagateAcrossAllTables
feature of the function make sure that every table has the schema prefix cut
off, otherwise those tables will be skipped, since the propagate feature applies
to all other similar tables only. For example, some of the tables could be
Sybase, etc.
I believe you can change the default behaviour of the CR Report Designer in the
File->Preferences menu, so that when reports are designed the schema prefix is
not automatically attached.
I have compiled some guidelines on designing reports to make them work properly
with Forte. I will try to send them to you next week. Crystal Reports and its
C API are a good product, and you will get good performance once the report
design is set up properly.
Yours very sincerely, John Hodgson.
Schulte, Silke (DVD) wrote:
The problem seems to be, that Crystal stores the database name in the
report. If you want to change the database you have to develop your
report new, although you give the connection-information via the API.
The hotline from Crystal told us, when using subreports you have to use
the PESetNthTableLogOnInfo and to go through all the subreports and
change the connect-string.
Our experience is, you have to do both: change the report and call the
other function for the subreports.
Thank you very much for all the tips.
Regards
Silke Schulte
Union-Investment, Frankfurt / Main, Germany
e-mail: [email protected]
From: Ajith Kallambella M[SMTP:[email protected]]
Sent: Mittwoch, 23. September 1998 15:17
To: [email protected]; ForteUsers; [email protected]
Subject: RE: Crystal Reports 5.0 (32-Bit) and Forte 2.0H16 on NT
3.51
Hi There,
Crystal reports stores Database name as a hard-coded
value in the
report template. So if you have to use an other
database, you will
have to open the report template and modify the
database name. I
think this is why you are getting Crystal API error.
Hope this helps!
Ajith Kallambella M
Forte systems Engineer,
International Business Corporation.
Hello,
I wonder if we have a similar problem.
We are using Crystal Reports 5 and Forte 3.0.F.2. For
the interface
between Forte and Crystal we have in Forte a Lib using
C-wrappering to
the C-API of Crystal.
We have developed a report on a database in our
development-environment. This report comes up with data
and works
correct. It's no different if we have saved the report
in Crystal with
data or without.
If we want to use the same report on another database
in our
test-environment the window from crystal reports comes
up and when
starting there is an error from the Crystal API
function.
Both environments use the same version of an Oracle
Database and are on
Open VMS. The client for the test is in this case
always the same.
From the C-API we use the method PEStartPrintJob after
we have specified
the rest for the report.
Is there a possibility that this is the same error you
mentioned? Or do
you have any other ideas?
Any help is appreciated.
Regards
Silke Schulte
Union-Investment Frankfurt (Germany)
email: [email protected]
From: Katie Carty[SMTP:[email protected]]
Reply To: Katie Carty
Sent: Montag, 21. September 1998 19:14
To: 'Tim Hagemann'; [email protected]
Subject: RE: Crystal Reports 5.0 (32-Bit) and Forte2.0H16 on NT
3.51
Tim,
You need to upgrade to CrystalReports 6.0. There isa bug in the
interaction between Forte and CrystalReports 5.0 (Idon't know on
which side the bug resides, but I think that it is onthe Crystal end,
since the problem occurs both through C-wrapperingand OLE
interaction), which does not allow you to invoke thePrintReport
method unless you have saved data with the report.
As far as I know, there is no workaround, and theonly solution is to
upgrade to CrystalReports 6.0.
FYI, there is no ActiveX control supplied withCrystalReports 5.0 -
you are actually using standard OLE integration.
Hope this helps...
Regards,
-Katie
-----Original Message-----
From: Tim Hagemann [SMTP:[email protected]]
Sent: Monday, September 21, 1998 11:27 AM
To: [email protected]
Subject: Crystal Reports 5.0 (32-Bit) and Forte2.0H16 on NT 3.51
Hi Forte-User !
We got a big problem here using the crystal active-xcontrol. On my
windows-nt 4.0 machine (with
crystal reports installed completely) all works well.On our test
machine (with only the crystal ActiveX
installed), the Forte runtime shuts down afterinvoking a special
method of the ocx (PrintReport).
The cause for shutting down (no stacktrace orsomething like that) is
a generated c++ exception in crystal -
but we don't know the cause of this exception.
Has anyone made the control work under nt 3.51 ? Doesanybody know
(exactly) what dll's we'll have
to use ?
TIA,
Tim Hagemann
Tim Hagemann
Ascom GmbH Email:
[email protected]
Charlottenburger Allee 61 Phone: +49241 96806 273
D-52068 Aachen Fax: +49241 96806 225
>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive
<URL:http://pinehurst.sageit.com/listarchive/>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive
<URL:http://pinehurst.sageit.com/listarchive/>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive
<URL:http://pinehurst.sageit.com/listarchive/>
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>-
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/> -
Crystal 8.5! Set table locations at run time to queries
Hopefully some people still remember version 8.5...
I have a number of reports which all work from a single database, this can be either Access or SQL Server, I'm currently testing on Access. I would like to use the same reports but print them for multiple databases, all of which have the same schema. To do this I'm creating UNION queries in one of the databases and I now want to change the location of the tables in the report to use these union queries instead.
For example, say the report uses table "Customer" in db1 but I have also have db2 and db3 with the same table, I'm enumerating all fields used in the report and creating a union in db1 something like:
SELECT field1, field2 FROM Customer IN 'db1.mdb'
UNION SELECT field1, field2 FROM Customer IN 'db2.mdb'
UNION SELECT field1, field2 FROM Customer IN 'db3.mdb'
Now I've tested this in Crystal Reports itself, i.e. setting the location to the new tables, and it works OK. I'm having to use an OLEDB connection otherwise the links get removed. When I try to set the location in code I just get no data on the report even though there is data available.
In code I'm going through all tables (and all tables in all sub reports) and I've tried setting the Location property to the name of the union, I've tried SetTableLocation "<path to db>", "<union name>" and I've tried both using SetLogOnInfo "<path to db>" as well.
I'm thinking perhaps converting the report to active data and plugging in an ADO recordset could be a solution but I'm not sure how feasible that is from code (i.e. converting the database driver from either pdsoledb.dll or pdbdao.dll to pdsmon.dll and creating a ttx on the fly...).
Any help much appreciated.Hi,
SetTableLocation should work but you need to make sure you call it for each of the tables in the report or in this case the Union.
Just like in the report designer when you set the location you need to point to the table you want to change. Even though you get the prompt asking to set the same location for all the tables, it's doing the same thing for you.
Hope this helps,
Brian -
WITH clause, Oracle, UNION problem
I have a table with two fields, SYSTEM and DATEOPENED. It's basically a log of events.
For each row, I need to calculate how much time has elapsed between one row and the next for the same system.
Basically, when I execute this directly against the database (replacing parameters with actual TO_DATE('...','...')), this works flawlessly.
The problem when I run this in Crystal Reports is that the WHERE clause of the CUMULATIVE portion of the UNION is completely ignored. I get ALL the data from the database for the CUMULATIVE.
I inverted both portions of the UNION (DISCRETE first and CUMULATIVE second), which had the result of completely removing the CUMULATIVE portion of the result set.
I'm using Crystal Reports 11.5.0.313 (XI R2)
The query looks like this:
WITH ACCT_DATA AS (
SELECT SYSTEM, Round(DateOpened,'IW') WeekDate, Sum(IsUDRWithinThreshold) CNT_WITHINTHRESHOLD, Count(1) CNT
FROM (
SELECT SYSTEM, DateOpened, (
CASE
WHEN SYSTEM='system1' AND ((Lead (DateOpened,1) over (PARTITION BY SYSTEM ORDER BY SYSTEM, DateOpened))-DateOpened)*24 < 5 THEN 1
WHEN SYSTEM='system2' AND ((Lead (DateOpened,1) over (PARTITION BY SYSTEM ORDER BY SYSTEM, DateOpened))-DateOpened)*24 < 5 THEN 1
WHEN SYSTEM='system3' AND ((Lead (DateOpened,1) over (PARTITION BY SYSTEM ORDER BY SYSTEM, DateOpened))-DateOpened)*24 < 9 THEN 1
ELSE 0
END
) IsUDRWithinThreshold
FROM ACCT_FILES
WHERE SYSTEM IN ('system1','system2','system3')
AND Round(DateOpened,'YYYY')=Round({?ToDate},'YYYY')
GROUP BY SYSTEM, Round(DateOpened,'IW')
ORDER BY SYSTEM, Round(DateOpened,'IW')
SELECT 'CUMULATIVE' DATA_TYPE, d1.SYSTEM, d1.WeekDate, Sum(d2.CNT_WITHINTHRESHOLD) CNT_WITHINTHRESHOLD, Sum(d2.CNT) CNT
FROM ACCT_DATA d1 INNER JOIN ACCT_DATA d2 ON d1.SYSTEM=d2.SYSTEM AND d2.WeekDate<=d1.WeekDate
WHERE d1.WeekDate BETWEEN {?FromDate} AND {?ToDate}
GROUP BY d1.SYSTEM, d1.WeekDate
UNION
SELECT 'DISCRETE' DATA_TYPE, SYSTEM, WeekDate, CNT_WITHINTHRESHOLD, CNT
FROM ACCT_DATA
WHERE WeekDate BETWEEN {?FromDate} AND {?ToDate}
ORDER BY DATA_TYPE, SYSTEM, WeekDateHello,
First, you can't use that SQL directly in Crystal Reports unless you are using a Command object. In which case CR does not modify the SQL at all. It may be due to multiple results sets in which case CR will have problems logically with this type of SQL.
what happens if you use SQLPlus to test the SQL and results?
Also, before doing any of that you are using the original release of Crystal Reports XI R2. Go to the Businessobjects tab above and download SP4, full build. Easier than applying all of the incremental patches but it does require you to un-install CR first.
Test again, if you still get the same problem then do more debugging.
Also note in you reply what DB driver you are using, ODBC, OLE DB etc., and who's driver, Oracle's DataDirect, Microsoft etc.?
Thank you
Don -
Hi expert,
regarding crystal report query,im still new in crystal report,actually i want to make report join with table opor,por1,opor,oitm,oshp,nnm1,ocrn,por10 and octg.im face difficulty when want to join por10.then i join with por10.docentry = por1.docentry with table por1 and por1.visorder = por10.aftlinenum and im not sure it correct or not.im just want to make condition like this
if (T1.U_CSUS_Size = '') and (t2.LineType = 'T') then it will show (t0.U_CSUS_ItmCode + ' ' + t0.U_CSUS_ItmDescp + ' ' + t1.U_CSUS_Size) else (t0.U_CSUS_ItmCode + ' ' + t0.U_CSUS_ItmDescp) and joining (from POR1 T0
INNER JOIN OITM T1 ON T0.ItemCode = T1.ItemCode
inner join por10 T2 on T0.docentry = T2.docentry and T0.visorder = T2.aftlinenum)
for 'u_csus_.....' is for udf i created.can i know how easier step for this condition.i also already try alot of query.sometime can make duplicate column.
regards,
Arif
Edited by: Ahmad Arif on Jan 10, 2012 4:03 AMDear Anmad Arif
Try the below query
SELECT
(CASE WHEN (T1.U_CSUS_Size = '') and (t2.LineType = 'T') THEN
(t0.U_CSUS_ItmCode + ' ' + t0.U_CSUS_ItmDescp + ' ' + t1.U_CSUS_Size)AS NVARCHAR(1000))
else T1.[Dscription] End) AS [Description],
T1.VisOrder,
(CASE WHEN T1.[Quantity]<=0 THEN NULL ELSE T1.[Quantity] END) AS Qty,
CAST(ISNULL(T3.UserText, '''') AS VARCHAR(MAX)) As ItemDesc,
T1.Currency, T3.SuppCatNum,
(CASE WHEN T1.linetotal<=0 THEN NULL ELSE T1.linetotal END) as amount,
(CASE WHEN T1.[price]<=0 THEN NULL ELSE T1.[price] END) AS Rate,
T3.UserText,
T0.DocEntry,
ISNULL(T1.U_Unit, T3.SalUnitMsr) AS SaleUnit,
ISNULL(T3.BuyUnitMsr, '''') AS PurchaseUnit,T1.VisOrder,'' LineSeq,'' aftLineNum,
ISNULL(T0.U_QText,'') AS QText,T1.U_QRR as QRR
FROM OPOR T0
RIGHT OUTER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry
RIGHT OUTER JOIN OITM T3 ON T1.ItemCode = T3.ItemCode
LEFT OUTER JOIN dbo.OSCN AS T4 ON (T0.CardCode=T4.CardCode AND T1.ItemCode=T4.ItemCode)
WHERE T0.Docnum = '4063'
UNION ALL
SELECT CAST(ISNULL(T1.LineText, '') AS VARCHAR(MAX)) AS [Description],
T1.AftLineNum,
NULL Qty,
null,
null ,NULl ,NULL,
null Rate,
NULL,
T0.DocEntry,
null,
null,T1.OrderNum,T1.LineSeq,AftLineNum,'' AS BPCatlog,
null
FROM OPOR T0
RIGHT OUTER JOIN POR10 T1 ON T0.DocEntry = T1.DocEntry
WHERE T0.Docnum = '4063'
And T1.LineText IS NOT NULL
Note : Change the DocNum= DocKey When you use Crystal report As per your requied
Regards
Kamlesh -
Sales Report with Crystal Report
Dear experts,
I have a client who wants a report which shows the following on sales analysis:
Sale Employee Name, Customer Group Name, cardcode, cardname , ItemsGroup Name,
itemcode, itemname, weight, quantity, Row Total Value.
Thank you.Hi Tendayi
Not sure what the question is. Do you need help with the query, with writing the Crystal Report? What are the selection criteria, date, customer, etc.?
Here is a query to help you with the structure:
SELECT T2.SlpName, T4.GroupName, T0.CardCode, T0.CardName, T6.ItmsGrpNam,
T1.ItemCode, T1.Dscription, T5.SWeight1, T1.Quantity, T1.LineTotal
FROM OINV T0 INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN OSLP T2 ON T1.SlpCode = T2.SlpCode
INNER JOIN OCRD T3 ON T3.CardCode = T0.CardCode
INNER JOIN OCRG T4 ON T4.GroupCode = T3.GroupCode
INNER JOIN OITM T5 ON T1.Itemcode = T5.ItemCode
INNER JOIN OITB T6 ON T5.ItmsGrpCod = T6.ItmsGrpCod
WHERE T0.DocDate >= '[%0]' AND T0.DocDate <= '[%1]'
UNION ALL
SELECT T2.SlpName, T4.GroupName, T0.CardCode, T0.CardName, T6.ItmsGrpNam,
T1.ItemCode, T1.Dscription, T5.SWeight1, T1.Quantity, T1.LineTotal
FROM ORIN T0 INNER JOIN RIN1 T1 ON T0.DocEntry = T1.DocEntry
INNER JOIN OSLP T2 ON T1.SlpCode = T2.SlpCode
INNER JOIN OCRD T3 ON T3.CardCode = T0.CardCode
INNER JOIN OCRG T4 ON T4.GroupCode = T3.GroupCode
INNER JOIN OITM T5 ON T1.Itemcode = T5.ItemCode
INNER JOIN OITB T6 ON T5.ItmsGrpCod = T6.ItmsGrpCod
WHERE T0.DocDate >= '[%0]' AND T0.DocDate <= '[%1]'
ORDER BY T0.DocNum, T1.LineNum
You can run this direct in SAP query wizard to see if it is what you need before you write the Crystal Report.
Kind regards
Peter Juby -
Performance Problem between Oracle 9i to Oracle 10g using Crystal XI
We have a Crystal XI Report using ODBC Drivers, 14 tables, and one sub report. If we execute the report on an Oracle 9i database the report will complete in about 12 seconds. If we execute the report on an Oracle 10g database the report will complete in about 35 seconds.
Our technical Setup:
Application server: Windows Server 2003, Running Crystal XI SP2 Runtime dlls with Oracle Client 10.01.00.02, .Net Framework 1.1, C# for Crystal Integration, Unmanaged C++ for app server environment calling into C# through a dynamically loaded mixed-mode C++ DLL.
Database server is Oracle 10g
What we have concluded:
Reducing the number of tables to 1 will reduce the execution time of the report from 180s to 13s. With 1 table and the sub report we would get 30 seconds
We have done some database tracing and see that Crystal Reports Issues the following query when verifying the database and it takes longer in 10g vs 9i.
We have done some profiling in the application code. When we retarget the first table to the target database, it takes 20-30 times longer in 10g than in 9i. Retargeting the other tables takes about twice as long. The export to a PDF file takes about 4-5 times as long in 10g as in 9i.
Oracle 10g no longer supports the /*+ RULE */ hint.
Verify DB Query:
select /*+ RULE */ *
from
(select /*+ RULE */ null table_qualifier, o1.owner table_owner,
o1.object_name table_name, decode(o1.owner,'SYS', decode(o1.object_type,
'TABLE','SYSTEM TABLE','VIEW', 'SYSTEM VIEW', o1.object_type), 'SYSTEM',
decode(o1.object_type,'TABLE','SYSTEM TABLE','VIEW', 'SYSTEM VIEW',
o1.object_type), o1.object_type) table_type, null remarks from all_objects
o1 where o1.object_type in ('TABLE', 'VIEW') union select /*+ RULE */ null
table_qualifier, s.owner table_owner, s.synonym_name table_name, 'SYNONYM'
table_type, null remarks from all_objects o3, all_synonyms s where
o3.object_type in ('TABLE','VIEW') and s.table_owner= o3.owner and
s.table_name = o3.object_name union select /*+ RULE */ null table_qualifier,
s1.owner table_owner, s1.synonym_name table_name, 'SYNONYM' table_type,
null remarks from all_synonyms s1 where s1.db_link is not null ) tables
WHERE 1=1 AND TABLE_NAME='QCTRL_VESSEL' AND table_owner='QLM' ORDER BY 4,2,
3
SQL From Main Report:
SELECT "QCODE_PRODUCT"."PROD_DESCR", "QCTRL_CONTACT"."CONTACT_FIRST_NM", "QCTRL_CONTACT"."CONTACT_LAST_NM", "QCTRL_MEAS_PT"."MP_NM", "QCTRL_ORG"."ORG_NM", "QCTRL_TKT"."SYS_TKT_NO", "QCTRL_TRK_BOL"."START_DT", "QCTRL_TRK_BOL"."END_DT", "QCTRL_TRK_BOL"."DESTINATION", "QCTRL_TRK_BOL"."LOAD_TEMP", "QCTRL_TRK_BOL"."LOAD_PCT", "QCTRL_TRK_BOL"."WEIGHT_OUT", "QCTRL_TRK_BOL"."WEIGHT_IN", "QCTRL_TRK_BOL"."WEIGHT_OUT_UOM_CD", "QCTRL_TRK_BOL"."WEIGHT_IN_UOM_CD", "QCTRL_TRK_BOL"."VAPOR_PRES", "QCTRL_TRK_BOL"."SPECIFIC_GRAV", "QCTRL_TRK_BOL"."PMO_NO", "QCTRL_TRK_BOL"."ODORIZED_VOL", "QARCH_SEC_USER"."SEC_USER_NM", "QCTRL_TKT"."DEM_CTR_NO", "QCTRL_BA_ENTITY"."BA_NM1", "QCTRL_BA_ENTITY_VW"."BA_NM1", "QCTRL_BA_ENTITY"."BA_ID", "QCTRL_TRK_BOL"."VOLUME", "QCTRL_TRK_BOL"."UOM_CD", "QXREF_BOL_PROD"."MOVEMENT_TYPE_CD", "QXREF_BOL_PROD"."BOL_DESCR", "QCTRL_TKT"."VOL", "QCTRL_TKT"."UOM_CD", "QCTRL_PMO"."LINE_UP_BEFORE", "QCTRL_PMO"."LINE_UP_AFTER", "QCODE_UOM"."UOM_DESCR", "QCTRL_ORG_VW"."ORG_NM"
FROM (((((((((((("QLM"."QCTRL_TRK_BOL" "QCTRL_TRK_BOL" INNER JOIN "QLM"."QCTRL_PMO" "QCTRL_PMO" ON "QCTRL_TRK_BOL"."PMO_NO"="QCTRL_PMO"."PMO_NO") INNER JOIN "QLM"."QCTRL_MEAS_PT" "QCTRL_MEAS_PT" ON "QCTRL_TRK_BOL"."SUP_MP_ID"="QCTRL_MEAS_PT"."MP_ID") INNER JOIN "QLM"."QCTRL_TKT" "QCTRL_TKT" ON "QCTRL_TRK_BOL"."PMO_NO"="QCTRL_TKT"."PMO_NO") INNER JOIN "QLM"."QCTRL_CONTACT" "QCTRL_CONTACT" ON "QCTRL_TRK_BOL"."DRIVER_CONTACT_ID"="QCTRL_CONTACT"."CONTACT_ID") INNER JOIN "QFC_QLM"."QARCH_SEC_USER" "QARCH_SEC_USER" ON "QCTRL_TRK_BOL"."USER_ID"="QARCH_SEC_USER"."SEC_USER_ID") LEFT OUTER JOIN "QLM"."QCODE_UOM" "QCODE_UOM" ON "QCTRL_TRK_BOL"."ODORIZED_VOL_UOM_CD"="QCODE_UOM"."UOM_CD") INNER JOIN "QLM"."QCTRL_ORG_VW" "QCTRL_ORG_VW" ON "QCTRL_MEAS_PT"."ORG_ID"="QCTRL_ORG_VW"."ORG_ID") INNER JOIN "QLM"."QCTRL_BA_ENTITY" "QCTRL_BA_ENTITY" ON "QCTRL_TKT"."DEM_BA_ID"="QCTRL_BA_ENTITY"."BA_ID") INNER JOIN "QLM"."QCTRL_CTR_HDR" "QCTRL_CTR_HDR" ON "QCTRL_PMO"."DEM_CTR_NO"="QCTRL_CTR_HDR"."CTR_NO") INNER JOIN "QLM"."QCODE_PRODUCT" "QCODE_PRODUCT" ON "QCTRL_PMO"."PROD_CD"="QCODE_PRODUCT"."PROD_CD") INNER JOIN "QLM"."QCTRL_BA_ENTITY_VW" "QCTRL_BA_ENTITY_VW" ON "QCTRL_PMO"."VESSEL_BA_ID"="QCTRL_BA_ENTITY_VW"."BA_ID") LEFT OUTER JOIN "QLM"."QXREF_BOL_PROD" "QXREF_BOL_PROD" ON "QCTRL_PMO"."PROD_CD"="QXREF_BOL_PROD"."PURITY_PROD_CD") INNER JOIN "QLM"."QCTRL_ORG" "QCTRL_ORG" ON "QCTRL_CTR_HDR"."BUSINESS_UNIT_ORG_ID"="QCTRL_ORG"."ORG_ID"
WHERE "QCTRL_TRK_BOL"."PMO_NO"=12345 AND "QXREF_BOL_PROD"."MOVEMENT_TYPE_CD"='TRK'
SQL From Sub Report:
SELECT "QXREF_BOL_VESSEL"."PMO_NO", "QXREF_BOL_VESSEL"."VESSEL_NO"
FROM "QLM"."QXREF_BOL_VESSEL" "QXREF_BOL_VESSEL"
WHERE "QXREF_BOL_VESSEL"."PMO_NO"=12345
Does anyone have any suggestions on how we can improve the report performance with 10g?Hi Eric,
Thanks for your response. The optimizer mode in our 9i database is CHOOSE. We changed the optimizer mode from ALL_ROWS to CHOOSE in 10g but it didn't make a difference.
While researching Metalink I came across a couple of documents that indicated performance problems and issues with using certain data-dictionary views in 10g. Apparently, the definition of ALL_OBJECTS, ALL_ARGUMENTS and ALL_SYNONYMS have changed in 10g, resulting in degradation in performance, if quieried against these views. These are the same queries that crystal reports is queriying. We'll try the workaround suggested in these documents and see if it resolves the issue.
Here are the Doc Ids, if you are interested:
Note 377037.1
Note:364822.1
Thanks again for your response.
Venu Boddu.
Maybe you are looking for
-
My MacBook (2007, late mid-year model) is overheating
My MacBook (2007, late mid-year model) is overheating and the batter cover has buckled. Now the battery does not seem to want to charge. Do I need to replace the battery? The computer? What will help? I'd like to use the computer for as long as
-
Need help in query to have all items in sap with PO data on order, date
Hello Everyone, I need some help in writing a query to show all items in sap db to have itemcode, itemname, onhand, sellable(onhand-committed), on order, and the delivery date when that time should be received. I need to know what items are regular
-
Dear Gurus, I have following qurey. 1.For Imports, Invoice verification is done twice i.e. one for Duty and another for Material Can it be clubbed and done by a single transaction. 2.In case of import verification multiple vendors are associated viz.
-
How do you keep safari in standard screen mode and avoid "full screen"
How do I keep the screen in Safari from converting from "standard screen" to "full screen"? I know how to switch back and forth between the screens on "View" "Exit Full Screen." However, I don't want to work in "full screen" and Safari automaticall
-
I had an epiphany: C++ doesn't actually suck
Yes, for a while I was a proponent of the 'C++ is for noobs, it lets you do stupid stuff, etc.' theory. This morning, I had a major facepalm moment. While C++ is often used by total idiots, that in and of itself does not make it a poor language. It f