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

Similar Messages

  • How to set Crystal Report  command timeout in runtime ?

    Hi, All !
    I have a report that is generating timeout error during execution command (Crystal Report command with SQL query). How can I set timeout  for the  command from application code ? I am using CR 12 and C#  (.NET framework 2.0)
    I have investigated CommandTableClass (CrystalDecisions.ReportAppServer.DataDefModel.CommandTableClass) but I didn't find timeout property or simething like that.
    Please help.
    Thank you in advance.
    Edited by: Bonowow on Feb 24, 2010 11:38 AM
    Edited by: Bonowow on Feb 24, 2010 11:42 AM

    I do not believe there is such an API. How long does it take before you get the timeout?
    Ludek

  • Crystal Report Database Query

    Hi I would like to ask regarding queries from the database. I have 2 main tables that gets their images from 1 master table.
    First is TASK table and Second is ASSET table. Both tables are relational.
    Each Task has Asset connected by Task_Asset_ID.
    But both tasks and each assets may have also images from the Image table thru Assignment table. But I am wondering how could I query the data to show tasks with images and assets with images in one row.
    For example
    Task 1 may have Green.jpg
    Asset 222 may have Red.jpg
    Knowing that Task and Asset are relational, is it possible to show them in one row in crystal report?
    Task
    TaskID
    TaskName
    Task_Asset_ID
    1
    Task1
    111
    2
    Task2
    222
    3
    Task3
    111
    Asset
    AssetID
    AssetName
    111
    Asset1
    222
    Asset2
    Images
    imgID
    ImgName
    1
    Red.jpg
    2
    Yellow.jpg
    3
    Blue.jpg
    4
    Green.jpg
    Assignment
    AssID
    TaskOrAssetID
    ImgID
    Type
    1
    1
    4
    X
    2
    222
    1
    Z
    3
    3
    3
    Z
    4
    111
    2
    X

    Ok, this is going to get a bit complicated, but this is possible.  The problem is that the Assignment table records can have either TaskID or AssetID, so you're going to have to use some tables twice with aliases.
    Here's what I'd do...
    In the Database Expert:
    1.  Add all of the tables to your report.
    2.  Add a second copy of Assignment and Images - when you do this, Crystal will warn you that the table is already in the report and ask if you want to "alias" it.  At that point it will add the table with "_1" at the end of the table name.  So, you'll have Assignment_1 and Images_1.
    3.  On the linking tab, create the following links:
         Task.Task_Asset_ID to Asset.AssetID
         Task.TaskID to Assignment.TaskOrAssetID - make this a left outer join (see below)
         Assignment.ImgID to Images.ImgID - make this a left outer join
         Asset.AssetID to Assignment_1.TaskOrAssetID - make this a left outer join
         Assignment-1.ImgID to Images_1.ImgID - make this a left outer join.
    To make a left outer join, right-click on the join and select "Join Options".  Select "Left Outer" and save the join.  Left outer joins will provide data even when there is no matching value in the table that you're linking to - the values from that table will be null.
    In your report:
    1.  Put the following column headers on the report:
         Task Name
         Task Image
         Asset Name
         Asset Image
    2. Put the following fields in the details of the report:
        {Task.TaskName}
        {Images.ImgName}
        {Asset.AssetName}
        {Images_1.ImgName}
    3. Sort the data by Task Name and Asset Name.
    -Dell

  • Crystal Report-BW Query free characteristics missing

    Hello,
    I am working on a crystal report against BW query, I am using SAP menu to build the report. I see that free characteristics not coming into the crystal report.
    Question1: Is this an issue or is it designed to work this way?
    Question2: As an alternative for this In BW query I have changed all the free characteristics into rows, now I am able to see all the fields but the data is becoming flat, when I try to role up the data for cretain fields it does not work correctly. Example: Role up of Rates (%). With database delegation option in webi role up work fine there but what about in crystal?
    Thanks

    Hi,
    you are most likely using the old driver. make sure in the Settings in the SAP Toolbar you activate the option to use the MDX Driver.
    ingo

  • How to bring Picture from OHEM table into Crystal Report using query

    Hi expert
    i had a query and which is attached to a crystal report, and its working fine,
    the thing what i need is to bring the picture which is stored in OHEM table, (Employee Photo)
    to the report. in the query i had attache the picture field. but not able to see it over the Crystal reprot
    The below given is the query
    select OHEM.empID,isnull(OHEM.firstName,'')+' ' +isnull(OHEM.middleName,'')+ ' '+isnull(OHEM.lastName,'')AS [Employee Name],
    OHPS.name AS [Position],OUDP.Name AS [Department],OUBR.Name AS[Branch],OHEM.U_SponsName,OHEM.U_EMPOLD_ID,OCRY.Name AS [Nationality],
    OHEM.U_JoinDate As [Joining Date (G)],OHEM.U_JoinDateH As [Joining Date (H)],OHEM.birthDate, (CAST(DATEDIFF(day,OHEM.birthDate,GETDATE())/(365) AS int)) As [AGE],(CAST(DATEDIFF(day,OHEM.startDate,GETDATE())/(365) AS int)) As [Year],
    OHEM.startDate As [Emp Contract Start Date (G)],OHEM.U_CEDate As [Emp Contract End Date (G)],OHEM.U_ConType As [Emp Contract Type],
    OHEM.U_ContDur AS [Emp Contrat Duration],OHEM.U_CRDate As [Emp Cont Renewal Date (G)],OHEM.U_IQId AS [Iqama ID],OHEM.U_IQIsDate As [Iq Issue Date (G)],
    OHEM.U_IQExDate As [Iq Expiry Date (G)],OHEM.U_IQIsDateH As [Iq Issue Date (H)],OHEM.U_IQExDateH As [Iq Expiry Date (H)],OHEM.U_InsType As [Insurance Type],
    OHEM.U_InsExpDate AS [Insurance Exp Date],OHEM.U_InsName As [Insurance Company],OHEM.U_DestiCity As [Destination City],
    OHEM.U_TicketType As[Ticket Type],OHEM.U_TicketClass As [ Ticket Class], OHEM.U_TravelDate As [Travel Date],OHEM.passportNo,OHEM.U_PassportIsDate AS [Passport Issue Date],
    OHEM.passportEx AS [Passport Expiry Date],OHEM.U_BSal As [Basic Salary], OHEM.U_HoAllow As [House Allowance],OHEM.U_TrAllow As [Transport Allowance],
    OHEM.U_FoodAllow AS [Food Allowance],OHEM.U_CarAllow AS [Car Allowance],OHEM.U_OthAllow As [Other Allowance],OHEM.U_BonusAllow As [Bonus],
    OHEM.U_VacStartDate1 AS [First Vacation Start Date], OHEM.U_VacEndDate As[ First Vacation End Date],OHEM.U_VacResDate As [First Vacation Resume Date],
    OHEM.U_VacDur AS [First Vacation Duration],OHEM.U_VacStartDate2 As [Second Vacation Start Date],OHEM.U_VacEndtDate2 AS [Second Vacation End Date],
    OHEM.U_VacDur2 As [Second Vacation Duration],OHEM.U_VacResDate2 AS [Second Vacation Resume],OHEM.U_VacStartDate3 AS [Third Vacation Start Date], OHEM.U_VacEndtDate3 As[ Third Vacation End Date],
    OHEM.U_VacRestDate3 As [Third Vacation Resume Date],OHEM.U_VacDur3 AS [Third Vacation Duration],OHEM.U_VacStartDate4 AS [Fourth Vacation Start Date],
    OHEM.U_VacEndDate4 As[ Fourth Vacation End Date],OHEM.U_VacResumeDate As [Fourth Vacation Resume Date],
    OHEM.U_VacDur4 AS [Fourth Vacation Duration],OHEM.U_VisaDuration AS [Visa Duration],OHEM.U_VisaStartDate AS [Visa Start Date],
    OHEM.U_VisaEndDate AS [Visa End Date],OHEM.U_VisaType As [Visa Type],OHEM.picture,OHEM.remark,OHEM.attachment,OHEM.mobile AS [Mobile],OHEM.homeTel AS [Residence Tele],OHEM.email AS [E-Mail] from OHEM
    left outer join OHPS ON OHEM.position=OHPS.posID
    left outer Join OUDP on OHEM.dept=OUDP.Code
    left outer join OUBR on OHEM.branch=OUBR.Code
    left outer join OCRY on OHEM.citizenshp=OCRY.Code
    Pls suggest how to make it appear the photo in the crystal report
    regards

    Hi,
    Please refer this how to guide which may give some idea for creation formula:
    http://www.pioneerb1.com/wp-content/uploads/2012/04/How-to-work-with-Crystal-Reports-8.8.pdf
    Thanks & Regards,
    Nagarajan

  • Crystal report license query

    1)      Do Company A (which is a group of companies consisting of Company 1 u2026.. Company N), require the Developer License only, and distribution to its group company  is free?
    2)      If u2018Company 1..Company Nu2019 are sub-companies of Company A then does 'Company 1', u2026.. , 'Company N' require full engine of Crystal Report 2008 or just the run time engine is sufficient?
    Do they require license for the same, even if they just use the run time engine?
    3)      In case where 'Company 1',u2026., 'Company N' purchase a license, in that case, does 'Company A' still needs to purchase the developer license?
    4)      According to you what would be the best license option, so that there is no burden on 'Company 1',u2026.., 'Company N' and also on parent company A?
    Pls advise
    Thanks
    simmy

    These questions are better posed to the sales team; 866-681-3435
    To start with, the licensing is different for web apps and win apps. Also licensing is different depending on what version of CR you are using. I'll set you up with a few resources and if these do not answer your questions, you will have to contact sales for more info.
    For CR 2008 see the following:
    http://www.sap.com/solutions/sapbusinessobjects/sme/reporting/crystalreports/licensing/index.epx
    /people/blair.wheadon/blog/2009/02/05/announcing-crystal-reports-developer-advantage-runtime-license
    https://ecohub.sdn.sap.com/irj/ecohub/solutions/crystalreportsdevadvantage#pricing
    For bundled versions of CR see the following:
    http://support.microsoft.com/kb/317789
    Also, see the following forum thread from Blair Wheadon who is a PM for CR:
    CR 2008 Licensing Question
    Ludek

  • Crystal report design query

    Hello,
    I am using Crystal reports 10 to design a report using an SQL database source.
    There are 2 tables causing problems in that once fields from both of them are added to the detail section, the data is duplicated.  The reason for this is table2 has a field (rulename) which can have multiple outcomes such as the basic example below:
    table1.id,table2.rulename,table2.decision
    1,postcodecheck,accept
    1,secuitycheck,notchecked
    1,creditcheck,notchecked
    2,postcodecheck,accept
    2,secuitycheck,accept
    3,creditcheck,accept
    3,postcodecheck,accept
    3,secuitycheck,decline
    3,creditcheck,notchecked
    If I group the report by table1.ID it removes the duplicated records but only displays one of the 'rulename', usually accepts.   A record sort of this field either retain the same result or replaces it with any table2.decision outcome of 'notchecked'.  A more lengthy task would be to create formula fields for each rulename but having quite a few of this means its a very manual job.
    Is there a better way to do this?  I have not used the select expert because I want to display all decisions (table2.decisions).
    Also if I create a crosstab report, each record is counted by the number of rulenames per ID, again duplicating each record (table1.id)
    Thanks,WA

    Hi Wasim,
    Just try to check whether u have used proper link or not.
    Database Expert->Link.
    Regards,
    Misra P.

  • Crystal Reports连接BW Query时出错

    错误提示为:
        Database Connector Error: "BAPI Error #:0  Error occurred when starting the parser: timeout during allocate / CPIC-CALL"
    软件版本:
        Crystal Reports 2008 sp2
        SAP IK 3.1
    在SAP NOTES 1369523中找到了相同的症状描述, 但提供的解决方案太笼统了.
    顺便提一下, BW系统的结构是 数据库 与 应用 分离的结构, 即数据库在一台服务器,而应用部分在另一台服务器.
    请问大家有什么更好的解决方案么?

    除了楼上所提到的检查点之外
    还请确认: CR2008 SP2需要和相应的SAP IK XI31 SP2一起使用,请确认IK也打了SP2, SAP server端也使用上了SP2的transport.
    Best Regards
    Carlos Chen

  • Crystal reports - charting query

    Hi.
    I have a database with the following fields:
    'companyname' which contains the values:
    company1
    company2
    company3
    company4
    company5
    company6
    'value' which contains the company values:
    11
    14
    16
    13
    72
    26
    and a 'date' field.
    I have created a CReport that displays information between the dates specified. I am displaying a bar chart with the company names on the x-axis and values on the y axis.
    So i specify a 'from' and 'to' date to display the data and it returns a graph with data.
    On the x-axis is company3, company4, company5.   This then means that company1, company2 and company6 have a value of zero between the dates specified, thus the graph doesnt display those company names.
    Im wondering how i can get it to display all the company names (company1 to company6) and for company 1, company2 and company6, just display a value of zero?
    Please can you help me with this?
    thank you.
    J

    If the rest of the report is dependant on filtering the data based on the date but you still want to show company names that have no data for that date range then you could insert a subreport that returns all data (or filters it down to the 6). Create a formula that outputs the value if the datefield falls within the date range and outputs 0 if it does not. Use this formula as the value field in the chart.

  • HANA SP Call in Crystal Report

    Hi All ,
    I need help to resolved my Problem . I have Developed HANA Store procedure when I call that store procedure in the crystal Report command Query
    I will give me error . Kindly help me .
    Call     "SAPHANA".DD_PROC_SalesKPI_BySalesRepresentative('{?SlpName@Select SlpName  as SalesPerson from OSLP}',{?RptYear})
    Thanks
    Dhiraj

    Hi Shachar,
    i will explain one because i think some thing is misunderstood
    please the images
    when all parameter record selected and no parameter record selected ... i want all record should display
    this blank report is problem
    Regards,
    Mayank Shah

  • How to get Description of parameter filed in Crystal report 2008

    Hi expert,
    I am creating a crystal report from Query ,which is created in BEX    Query designer 7.
    In query designer i have some selection variable.
    The requirement from clint is that they want to see what value is selected for all  variable.
    when i tried to put all parameter field in crystal report it is showing only Technical name of value selected not  description and also it show only for variable which is single value variable  not for the range value variable and multiple selection variable.
    can any one help me How to get description of value in report and can it is possible to show Range value and multiple value for a particular variable .
    i am using Crystal report 2008 SP3 version.
    Thanks and regards
    devendra

    Moved to BEx forum

  • Crystal report and BI

    Hello,
    I am working with BI 7.0 and business object XI 3.1 and crystal report 2008. The integration kit has been installed.
    When I make a new report in  crystal report from query and press print preview I have the following error :
    "Failed to retrieve data from database"
    "Database Connector Error: 'BAPI Error #:0
      Error occurred  when starting the parser: timeout during allocate/
      CPIC-CALL: 'ThSAPCMRCV''
    Any Idea ?
    Thank you for your help
    Christophe

    The BI system is on platform windows 64 and unicode. Should I downoad the librfc32.dll for 32 or 64 unicode or not  because business object xi 3.1 is not working with 64 isn't it ?
    thank you
    Christophe

  • BEx hierarchies not displayed in Crystal report parameters

    Hi All,
    I am trying to using a Bex query that has a cost center hierarchy with a variable that allows users to select specific nodes or even cost centers. In BEx reports, this query works fine and gives the users the view of the cost centres in a hierarchial manner. However, in Crystal reports, the query provides a drop down menu displaying a simple list of all the cost centres (not in a hierarchial manner). This confuses the user as to which element is a node and which is a cost centre
    Kindly suggest how can we achieve the cost centre hierarchy to appear in the parameters in Crystal.
    Thanks

    Hi,
    this is a duplicate to this entry:
    key figures are not displayed in crystal report
    Please do not post the same problem multiple times
    regards
    Ingo Hilgefort

  • How to make crosstab report in crystal report

    Hi all ,
    I want to make a crosstab report in crystal report
    my query is like this
    select YearDate.year ,
    (currentasset.currentaset / currentliability.currentliability  ) as CurrentRatio
    ,(currentasset.currentaset - Inventory.Inventoryaset / currentliability.currentliability ) as QuickRatio
    from
    select distinct YEAR(JDT1.RefDate) as year from JDT1
    )YearDate left join
    select YEAR(JDT1.RefDate) as year,sum(JDT1.Debit - JDT1.Credit ) as currentaset from JDT1,OACT
    where JDT1.Account = OACT.AcctCode
    and OACT.AcctCode = '11'
    group by YEAR(JDT1.RefDate)
    )currentasset on YearDate.year = currentasset.year left join
    select YEAR(JDT1.RefDate) as year,sum(JDT1.Debit - JDT1.Credit ) as Inventoryaset from JDT1,OACT
    where JDT1.Account = OACT.AcctCode
    and OACT.AcctCode = '11.05'
    group by YEAR(JDT1.RefDate)
    )Inventory on YearDate.year = Inventory.year left join
    select YEAR(JDT1.RefDate) as year,sum(JDT1.Debit - JDT1.Credit ) as currentliability from JDT1,OACT
    where JDT1.Account = OACT.AcctCode
    and OACT.AcctCode = '21'
    group by YEAR(JDT1.RefDate)
    )currentliability on YearDate.year = currentliability.year  left join
    order by YearDate.year
    So if i view the data in sql server it should be like this
    Year   CurrentRatio   quickRatio
    2006               501                 100
    2007              600                  200
    2008             700                   300
    2009             900                   400
    I want to make a crosstab with the column is year . the Year is dynamic according to the selection
    So if i select the year from  2007 to 2009
    It should be like this in report
    2007                2008              2009
    CurrentRatio                 600                  700                  900
    QuickRatio                    200                   300                 400
    How can i make it in Crystal report ?
    I have use the template in crosstab crystal report, but there is not suitable.
    Can i make manually. ?
    Thanks in advance
    Regards
    KK

    Hi kevin,
    thanks for your respond . Actually, it's work.
    But i have some issue again.
    How can i make a grouping
    So the grouping per Item
    For example                                                                               
                                                          2006                 2007                 2008
    Group 1               Item A                5                        6                       7
                                Item B                7                        8                       9
    Group 2              Item C                  9                       0                      0
                               Item D                 8                        8                      9
    And another question, Is there always have row summary ? It seems that after the 2008 column, there is a total column, Can I remove this ?
    Thanks in advance
    regards
    KK
    Edited by: kah kian on Jun 2, 2011 4:17 PM

  • Crystal Reports Web Elements - database write back question

    Hi,
    I have a question about Web Elements. In description of them on SAP site it says they can provide "write-backs to the database". This is something I would really like to see. I have a scenario:
    User sees a long report and sometimes she needs to add a quick note that should be saved into the database. That note can be entered into WETextArea I suppose and WESubmit button click can be an event  trigger for such a write back.
    I would like to see example of such functionality on Crystal Report rpt file.
    Please advise if anybody knows, I would highly appreciate your assistance.
    Regards, Grettir

    hello,
    webelements can be used for the interface to database writebacks...they don't do the writebacks themselves but create the interface to make it easier for an end user to add annotations etc...these values are then passed to a second report or a subreport. using the default prompting interface makes this quite difficult.
    here's where the database writebacks are done...since version 9 of crystal reports there have been command objects. command objects have the ability to use any database syntax that is compliant with the database connection. i.e. if the syntax can go through the odbc layer then you can do this in a command in crystal reports.
    commands will honour database securities so you don't have to worry about someone dropping a table if rights have been properly assigned. a word of caution there to ensure that database rights have been done properly as you don't want all end users to have the ability to write a report that can do database updates.
    commands are also database specific so you would have to check your database online help to see what syntax would be appropriate.
    the workflow would be to have 2 reports, one that had the webelements user interface and one that did the writeback. this user interface report would have the text object and submit button and using open document syntax, the values would be passed to the 2nd report that had the command object. the command object would have a prompt that would take the values from the open document url and then use the values in the write back.
    for example,
    1) the user interface report has one text object called "t1" and one submit button.
    2) the target command object report has a prompt called "t1".
    3) the target report command object has syntax like
    INSERT INTO yourtestable
    VALUES    ('{?t1}')
    SELECT     1
    4) yourtesttable in this case has only one text field
    5) the "SELECT 1" at the end of the command ensures that a dummy value is returned after running the update...to avoid a database error
    6) this syntax would be for sql server
    this is of course a very simplified example.
    if you are at tech ed phoenix, please drop by the business objects test drive area & i will be there. i can show you a bunch of different webelements examples and write back reports etc. until you become quite bored
    i hope that this helps,
    jamie

Maybe you are looking for