Crystal Report Query Advice

Dear Guru,
     Please find below, two queries which I have to show simultaneously in Crystal Reports. Showing Sales and Incoming of the said month. Incoming are irrespective invoice (i.e. invoice from previous months as long as the Incoming is in the same month):
SELECT (SELECT T0.[DocDate],T0.[DocNum],  T0.[CardCode], T0.[CardName], T0.[DocTotal] FROM OINV T0),
            (SELECT T0.[DocDate],T0.[DocNum],  T0.[CardCode], T0.[CardName], T0.[DocTotal] FROM OVPM T0).
Please advice.
Faisal Baloch

Hi,
Try this...
SELECT T0.DocDate,T0.DocNum, T0.CardCode, T0.CardName,T0.DocTotal,
T1.DocNum AS ReceiptNum,T1.TaxDate AS 'RECEIPT DATE',T1.DocTotal AS 'RECEIPT AMT'  FROM OINV T0
inner join ORCT T1 on T0.ReceiptNum=T1.DOCNUM
WHERE  T0.TaxDate>='[%0]' AND T0.TaxDate<='[%1]'
Regards,
Priya

Similar Messages

  • Partial payment Crystal report query

    Hi,
    I have partial payment in outgoing. So I am not able capture this thing correctly so any one can give me the Crystal report query for this thing.
    Regards
    Swapnil

    Try this may it will help you ..
    in this query i have tracked againest PO.
    SELECT     Distinct OPOR.DocNum,OPCH.CardName,OPOR.DocNum
                          ,convert(varchar, OPCH.DocDueDate, 103) As "Payment Date",(OPCH.DocTotal-OPCH.PaidSUM) AS ' Pending Payment',DATEDIFF(DD,OPCH.DocdueDate,GETDATE()) as "Over Due Days"
    FROM         OPOR INNER JOIN
                          POR1 ON OPOR.DocEntry = POR1.DocEntry INNER JOIN
                          OPDN INNER JOIN
                          PDN1 ON OPDN.DocEntry = PDN1.DocEntry INNER JOIN
                          OPCH ON PDN1.TrgetEntry = OPCH.DocEntry INNER JOIN
                          PCH1 ON OPCH.DocEntry = PCH1.DocEntry ON POR1.TrgetEntry = OPDN.DocEntry where OPCH.DocStatus = 'O'
                          order by OPOR.DocNum ASC
    one more think we can design QPLD or CR not PLD.
    Thanks
    Manvendra singh Niranjan
    Edited by: Manvendra Singh Niranjan on Jun 25, 2011 2:57 PM
    Edited by: Manvendra Singh Niranjan on Jun 26, 2011 8:14 AM

  • Crystal Report query on top of BI Query : Exception raised in infoview

    Hi experts,
    I have created a crystal report query on ntop of a BI query and exported to BO.
      - For the BI query without variable, the crystal report runs with success in infoview and Crystal report
      -For the same BI query with a  variable, the crystal report does not run. A java exception is raised
    Please could somebody tell me what is the pb ?
    Tha

    Hi there,
    Actually i am investigating the best way to produce Cristal Clear Reports using data from BI, so Cubes, DOS, etc. As far as i know BO use BEx queries, then CR can produce Reports, but i thought it works for all cases, i mean calculation, filtering and variables.
    That's quite disapointing because i already told my client i will use his old BEx Queries to produce Reports with CR (frozen Reports), so use CR as Workbook to present them in fancy way.
    Any comments will be welcome.
    Al.

  • Using crystal reports query (.qry) as datasource in crystal 9

    I have a problem using crystal reports query as a datasource in crystal reports 9. When Im using a report withing application i cannot change database or server property of the query.
    For example - during report design im using one odbc for query but I want to change it during runtime.
    Changing any options beside username or password results in external exception. Im using Builder XE as application environment.
    I tried switching to SQL commands which works but i lose all the fields on report when changing from query to report.
    Is there a way to make query work or to change query to sql command without losing all the fields (and putting them back on the report manually)?

    Hello,
    Unfortunately .QRY files are no longer supported as of CR 9. We replaced it with the Command Object where it basically did the same thing only you had to write the query yourself.
    The problem is because the Command Object can be anything CR has no way of mapping a query to the database field within the report so it auto deletes all of the fields.
    The only way is to create new reports, you can open the original report in one window and then create your new report, copy the SQL into the Command windows and then copy and paste the report objects from the window with the old report into the new report window.
    There is no migration wizard to do this. I have heard of others who used the RAS server or RDC to get the objects from one report and .add them to the new report. Depending on the number of reports you have depends on if it is worth the time writing that app or just rebuild all of your reports.
    Thank you
    Don

  • Sale Order Query Print layout/Crystal Report Query required

    Hi Experts,
    I created a Sale Order. Items included in it are service and material.
    (I created a BOM, bound the child material item to the parent service item. Moreover child item will have unit price where as parent item will not have unit price)
    I need the report on it please let me know how i can do it.
    I tried with below query
    select a.DocEntry, a.DocNum, a.CardCode, a.CardName, b.DocEntry,b.ItemCode, b.Dscription, b.Quantity, b.Price, b.LineTotal, a.DocTotal, a.VatSum 
    from ORDR a inner join RDR1 b on a.DocEntry = b.DocEntry
    --and b.TreeType <> 'N'
    where a.docnum = '14240621'
    output of above query is
    DocEntry
    DocNum
    CardCode
    CardName
    DocEntry
    ItemCode
    Description
    Qty
    Unit Price
    Line Total
    DocTotal
    Tax Amount
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    302010001
    PROVIDING & LAYING
    17.62
    2493.76
    43940.05
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    MT0001
    Material for PROVIDING & LAYING
    17.62
    2800
    49336
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    305010005
    BM CM INCLUDING CEMENT
    10.055
    1980
    19908.9
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    MT0002
    Material for BM CM  INCLUDING CEMENT
    10.055
    1650
    16590.75
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    302040001
    P/APPLYING
    65
    116.5
    7572.5
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    MT0003
    Material for P/APPLYING
    65
    65
    4225
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    301000001
    P& FIXING
    2.233
    31625.05
    70618.74
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    MT0004
    Material for P& FIXING
    2.233
    44000
    98252
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    306010001
    PROVIDING RMC
    3
    3593
    10779
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    MT0005
    Material for PROVIDING RMC
    3
    4847
    14541
    354652
    18888.46
    and my desired output is
    Unit price of both child item and parent item should be display in single column. ie. cumulative in Unit Price Column and Linetotal respectively.
    DocEntry
    DocNum
    CardCode
    CardName
    DocEntry
    ItemCode
    Description
    Qty
    Unit Price
    Line Total
    DocTotal
    Tax Amount
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    302010001
    PROVIDING & LAYING
    17.62
    5293.76
    93276.05
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    305010005
    BM CM  INCLUDING CEMENT
    10.055
    3630
    36499.65
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    302040001
    P/APPLYING
    65
    181.5
    11797.5
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    301000001
    P& FIXING
    2.233
    75625.05
    168870.7
    354652
    18888.46
    621
    14240621
    CDR0001
    ABCDEFGH
    621
    306010001
    PROVIDING RMC
    3
    8440
    25320
    354652
    18888.46
    please let me know the update on this.
    with regards

    Hi Nagarajan,
    thanks for reply..
    1) Yes, i.e i have taken into BomType: Template
    2) i did not get any helpful output by using treetype by keeping 'S' and 'N', i kept in comment.
    3) Actually MT0001-05 - these are material item- unit prices are fixed. see in attached image
         for parent item, unit prices are not fixed. I give the price for them in Sale Order.
         I want unit price for parent and child should be summed/cumulative for Sale Order print.
         (in my above post, first matrix exactly same as sale order line items plz check it)
    Please help me, how i can achieve this by query(for PLd or Crystal report)
    With Regards

  • Crystal Report Query design

    Hello,
    I am very new to Crystal Reports and for some reason the online content for CR is abysmally low and not lucid enough in most cases.
    I am designing a simple Invoice type report in CR and am using an Access database with .accdb extension.I have been able to connect the database to my CR environment but now I am not able to design a suitable Query in CR which can enable me to display the
    Invoice.
    I have two tables in my database-InvoiceTran and InvoiceDetail.The InvoiceTran table has a primary key under which the details are saved in the InvoiceDetail table.
    What I want to be able to do in CR is to select an Invoice Number in the InvoiceTran table and then print only the related details from the InvoiceDetail table(in the Detail section of CR) along with some other fields from the InvoiceTran table.I will also
    need a SUM field in the Invoice Footer.
    It was very easy in Access reports in which a suitably designed query did the trick but for now I had to abandon it due to a designing problem that I ran into.
    Thanks in advance,
    Khalid.

    You're not finding online content here because CR is (as of VS 2010) no longer part of Visual Studio as delivered. It is a separate add-on.
    The forum where you're most likely to fin help with CR in VS is here:
    http://scn.sap.com/community/crystal-reports-for-visual-studio/content?filterID=contentstatus%5bpublished%5d~objecttype~objecttype%5bthread%5d

  • How to parse crystal report query prompt value via url parameters

    HI All,
    I am creating a employee detail report in crystal report. The recordset is huge and i have created a parameter prompts in the query and thinking to parse the prompt value via url parameters. Not sure why i still could not make it works.
    for example, in my query panel i have created a prompt called "pwwid"
    and this is how i parse the prompt value via open document url.
    OpenDocument/opendoc/openDocument.jsp?sIDType=CUID&iDocID=AV8U6HlIq4FBl_MhcBwHqGI&lsSpwwid=12345678
    I read the sap documentation, this is how it parse the prompt value via url parameter. but it is not working for me and i am getting prompt to fill in the wwid whenever i run the reports.
    any idea why i am not getting this works?
    Regards,
    KeatAun

    Could you try:
    OpenDocument/opendoc/openDocument.jsp?sIDType=CUID&iDocID=AV8U6HlIq4FBl_MhcBwHqGI&lsSpspwwid=12345678
    -Abhilash

  • Crystal Report Query taking too much time

    Hi,
    We are developing one report based on SQL Server 2008 in Crystal Report. There are around 50,000 valid combination in database. Based on dynamic filter we need to bring few records in report. Since these filters are at report level, and crystal report is using microcube, it is taking more than 15 mins to execute.
    Is there any option to fetch record based on filter applied at report level.
    Regards
    Baby

    HI,
    First of all , thank you very much.
    Since having cascading prompt, we never thought in this way.
    Details:-
    For our report we have 4 prompts.
    1. category->family-brand (cascading- mandatory)
    2. season(madatory)
    3.collection (madatory)
    4.owner(not mandatory)
    previously we set all these filters at record level.
    Now we set season and collection at query level and brand, owner at report level. Report only query for selected season and collection only.
    Thanks once again.
    Regards
    Baby

  • Crystal Report Query

    How will i implement a query like this in Crystal Report?.
    select * from a
    where a.id not exist
    (select b.id from b where a.id = b.id)

    Enter the statement in the designer, or write a stored
    procedure that performs the query and reference that in the
    designer.
    This question is best asked in a Crystal Reports forum,
    BTW.

  • Crystal Reports Query

    Gurus,
        I have an assignment of creating a report, in which I have to show the output of a single column (forgein currency payment) in multiple column currency example dollar in dollar column, euro in euro column, Rupees in rupees column etc and also how to merge two columns in the report example euro and then the euro amount. Please advice what should be done in crystal reports to get the desired result.
    Faisal

    Hi Faisal,
    the easiest way would be to group by currency.
    Just select in the menu: Insert -> Group
    Then select the currency field.
    Best regards,
    Darius

  • How to use a Crystal Reports Query as datasourc in an other Cristal Report

    Hi
    I would like to read a File in a CR Report, change some data and use the output as datasource  in an other Criystal Reports Report.
    Is ist possible to use a Crystal Reports Report as datasource for an other Crystal Reports Report?
    Thomas
    Edited by: Thomas Martin on Jul 18, 2011 12:44 PM

    Hi Thomas,
    Are you having Xcelsius also in your kitty??(for dynamically doing this activity)
    Xcelsius has very good writing & reading functionality and you can incorporate your crystal report data into it using live office.
    Let say you have a report in crystal , you connect that repot to live office .Let say this is REPORT named as SOURCE CR  REPORT.
    IN Xcelsius import the this SOURCE CR REPORT  report using live office connection and using GRID selector there to show tabular data.
    Xcelsius has buttons & controls  for updating and exporting the data inform of XML SOURCE FILE.
    Now you can either make xcelsius Dashboard for TARGET CR REPORT or you can make crystal Report on ADO.NET(XML) for second crystal Report.
    Search on SDN for cross usage of Crystal & Xcelsius
    regards,
    RK

  • Crystal report command query

    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 AM

    Dear 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

  • Performance issue - Open a Crystal Report from SAP BW

    Hi,
    I have an general question on the performance of Crystal Reports: We are using Crystal Reports 2008 SP 2 in context with SAP BW 7.0. We don't have a BO XI. We use the BW as a central storage for our reports. Now we have the problem that the opening of some reports takes a long time. For expample one report needs ~13 secound an another > 5 minutes.
    Where can be the problem? What happens in SAP BW when a report is called? And what can we do to make it faster?
    Thanks for your informations!

    Hi Ingo,
    the value of MaxPickListSize is "c8".
    Yesterday I have spent a lot of time to find the bottleneck. I have traced the SQL statements, which are performed from Crystal Reports / Integration Kit when I open a report. It might be the values for the parameters. That's our situation:
    Crystal Reports
           |
    Query (restriced on Cube 1)
           |
    MultiProvider
      - Cube 1
      - Cube 2
      - Cube 3
      - DSO 1
    The slow report is based on the BW Query and in the filter restricted to the Cube 1. If I open the report, all values for the parameters are read from all the InfoProviders under the MultiProvider (Cube 1, Cube 2 Cube 3 and DSO 1). The very big DSO 1, which is not used, increases the duration extremly. This may not be the desired behavior?! Is this a bug? I would expected that only the values are loaded from Cube 1.

  • Can not retrieve data in Crystal Report

    Hi,
    I have a problem to load data from <i><b>Crystal Report</b></i> in an SBO form with the ActiveX DI object : the Crystal Report Viewer message display : <b><i>'Failed to retrieve data from the database. Details [Database Vendor Code:208]'</i></b>
    It seems do not change the name of database in SQL Crystal Report query : My SQL query in Crystal Report file is a generic query : it must run with all custom database with the same datatable ; so the database name in FROM  clause must be change with the SetLogonInfo : but it do not run !
    Have you an idea ?
    Francis
    Here my code :
    Public Class frm_CRViewer
    ' Adding References of project : CRAXDRT and CrystalActiveXReportViewerLib11
    Private WithEvents MRO_CRV As
    CrystalActiveXReportViewerLib11.CrystalActiveXReportViewer
    Public Sub New()
    Dim msa_Form As SAPbouiCOM.Form
    Dim dsa_ActiveX As SAPbouiCOM.ActiveX ' Item <ActiveX> from form XML
    dsa_ActiveX = msa_Form.Items.Item("axCRV").Specific()
    dsa_ActiveX.ClassID = "CrystalReports11.ActiveXReportViewer.1"
    MRO_CRV = dsa_ActiveX.Object
    ' Create the crystal application
    Dim dob_ReportApp As New CRAXDRT.Application
    ' Open the report
    Dim dob_Report As New CRAXDRT.Report
    dob_Report = dob_ReportApp.OpenReport("c:MyTest.rpt")
    ' Defined to log on to the data source, and change the database name in FROM clause
    Dim dob_Table As CRAXDRT.DatabaseTable
    For Each dob_Table In dob_Report.Database.Tables
         dob_Table.SetLogOnInfo("192.168.2.10", "AeroOneDemo", "sa", "45dfrfg5")
    Next
    ' The report have a parameter in the sql query
    dob_Report.ParameterFields.Item(1).DiscreteOrRangeKind = CRAXDRT.CRDiscreteOrRangeKind.crDiscreteValue
    dob_Report.ParameterFields.Item(1).AddCurrentValue("15")
    ' Display the report in SBO form
    Title = pst_ReportName
    MRO_CRV.ReportSource = dob_Report
    MRO_CRV.ViewReport()
    End Sub
    End Class

    Try these ...
    <a href="http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2002650&sliceId=&dialogID=7002531&stateId=1%200%207004328">http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2002650&sliceId=&dialogID=7002531&stateId=1%200%207004328</a>
    or
    <a href="http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2000957&sliceId=&dialogID=7002728&stateId=1%200%207004460">http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2000957&sliceId=&dialogID=7002728&stateId=1%200%207004460</a>
    or
    <a href="http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2001075&sliceId=&dialogID=7002728&stateId=1%200%207004460">http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2001075&sliceId=&dialogID=7002728&stateId=1%200%207004460</a>
    or
    [url=http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2003637&sliceId=&dialogID=7002728&stateId=1%200%207004460]http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2003637&sliceId=&dialogID=7002728&stateId=1%200%207004460[/url]

  • How to create a report with data using the Crystal Reports for Java SDK

    Hi,
    How do I create a report with data that can be displayed via the Crystal Report for Java SDK and the Viewers API?
    I am writing my own report designer, and would like to use the Crystal Runtime Engine to display my report in DHTML, PDF, and Excel formats.  I can create my own report through the following code snippet:
    ReportClientDocument boReportClientDocument = new ReportClientDocument();
    boReportClientDocument.newDocument();
    However, I cannot find a way to add data elements to the report without specifying an RPT file.  Is this possible?  I seems like it is since the Eclipse Plug In allows you to specify your database parameters when creating an RPT file.
    is there a way to do this through these packages?
    com.crystaldecisions.sdk.occa.report.data
    com.crystaldecisions.sdk.occa.report.definition
    Am I forced to create a RPT file for the different table and column structures I have? 
    Thank you in advance for any insights.
    Ted Jenney

    Hi Rameez,
    After working through the example code some more, and doing some more research, I remain unable to populate a report with my own data and view the report in a browser.  I realize this is a long post, but there are multiple errors I am receiving, and these are the seemingly essential ones that I am hitting.
    Modeling the Sample code from Create_Report_From_Scratch.zip to add a database table, using the following code:
    <%@ page import="com.crystaldecisions.sdk.occa.report.application.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.data.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.document.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.definition.*"%>
    <%@ page import="com.crystaldecisions.sdk.occa.report.lib.*" %>
    <%@ page import = "com.crystaldecisions.report.web.viewer.*"%>
    <%
    try { 
                ReportClientDocument rcd = new ReportClientDocument();
                rcd.newDocument();
    // Setup the DB connection
                String database_dll = "Sqlsrv32.dll";
                String db = "qa_start_2012";
                String dsn = "SQL Server";
                String userName = "sa";
                String pwd = "sa";
                // Create the DB connection
                ConnectionInfo oConnectionInfo = new ConnectionInfo();
                PropertyBag oPropertyBag1 = oConnectionInfo.getAttributes();
                // Set new table logon properties
                PropertyBag oPropertyBag2 = new PropertyBag();
                oPropertyBag2.put("DSN", dsn);
                oPropertyBag2.put("Data Source", db);
                // Set the connection info objects members
                // 1. Pass the Logon Properties to the main PropertyBag
                // 2. Set the Server Description to the new **System DSN**
                oPropertyBag1.put(PropertyBagHelper.CONNINFO_CRQE_LOGONPROPERTIES, oPropertyBag2);
                oPropertyBag1.put(PropertyBagHelper.CONNINFO_CRQE_SERVERDESCRIPTION, dsn);
                oPropertyBag1.put("Database DLL", database_dll);
                oConnectionInfo.setAttributes(oPropertyBag1);
                oConnectionInfo.setUserName(userName);
                oConnectionInfo.setPassword(pwd);
                // The Kind of connectionInfos is CRQE (Crystal Reports Query Engine).
                oConnectionInfo.setKind(ConnectionInfoKind.CRQE);
    // Add a Database table
              String tableName = "Building";
                Table oTable = new Table();
                oTable.setName(tableName);
                oTable.setConnectionInfo(oConnectionInfo);
                rcd.getDatabaseController().addTable(oTable, null);
        catch(ReportSDKException RsdkEx) {
                out.println(RsdkEx);  
        catch (Exception ex) {
              out.println(ex);  
    %>
    Throws the exception
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: java.lang.NullPointerException---- Error code:-2147467259 Error code name:failed
    There was other sample code on SDN which suggested the following - adding the table after calling table.setDataFields() as in:
              String tableName = "Building";
                String fieldname = "Building_Name";
                Table oTable = new Table();
                oTable.setName(tableName);
                oTable.setAlias(tableName);
                oTable.setQualifiedName(tableName);
                oTable.setDescription(tableName) ;
                Fields fields = new Fields();
                DBField field = new DBField();
                field.setDescription(fieldname);
                field.setHeadingText(fieldname);
                field.setName(fieldname);
                field.setType(FieldValueType.stringField);
                field.setLength(40);
                fields.add(field);
                oTable.setDataFields(fields);
                oTable.setConnectionInfo(oConnectionInfo);
                rcd.getDatabaseController().addTable(oTable, null);
    This code succeeds, but it is not clear how to add that database field to a section.  If I attempt to call the following:
    FieldObject oFieldObject = new FieldObject();
                oFieldObject.setDataSourceName(field.getFormulaForm());
                oFieldObject.setFieldValueType(field.getType());
                // Now add it to the section
                oFieldObject.setLeft(3120);
                oFieldObject.setTop(120);
                oFieldObject.setWidth(1911);
                oFieldObject.setHeight(226);
                rcd.getReportDefController().getReportObjectController().add(oFieldObject, rcd.getReportDefController().getReportDefinition().getDetailArea().getSections().getSection(0), -1);
    Then I get an error (which is not unexpected)
    com.crystaldecisions.sdk.occa.report.lib.ReportDefControllerException: The field was not found.---- Error code:-2147213283 Error code name:invalidFieldObject
    How do I add one of the table.SetDataFields()  to my report to be displayed?
    Are there any other pointers or suggestions you may have?
    Thank you

Maybe you are looking for