Crystal Report: Multiple Join in Table

Hi experts,
I have a problem adding a table in a report.
The layout I'm modifing is the Purchase Order (CR). The report contains the necessary tables linked via the Database Expert to OPOR master table.
I need to add the Vendor Item Code in the OSCN table. To reach he correct code I have TWO values: ItemCode and CardCode.
ItemCode is in the POR1 row, and CardCode is in OPOR table.
I tried to add the table and link CardCode between OPOR and OSCN, and the field ItemCode between POR1 and OSCN but crystal say me that, he cannot join a just joined table!
So, how can I add the table OSCN linked correctly in the existing report ti dislay the correct Vendor Item Code near the ItemCode from OITM?
Thanks for your answers.

hi Jonny,
paste this to your SQL query window to create this Stored Procedure
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:          <Author,,Name>
-- Create date: <Create Date,,>
-- Description:     <Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[YourSP_Name]
AS
BEGIN
     SET NOCOUNT ON;
     SELECT     OPOR.DocNum, POR1.DocEntry, POR1.LineNum, POR1.ItemCode, OPOR.CardCode, OSCN.Substitute
     FROM         OPOR INNER JOIN
                      POR1 ON OPOR.DocEntry = POR1.DocEntry INNER JOIN
                      OSCN ON OPOR.CardCode = OSCN.CardCode AND POR1.ItemCode = OSCN.ItemCode INNER JOIN
                      OITM ON OSCN.ItemCode = OITM.ItemCode
     ORDER BY POR1.DocEntry
END
GO
then call this stored procedure in Crystal report
regards,
Fidel

Similar Messages

  • Crystal Report linked to a table with filter attached

    I have a Crystal Report based on 2 tables and I want it to display every incident in the incident table and to pull the truckID of the
    first truck on the scene from the truck table . So the finished product should look like this…
    IncidentID           IncidentNum     ResponseTime                  First Arriving Truck           Disctict
      1x44452                1258ab55             5:32                                        B8                              2
    *The first arriving truck is the truck in the Truck Table with the same IncidentID and  the earliest ArrivalTime.  There will be multiple trucks for each incident but I want it to only show the one that arrived first (ArrivalTime).  So one line per incidentID.
    Incident Table
    IncidentID
    IncidentNum
    ResponseTime
    District
    Truck Table (Will contain many trucks for one incident with the following info
    Truckkey
    IncidentID (Link to Incident Table)
    ArrivalTime
    TruckID
    I figure I probably need to build a formula with the min function or perhaps an OnCommand – I’m just not sure.
    The biggest issue is the overall report has 4 filter settings.  They can select a date range, a location, an incident type and a range for the response time. So I do this with the Select Expert
    I can get all of that to work except I cannot figure out how to get it to pull the First Arriving Truck without duplicating the incident
    line.  Also, if there is a Truck with an ArrivalTime of Null I want it to ignore that Truck Table record.
    Can anyone help???

    Hi Debbie,,
    You may try this:
    1) Go to the Group Expert > Create a Group on the 'Incident ID' field from the Incident Table
    2) Insert a summary on the 'Arrival Time' field and place the field on the Group Footer
    3) Move all the fields from the Details section to the Group Footer
    4) Go to the Group Selection Formula (Report > Selection Formulas > Group) and use this code:
    {Truck.ArrivalTime} = Minimum({Truck.ArrivalTime}, {Incident ID})
    5) Suppress the Details Section
    -Abhilash

  • How to biod Crystal Reports based on ABAP Tables/Views

    Hi,
      Can any one post me some document stuff on building Crystal reports based on ABAP Tables/Views please!
    Thanks,
    Madhu.

    Hi,
    Check out the links below for Crystal Reports :
    Re: Crystal report in SAP BW
    http://support.businessobjects.com/documentation/product_guides/
    http://help.sap.com/saphelp_nw04/helpdata/en/86/06a8d3be17fc47aa8d850e50cf5f24/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/46/dfd33b1ed4b47de10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/34/c0523e83464644e10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/0d/5f72b7c0e943d99f4f5cef2bfacfe1/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/06/00a63b60f26e3be10000000a114084/frameset.htm
    Hope this helps.
    Cheers,
    Kedar

  • Crystal Report multiple columns

    I'm having trouble with Crystal Report's multiple columns in the detail section.
    The details section, the multiple columns is checked then the printing direction is across - down. Since the form I am using is a pre-printed form, by estimation it can only allow at best 30 records in one page, that is 15 in the 1st half of the column and another 15 records on the next. For visual:
    Invoice No    Invoice Date        invoice total                                               Invoice No    Invoice Date        invoice total
    1                                                                                16
    2                                                                                17
    3                                                                                .
    .                                                                                28
    14                                                                                29
    15                                                                                30
    For some reason there is this giant space after the last set of rows before it prints out the page footer. This giant blank section disrupts the layout of the page footer section.
    Here are some info on the details section as configuration is involved:
    Format with  Multiple Columns - checked
    In Paging: New Page after 30 visible Records
    In Layout: Width: 3.5 in       Height: 0.0 in
                     Horizontal: 0.0 in      Vertical: 0.0 in     
    Printing Direction: Across-Down
    Anyone knows how to suppress it or have the page footer move upwards?
    P.S To see actual pre-printed form, please download this [http://www.mediafire.com/i/?csu0q75mjynys2k]
    Edited by: Khristine Angelei  Basilla on Mar 1, 2012 8:34 AM

    Now why didn't I try that out. Actually, initial plan was 2 subreports.
    So when I added the second subreport in the group footer section, it only prints the details on the last page, which should not be the case as I need to be printed on all pages.
    I'll test it out. I'll post an update soon.
    Thanks.

  • Crystal Reports Cant Find the table

    Hello ,
    I have a problem when i try to preview a report Crystal Reports says that cant find the table , it happend when add a table that in his name has an underscore example "SALES_REP" , im working with CR 2008 and open access ODBC driver.
    Can you help me with the problem?
    Thank you
    Manuel

    Hello,
    Try installing all CR patches and then test using OLE DB. If not an option we need to know more details of the database and driver/client?
    I recall this may be an issue and not sure if it's been patched or not. Try searching here to see if anyone else has had this problem.
    Thank you
    Don

  • How do I create a crystal report layout with a table and borders

    My crystal report is a signin sheet. The sign in sheet has an ID column, Name column, Institution column, Place to signin column, and Weekday columns with checkboxes in each column for the visitor to checkoff.
    How do I display the data that is being used int he crystal report in a table layout with borders around each cell? And is it possible to center vertical alignment of the data within eacvh cell like Excel?

    Blahahaha! Great answer Deb!
    Seriously though... There is no vertical alignment in CR. There have been several past threads related to this issue and all of them have various workarounds. None of them are very elegant.
    The best workaround I've found (especially if you are grid or borders) is to turn off the boarders for the field itself and drawl a rectangle around the field(s). Now you can place the field in the lower portion of the rectangle and adjust the rectangles height to place the field text in the center of the rectangle.
    This will give you more control over the height of your elements than using a carriage return before the text.
    Jason

  • Crystal Report - More than one table from MySql

    Hello, I am in need of help big time.
    I have am using Visual Studio 2010 and Crystal Report 10.
    The problem that I am incounting is that I am unable to retreive data from more than one table from a MySql database. I have been stuck on this for too long and need to hjump the hurdle.
    I am using a MySql connection string, a dataset and a crystal report which is based on the dataset.
    The main error that I am having is, the browser opens and a form appears saying "The report you requetsed requires further information" With the Server name: DataSetPropertiesDetials, while the User name and Password fields are then enabled.
    I am guessing I am missing something in my code.
    When I retreive data from one table the report is fine, but when I try to use more than one table it throws the error.
    My Code is below and also attached:
    Imports System.Data.SqlClient
    Imports System.Configuration
    Imports MySql.Data.MySqlClient
    Imports CrystalDecisions.ReportSource
    Imports CrystalDecisions.Web
    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared
    Public Class _Default
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim con As MySqlConnection
    Dim rpt As New CrystalReport3()
    Dim myReport As New ReportDocument
    Dim myData As New DataSet
    Dim cmd As New MySqlCommand
    Dim cmdUser, cmdProperty, cmdBranch As New MySqlCommand
    Dim daBranch, daProperty, daUser As New MySqlDataAdapter
    con = New MySqlConnection()
    'Connection String
    con.ConnectionString = "Server=****;Database=***;UID=***;Password=****"
    Try
    con.Open()
    cmdBranch.CommandText = "SELECT branch FROM tblbranch"
    cmdBranch.Connection = con
    daBranch.SelectCommand = cmdBranch
    daBranch.Fill(myData)
    cmdProperty.CommandText = "SELECT ref, keys_held, key_no, keys_out, no_name, address_line1, address_line2,key_label FROM tblproperty"
    cmdProperty.Connection = con
    daProperty.SelectCommand = cmdProperty
    daProperty.Fill(myData)
    cmdUser.CommandText = "SELECT known_name FROM tbluser"
    cmdUser.Connection = con
    daUser.SelectCommand = cmdUser
    daUser.Fill(myData)
    myReport.Load("REPORT LOCATION")
    myReport.SetDataSource(myData)
    myReport.Database.Tables(0).SetDataSource(myData.Tables(0))
    CrystalReportViewer1.ReportSource = myReport '
    Catch myerror As MySqlException
    MsgBox(myerror.Message)
    End Try
    End Sub
    End Class

    Hi, 
    You have 3 SQL commands but you are calling SetDataSource only once.  You need to look through for each of the SQL Commands. 
    Good luck,
    Brian

  • Populating a Crystal Report from a virtual table

    Hi,
    Iu2019m using Crystal Report XI R2. I have a Crystal Report which is created using a view in Oracle using the native oracle DB connection. Iu2019m intending to write an application which should populate this report with data using a virtual table in memory. Populating the virtual table could be done by me but what I need to know is how to populate the report using this virtual table. Note the virtual table name will be the same as the one that was used to design the report. Is such a thing possible in the Crystal Java SDK. I found the flowing link http://www.eggheadcafe.com/forumarchives/NETgeneral/Jul2005/post23273440.asp and it talks about a PUSH feature. Can this be used? If so can you tell me how, maybe a small sample code would help.
    Thanks you in advance,
    Regards,
    Chanaka

    I would suggest searching for how to use resultsets with crystal reports.

  • Crystal Report - multiple sales document types

    In XLR, I can easily drag 'DocNum', 'DocDate', 'Sales Doc Type' fields and specify the filter to show sales doc type equal to A/R invoice and A/R credit memo. It neatly shows various types of sales documents and display them in rows.
    In crystal, I have to drag the 'DocNum', 'DocDate' fields for A/R Invoice, A/R credit memo individually under different columns. Is there a way I can dispaly mixed sales document types in rows? Thanks.

    Hi,
    In XLR, you get the data from JDT1 table. You can do the same for CR.
    Thanks,
    Gordon

  • Transporting Crystal report based on ECC table

    Hi guys
    We use CR 2011 over a table in ECC DEV
    Is there an option to transport the report to our production system without having to recreate it?
    Regards
    Shlomi

    Hi Shlomi,
    Yes, you need to 'set the datasource location' of the report to the Production System.
    Go to Database > Set Datasource Location and change the source.
    Hope this helps!
    -Abhilash

  • Multiple joins between tables

    Not sure that the title best describes this.
    I've got two tables which I'll simplify here
    t1 - building (BuildingCode, Reception, Porter, Manager)
    A, 1, 3, 8
    B, 2, 4, 9
    C, 1, 4, 7
    t2 - staff (ID, Name, Extn)
    1, Dave, 3302
    2, Chris, 3994
    3, Claire, 3033
    8, Simon, 3255
    and i'd like to get a table out that looks like
    A, Dave, 3302, Claire, 3033, Simon, 3255
    B, Chris, 3994 etc.
    select b.buildingCode, s.Name, s.Extn
    from building b, staff s
    where s.ID = b.Reception
    would give me one set of details - how can i get all 3?
    Do I need to do 3 queries - where s.ID = b.Reception, where
    s.ID = b.Porter and where s.ID = b.Manager and then join the 3
    tables together or is there a more direct route?
    Many thanks
    Michael

    Now that I've had a chance to try the code I found that to
    use the results on the page I needed aliases in the select part as
    well - final code is
    select t1.BuildingCode, r.Name as rname, r.Extn as rextn,
    p.Name as pname, p.Extn as pextn, m.Name as mname, m.Extn as mextn
    from t1, t2 r, t2 p, t2 m
    where t1.Reception = r.ID
    and t1.Porter = p.ID
    and t1.Manager = m.ID

  • SQL Server Multiple JOINS with Table Value Function - query never ends

    I have a query with 4 joins using a table value function to get the data and when I execute it the query never ends.
    Issue Details 
    - Table value function 
        CREATE FUNCTION [dbo].[GetIndicator] 
          @indicator varchar(50),
          @refDate datetime
    RETURNS 
    TABLE
    AS
    RETURN
    SELECT
    T1.Id ,T1.ColINT_1, T1.ColNVARCHAR_1 collate DATABASE_DEFAULT as ColNVARCHAR_1 ,T1.ColNVARCHAR_2 ,T1.ColSMALLDATETIME_1, T1.ColDECIMAL_1, T1.ColDECIMAL_1
    FROM TABLE2 T2
    JOIN TABLE3 T3
    ON T2.COLFKT3 = T3.Id
    AND T3.ReferenceDate = @RefDate
    AND T3.State != 'Deleted'
    JOIN TABLE4 T4
    ON T2.COLFKT4 = T4.Id AND T4.Name=@indicator
    JOIN TABLE1 T1
    ON T2.COLFKT1=T1.Id
    - Query
        DECLARE @RefDate datetime
    SET @RefDate = '30 April 2014 23:59:59'
    SELECT DISTINCT OTHERTABLE.Id As Id
    FROM 
    GetIndicator('ID#1_0#INDICATOR_X',@RefDate) AS OTHERTABLE
    JOIN GetIndicator('ID#1_0#INDICATOR_Y',@RefDate) AS YTABLE  
    ON OTHERTABLE.SomeId=YTABLE.SomeId
    AND OTHERTABLE.DateOfEntry=YTABLE.DateOfEntry
    JOIN GetIndicator('ID#1_0#INDICATOR_Z',@RefDate) AS ZTABLE
    ON OTHERTABLE.SomeId=ZTABLE.SomeId
    AND OTHERTABLE.DateOfEntry=ZTABLE.DateOfEntry
    JOIN GetIndicator('ID#1_0#INDICATOR_W',@RefDate) AS WTABLE 
    ON OTHERTABLE.SomeId=WTABLE.SomeId
    AND OTHERTABLE.DateOfEntry=WTABLE.DateOfEntry
    JOIN GetIndicator('ID#1_0#INDICATOR_A',@RefDate) AS ATABLE  
    ON OTHERTABLE.SomeId=ATABLE.SomeId
    AND OTHERTABLE.DateOfEntry=ATABLE.DateOfEntry
    Other details:
    - SQL server version: 2008 R2
    - If I execute the table function code outside the query, with the same args, the execution time is less the 1s.
    - Each table function call return between 250 and 500 rows.

    Hi,
    Calling function in general is a costly query. And definitely joining with a function 5 times in not an efficient one.
    1. You can populate the results for all parameters in a CTE or table variable or temporary table and join (instead of funtion) for different parameters
    2. Looks like you want fetch the IDs falling to different indicators for the same @Refdate. You can try something like this
    WITH CTE
    AS
    SELECT
    T1.Id ,T1.ColINT_1, T1.ColNVARCHAR_1 collate DATABASE_DEFAULT as ColNVARCHAR_1 ,T1.ColNVARCHAR_2 ,T1.ColSMALLDATETIME_1, T1.ColDECIMAL_1, T1.ColDECIMAL_1, T4.Name
    FROM TABLE2 T2
    JOIN TABLE3 T3
    ON T2.COLFKT3 = T3.Id
    AND T3.ReferenceDate = @RefDate
    AND T3.State != 'Deleted'
    JOIN TABLE4 T4
    ON T2.COLFKT4 = T4.Id AND T4.Name=@indicator
    JOIN TABLE1 T1
    ON T2.COLFKT1=T1.Id
    SELECT * FROM CTE WHERE Name = 'ID#1_0#INDICATOR_X' AND Name = 'ID#1_0#INDICATOR_Y' AND Name = 'ID#1_0#INDICATOR_Z' AND Name = 'ID#1_0#INDICATOR_W' AND Name = 'ID#1_0#INDICATOR_A' AND ReferenceDate = @RefDate.
    Or you can even simplify more depends on your requirement.
    Regards,
    Brindha.

  • Crystal report : can't add table in the samples provided by SAP

    Hello,
    I tried to add tables in the generic samples provided  by SAP.  I used the database expert and just added a new table but when I save the report in SAP and want to run it it is blank.
    Is there another way to add a table ?
    BR

    Already tried all those tricks!
    My question is concerning the standard layouts provided by SAP (downloaded from marketplace). The idea behind those reports is that you can use them as Templates. 
    The tables are not hardcoded with the table.field name but with a specific syntax that allows you to use those templates in any type of document (ex : you can use the template of sales order for delivery and invoices). The problem is that if you add a new table the report doesn't work!
    Thank you for the response anyway.
    Best Regards,
    Arnaud

  • Performing multiple joins on table

    Hi all,
       I would like to know if performing joins on more than 10 tables has some performance issues? If so, is there any limit on the joins that can be done?
    Is there another way out for this problem?

    Rob Burbank wrote:>
    > >
    Thomas Zloch wrote:
    > > If I had to bet, I'd say no, not included...do you have time to try out with a little test program?
    > Probably not so little, but maybe sometime. I know there are standard SAP views with upwards of 13 or 14 tables, but I doubt if they would be compatable for joining.
    >
    > Rob
    How about a self join? 

  • Crystal Reports - ECC Tables - Row level security on Multiple tables

    Hi Experts,
    We are implementing Crystal Reports directly reporting on ECC Tables.  Lot of information on row-level security has been provided by experts Ingo Hilgefort, Don Williamsand Mike Seblani, but not related to multiple tables or Wild cards
    Requirement:
    Crystal Users should have access to ALL the tables in ECC, but restricted by Company code, plant, Sales Organization, Purchasing Organization fields to what ever table it applies to. Example: MARC table should be restricted by Plant, BSEG table should be restricted by Plant and company code, GLT0 table should be restricted by Company code..etc
    Users should ONLY see their Organization related data.
    Solution Developed:
    1. We created custom authorization object with BUKRS and WERKS
    2. In  /CRYSTAL/RLS  we used Wild Cards *, +  rather than specific table  and referenced the custom authorization object with =BUKRS and =WERKS  in the Field Value
    3. Enabled global lock
    4. Custom Authorization object was added to user-profiles with corresponding restrictions
    *Observation:*
    1. This security works when a crystal report was developed on a ECC table which has both BUKRS and WERKS
    2. This setup DOES NOT work when a crystal report developed on a table with either one of BUKRS or WERKS
        Example: Does not work on MARC table - error message "Database connection error: /CRYSTAL/OSQL_EXECUTE_QUERY Message: field T0~BUKRS" unknown"
       Does not work on GLT0 table - error message "Database connection error: /CRYSTAL/OSQL_EXECUTE_QUERY Message: field T0~WERKS unknown"
    Trouble Shooting:
    In the "where clause" of the internal ABAP code generated for MARC, system is checking for BUKRS - which  should not be the expected result
    ANYTHING WRONG IN THE SECURITY SETUP ? PLEASE ADVICE
    Note: Document "BusinessObjects XI Release 2, Integration Kit for SAP, Installation Guide" does not talk much about this multiple table restriction. Any other document to be referred to ?

    I'm not sure how that would help; by using the Faculty_ID Session Variable I can identify the CRN and Term of all courses a faculty member is teaching. But I don't think that has to do with the problem I am having?

Maybe you are looking for