Dynamic Report Creation At Runtime

I am trying to create a dynamic crystal report at run time from Visual Studio 2013 using C#.  My back end database is SQL Server 2005.  The source for my crystal report is a SQL Server stored procedure which takes two parameters, a year (smallint) and a quarter (tinyint).  The stored procedure uses dynamic SQL and creates a dynamic temp table.  It returns the result set from a select on the temp table.  The number of columns in the result set will be determined at run time.  Right now it returns 40 columns.  It can return additional columns in multiples of 6.  All of these columns will need to be displayed on the crystal report at run time.  The C# application will run on 64 bit Windows 7 machines and the SQL Server database is on a 32 bit server.
I have been successful in designing a crystal report within the Visual Studio IDE using this stored procedure and running it and displaying it in the crystal reports viewer from within the C# application.  So when the appropriate application's menu item is clicked, the form with the crystal viewer on it opens and displays the report.  So I know that I can connect to the database and display the report.  However as stated in the preceding paragraph, I need to create the crystal report at run time as the number of columns on the report will be variable.
I have looked at the CrystalDecisions SDK and API and tried without success to do this.  I am getting errors when trying to connect to the DB through the API and am not able to retrieve the data.  I have played with the code for about a week with no success.  I have tried the code in the discussion forums without success.  The documentation for the SDK API's does not provide the level of detail that I need.  The CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo class has an attributes property that needs to be set.  I don't know what the proper settings should be.
I prefer to use the OLE DB native client for SQL Server.
Any help would be greatly appreciated.
Martin

Hi Ludek,
I have made some small progress.  I can now login from work as well as get to links.  But it seems I am still blocked for zip files.
I also have the utility working.  But whenever I try to add my dummy crystal report (dummyreport.rpt) to the project, visual studio 2013 hangs up and I have to kill VS.
I added the following code to my form and ran it but I get the following error:
System.Runtime.InteropServices.COMException was unhandled
  HResult=-2147352565
  Message=Invalid index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))
  Source=CrystalDecisions.ReportAppServer.DataDefModel
  ErrorCode=-2147352565
  StackTrace:
       at CrystalDecisions.ReportAppServer.DataDefModel.TablesClass.get_Item(Int32 Index)
       at Retail_Incentive_Plan.ReportForm3..ctor() in u:\Incentive\Front_End\Visual_Studio_2013\Projects\Retail_Incentive_Plan - Copy\Retail_Incentive_Plan\ReportForm3.cs:line 123
       at Retail_Incentive_Plan.MDIParent.ShowNewForm(Object sender, EventArgs e) in u:\Incentive\Front_End\Visual_Studio_2013\Projects\Retail_Incentive_Plan - Copy\Retail_Incentive_Plan\MDIParent.cs:line 27
       at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
       at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
       at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ToolStrip.WndProc(Message& m)
       at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at Retail_Incentive_Plan.Program.Main() in u:\Incentive\Front_End\Visual_Studio_2013\Projects\Retail_Incentive_Plan - Copy\Retail_Incentive_Plan\Program.cs:line 18
  InnerException:
The error occurs at this line of code:
boReportDocument.ReportClientDocument.DatabaseController.SetTableLocation(boTables[0], boTable);
I'm sure it must be something with the attributes that I am setting.  But I'm not sure of what the correct values for some of these attributes should be.  By the way, I am using the RCAPI approach rather than the formulas approach (for now).
Here is my code that is in the form:
public ReportForm3()
//**************************   ChangeConnectionInfo   ******************************************************************************************************************
ReportDocument boReportDocument = new ReportDocument();
//**EDIT** Change the path and report name to the report you want to change.
boReportDocument.Load(@"c:\Retail_Incentive_Plan\DummyReport.rpt", OpenReportMethod.OpenReportByTempCopy);
//Create a new Command Table to replace the reports current table.
CrystalDecisions.ReportAppServer.DataDefModel.CommandTable boTable =
new CrystalDecisions.ReportAppServer.DataDefModel.CommandTable();
//boMainPropertyBag: These hold the attributes of the tables ConnectionInfo object
PropertyBag boMainPropertyBag = new PropertyBag();
//boInnerPropertyBag: These hold the attributes for the QE_LogonProperties
//In the main property bag (boMainPropertyBag)
PropertyBag boInnerPropertyBag = new PropertyBag();
//Set the attributes for the boInnerPropertyBag
boInnerPropertyBag.Add("Auto Translate", "-1");
boInnerPropertyBag.Add("Server", "MyServerName");
boInnerPropertyBag.Add("Connect Timeout", "15");
boInnerPropertyBag.Add("Data Source", "vancsdb02");
boInnerPropertyBag.Add("General Timeout", "0");
boInnerPropertyBag.Add("Initial Catalog", "Retail_Incentive_Plan");
boInnerPropertyBag.Add("Integrated Security", "True");
boInnerPropertyBag.Add("Locale Identifier", "1033");
boInnerPropertyBag.Add("OLE DB Services", "-5");
boInnerPropertyBag.Add("Provider", "SQLOLEDB");
boInnerPropertyBag.Add("Tag with column collation when possible", "0");
boInnerPropertyBag.Add("Use DSN Default Properties", "False");
boInnerPropertyBag.Add("Use Encryption for Data", "0");
//Set the attributes for the boMainPropertyBag
boMainPropertyBag.Add("Database DLL", "crdb_ado.dll");
boMainPropertyBag.Add("QE_DatabaseName", "Initial Catalog=Retail_Incentive_Plan");
boMainPropertyBag.Add("QE_DatabaseType", "OLE DB (ADO)");
//Add the QE_LogonProperties we set in the boInnerPropertyBag Object
boMainPropertyBag.Add("QE_LogonProperties", boInnerPropertyBag);
boMainPropertyBag.Add("QE_ServerDescription", "MyServerName");
boMainPropertyBag.Add("QE_SQLDB", "True");
boMainPropertyBag.Add("SSO Enabled", "False");
//Create a new ConnectionInfo object
CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo boConnectionInfo =
new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();
//Pass the database properties to a connection info object
boConnectionInfo.Attributes = boMainPropertyBag;
//Set the connection kind
boConnectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
//**EDIT** Set the User Name and Password if required.
boConnectionInfo.UserName = "myUserName";
boConnectionInfo.Password = "MyPassword";
//Pass the connection information to the table
boTable.ConnectionInfo = boConnectionInfo;
//Get the Database Tables Collection for your report
CrystalDecisions.ReportAppServer.DataDefModel.Tables boTables;
boTables = boReportDocument.ReportClientDocument.DatabaseController.Database.Tables;
//For each table in the report:
// - Set the Table Name properties.
// - Set the Command table's command text.
// - Set the table location in the report to use the new modified table
boTable.Name = "Command";
boTable.QualifiedName = "Command";
boTable.Alias = "Command";
//boTable.CommandText = "select country, region, city from customer where country='usa'";
boTable.CommandText = "exec get_branch_ranking_data, 2015, 1";
boReportDocument.ReportClientDocument.DatabaseController.SetTableLocation(boTables[0], boTable);
//Verify the database after adding substituting the new table.
//To ensure that the table updates properly when adding Command tables or Stored Procedures.
boReportDocument.VerifyDatabase();
//return boReportDocument;
//**************************   End ChangeConnectionInfo   ***************************************************************************************************************
I'm sure that "vancsdb02" is incorrect in the Data Source in the code above but I'm not sure what goes there.
All of my assemblies are set in my project as well as in the top of my code.  I just didn't show it here for brevity.
Will pick up again with this on Monday.
Martin

Similar Messages

  • Dynamic Tray creation at runtime

    hi experts,
    we have a requirement where we are showing employee details in the tray UI element.
    we have 1 tray at design time showing employee details obtained from a Bapi.
    Now we need to display spouse details(if available) and children details(their number can be any~known at runtime) in seperate trays. eg each tray for 1 person..so if there are 6 children, there are 8 trays including one for employee and spouse...
    Now what I need is the source code  or method to dynamically generate tray at runtime along with the labels and textviews they contain..
    thanks in advance

    HI,
    solved the problem....
    i was doing some search here and there and finally got the code to do it. when i came back to the thread i found Ramesh suggested the same stuff which i had used.
    thanks gurus.
    I am writing my code here for other people looking for the same thing:
    IWDTransparentContainer container =(IWDTransparentContainer)view.getElement("RootUIElementContainer");
         wdContext.currentContextElement().setIpvalue("Demo Name");   //this is my context attribute.
    for(int i=1;i<3;i++)
         IWDTray tray=(IWDTray)view.createElement(IWDTray.class,null);
                   tray.setExpanded(false);
                   tray.setWidth("700px");
                   IWDLabel label=(IWDLabel)view.createElement(IWDLabel.class,null);
                   label.setText("your name is");
              IWDTextView textview1=(IWDTextView)view.createElement(IWDTextView.class,null);
              textview1.setText(wdContext.currentContextElement().getIpvalue());
              IWDLabel label1=(IWDLabel)view.createElement(IWDLabel.class,null);
              label1.setText("Employee age");
         IWDCaption caption =(IWDCaption)view.createElement(IWDCaption.class,null);
         caption.setText("WElcome to employee information");
                   tray.setHeader(caption);
         IWDLayout layout=(IWDLayout)tray.createLayout(IWDMatrixLayout.class); //setting tray layout to matrix
         IWDLayoutData layout1=(IWDLayoutData)label1.createLayoutData(IWDMatrixHeadData.class);
         tray.addChild(label);
         tray.addChild(textview1);
         tray.addChild(label1);
                   container.addChild(tray);
    P.S. Awarding points to Ramesh.

  • How to change report displayname at runtime when run from the report server?

    hi all,
    with the reportviewer widget in a winforms app, i'm able to change report displayname at runtime by handling thesubmittingparametervalues event like so:
            private void reportViewer1_SubmittingParameterValues(object sender, ReportParametersEventArgs e)
                string po = e.Parameters["Order"].Values[0];
                this.reportViewer1.ServerReport.DisplayName = "Load Out - " + po + " - " + DateTime.Now.ToShortDateString();
    question: how do i achieve the same thing when the report is run via the ssrs reportserver website?
    thanks for any tips,
    sff

    Hi sherifffruitfly2,
    According to your description, you want to change the display name of report in Report Manager. Right?
    In Reporting Services, we can't make the report file name dynamically. But we have Build-in Fields to show report name and execution time in a report. We can add a textbox and put in the expression below:
    ="Load on- "+Globals!ReportName+" "+Globals!ExecutionTime
    It will show the report name with execution time when we run the report:
    Reference:
    Built-in Collections in Expressions (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • Create dynamic report or query for piece count

    Hi abaper's
    This is a very straight forward requirement. so please give me code
    First you have to get the corresponding plant from table T320 for the given warehouse numbers in the selection screen. 
    1.     Get the sum of order qty of sales orders from the sales order tables      for the given warehouse(Plant), distribution channel and the give date      range.
    2.     Get the confirmed transfer orders qty from the TO master table where      TO confirmation date is in the given date range and WH number.
    3.     Get the total PGIed qty from the delivery master table where PGI'ed      date in the given date range, shipping point is in the corresponding      plant of the WH and for the given distribution channel.
    As you are going to use the major tables please try to write the select commands effectively to avoid further performance issues.

    How to improve the performance fo this code.....this very urgent.
    & Issue Number          : 22199                                    &
    & Programmer            : Anjaneyulu.Pabba                         &
    & Transport Number      : D01K962471                               &
    & Date of Creation      : 19/03/2008                               &
    & Description           : Dynamic report or query for piece count  &
    & Requested By          : Parvati.Polisetty                        &
    REPORT  ZR_SD_PIECE_COUNT_ALV no standard page heading
                                  line-size 255
                                  line-count 65.
                          TABLES DECLARATION
    *TABLES: T320,   "Assignment IM Storage Location to WM Warehouse Number
          VBAK,   "Sales Document: Header Data
          VBAP,   "Sales Document: Item Data
          TVKOV,  "Org. Unit: Distribution Channels per Sales Organization
          LTAK,   "WM transfer order header
          LTAP,   "Transfer order item
          LIKP,   "SD Document: Delivery Header Data
          LIPS.   "SD document: Delivery: Item data
                          TYPE-POOLS DECLARATION
    TYPE-POOLS: SLIS .
         Internal Table Declaration
    DATA : BEGIN OF TY_T320,
            WERKS TYPE WERKS_D,
            LGNUM TYPE LGNUM,
           END OF TY_T320.
    DATA : BEGIN OF TY_VBAK,
            VBELN  TYPE VBELN_VA,
            VTWEG  TYPE VTWEG,
            WERKS  TYPE WERKS_D,
            KWMENG TYPE KWMENG,
            VSTEL  TYPE VSTEL,
           END OF TY_VBAK.
    DATA : BEGIN OF TY_LTAK,
            LGNUM TYPE LGNUM,
            TANUM TYPE TANUM,
            VISTA TYPE LTAP_VISTA,
           END OF TY_LTAK.
    DATA : BEGIN OF TY_LIKP,
            VBELN TYPE VBELN_VL,
            WERKS TYPE WERKS_D,
            LFIMG TYPE LFIMG,
           END OF TY_LIKP.
    DATA : BEGIN OF TY_ITAB ,
    LGNUM  TYPE LGNUM,    "Warehouse Number / Warehouse Complex
    WERKS  TYPE WERKS_D,  "Plant
    VBELN  TYPE VBELN_VA, "Sales Document
    VTWEG  TYPE VTWEG,   "Distribution Channel
    KWMENG TYPE KWMENG,  "Cumulative order quantity in sales units
    TANUM  TYPE TANUM ,     "Transfer Order Number
    VISTA  TYPE LTAP_VISTA, "Source actual quantity in alternative
                                                 unit of measure
    LFIMG  TYPE LFIMG,  "Actual quantity delivered (in sales units)
    END OF TY_ITAB .
    DATA: T_T320 LIKE STANDARD TABLE OF TY_T320 INITIAL SIZE 0 WITH HEADER
                                                                   LINE,
          T_VBAK LIKE STANDARD TABLE OF TY_VBAK INITIAL SIZE 0 .
    DATA: T_LTAK LIKE STANDARD TABLE OF TY_LTAK INITIAL SIZE 0 WITH HEADER
                                                                    LINE.
    DATA :T_LIKP LIKE STANDARD TABLE OF TY_LIKP INITIAL SIZE 0 WITH HEADER
                                                                    LINE.
    DATA:T_ITAB LIKE STANDARD TABLE OF TY_ITAB INITIAL SIZE 0 WITH HEADER
                                                                   LINE .
    *&      Fieldcatalog Declaration
    DATA : T_FCAT TYPE SLIS_T_FIELDCAT_ALV,
           W_FCAT TYPE SLIS_FIELDCAT_ALV.
    DATA : W_LAYOUT TYPE SLIS_LAYOUT_ALV.
    ********Global Data Declaration***
    DATA :G_REPID        LIKE SY-REPID,
         G_EXIT(1)      TYPE C,
         GX_VARIANT     LIKE DISVARIANT,
         X_SAVE,                          "for Parameter I_SAVE
         GS_VARIANT TYPE DISVARIANT.      "for parameter IS_VARIANT
    data: g_lgnum type t320-lgnum,
          g_vtweg type vbak-vtweg,
          g_erdat type vbak-erdat.
    *&      Selection-Screen
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS : S_LGNUM FOR  g_lgnum, "Warehouse Number
                    S_VTWEG FOR g_vtweg, "Distribution Channel
                    S_ERDAT FOR g_erdat ."Date on which the record was
    **********"created
    SELECTION-SCREEN END OF BLOCK B1 .
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.
    PARAMETER: P_VARI LIKE DISVARIANT-VARIANT.  "Layout
    SELECTION-SCREEN END OF BLOCK B2.
    *&       INITIALIZATION EVENT
    INITIALIZATION.
      CLEAR GS_VARIANT.
    'gs_variant' must at least contain the report-id to allow
    saving a variant.
      G_REPID = SY-REPID.
    § 2.At least field REPORT of this structure has to be filled!
      GS_VARIANT-REPORT = G_REPID.
    § 3.Determine saving options.
      X_SAVE = 'A'.   "The user may save all types of variants
    *******Validating selection-screen values**********************
    getting F4 value for display variant field
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VARI.
      PERFORM F4_FOR_VARIANT.
    ****validation of F4 value of display variant
    AT SELECTION-SCREEN.
      PERFORM PAI_OF_SELECTION_SCREEN.
    *&      Start-Of-Selection
    START-OF-SELECTION.
    *****Subroutine to  select Plant from T320
      PERFORM FIND_PLANT .
    *****Subroutine to select Order Quantity from VBAP
      PERFORM ORDER_QUANTITY .
    *****Subroutine to select Transfer Order Quantity from LTAK and LTAP
      PERFORM TRANSFER_ORDER_QUANTITY.
    *****Subroutine to select TDelivery Quantity from  LIKP and LIPS
      PERFORM DELIVERY_QUANTITY.
    *&      End-Of-Selection
    END-OF-SELECTION.
    *****Subroutine for Fieldcatalog
      PERFORM FIELDCATALOG .
    *****Subroutine for Final Output
      PERFORM DISPLAY_OUTPUT .
    *&     Subroutine Implementaion
    *&      Form  FIND_PLANT
          text
    -->  p1        text
    <--  p2        text
    FORM FIND_PLANT .
      SELECT  WERKS
              LGNUM
              FROM T320
              INTO  TABLE T_T320
              WHERE LGNUM IN S_LGNUM.
    ENDFORM.                    " FIND_PLANT
    *&      Form  order_quantity
          text
    -->  p1        text
    <--  p2        text
    FORM ORDER_QUANTITY .
      SELECT VK~VBELN
             VK~VTWEG
             VP~WERKS
             VP~KWMENG
             VP~VSTEL
             INTO TABLE T_VBAK FROM VBAK AS VK
             INNER JOIN  VBAP AS VP
             ON VKVBELN = VPVBELN
             FOR ALL ENTRIES IN T_T320
             WHERE VK~VTWEG IN S_VTWEG
             AND   VK~ERDAT IN S_ERDAT
             AND   VP~WERKS = T_T320-WERKS.
    ENDFORM.                    " order_quantity
    *&      Form  Transfer_order_quantity
          text
    -->  p1        text
    <--  p2        text
    FORM TRANSFER_ORDER_QUANTITY .
      SELECT LK~LGNUM
             LK~TANUM
             LP~VISTA
             INTO TABLE T_LTAK FROM LTAK AS LK
             INNER JOIN LTAP AS LP
             ON LKLGNUM = LPLGNUM
             WHERE LK~KQUIT = 'X'
             AND   LK~BDATU IN S_ERDAT
             AND   LK~LGNUM IN S_LGNUM.
    ENDFORM.                    " Transfer_order_quantity
    *&      Form  Delivery_QUANTITY
          text
    -->  p1        text
    <--  p2        text
    FORM DELIVERY_QUANTITY .
      SELECT  VBELN WERKS LFIMG FROM LIPS
              INTO TABLE T_LIKP
              FOR ALL ENTRIES IN T_T320
              WHERE WERKS = T_T320-WERKS
              AND ERDAT IN S_ERDAT
              AND VTWEG IN S_VTWEG.
    ENDFORM.                    " Delivery_QUANTITY
    *&      Form  fieldcatalog
          text
    -->  p1        text
    <--  p2        text
    FORM FIELDCATALOG .
      W_FCAT-COL_POS       = '1' .
      W_FCAT-FIELDNAME     = 'LGNUM' .
      W_FCAT-REF_TABNAME   = 'T320'.
      W_FCAT-REF_FIELDNAME = 'LGNUM' .
      APPEND W_FCAT TO T_FCAT.
      CLEAR W_FCAT.
      W_FCAT-COL_POS       = '2' .
      W_FCAT-FIELDNAME     = 'VTWEG' .
      W_FCAT-REF_TABNAME   = 'VBAK'.
      W_FCAT-REF_FIELDNAME = 'VTWEG' .
      APPEND W_FCAT TO T_FCAT.
      CLEAR W_FCAT.
      W_FCAT-COL_POS       = '3' .
      W_FCAT-FIELDNAME     = 'KWMENG' .
      W_FCAT-REF_TABNAME   = 'VBAP'.
      W_FCAT-REF_FIELDNAME = 'KWMENG' .
    *w_fcat-seltext_m     = '# of Orders'.
      APPEND W_FCAT TO T_FCAT.
      CLEAR W_FCAT.
      W_FCAT-COL_POS       = '4' .
      W_FCAT-FIELDNAME     = 'VISTA' .
      W_FCAT-REF_TABNAME   = 'LTAP'.
      W_FCAT-REF_FIELDNAME = 'VISTA' .
    *w_fcat-seltext_m     = '# of Pcs Picked'.
      APPEND W_FCAT TO T_FCAT.
      CLEAR W_FCAT.
      W_FCAT-COL_POS       = '5' .
      W_FCAT-FIELDNAME     = 'LFIMG' .
      W_FCAT-REF_TABNAME   = 'LIPS'.
      W_FCAT-REF_FIELDNAME = 'LFIMG' .
    *w_fcat-seltext_m     = '# of Pcs Shipped'.
      APPEND W_FCAT TO T_FCAT.
      CLEAR W_FCAT.
    W_FCAT-COL_POS       = '6' .
    W_FCAT-FIELDNAME     = 'TANUM' .
    W_FCAT-REF_TABNAME   = 'LTAK'.
    W_FCAT-REF_FIELDNAME = 'TANUM' .
    **w_fcat-seltext_m     = '# of Pcs Shipped'.
    APPEND W_FCAT TO T_FCAT.
    CLEAR W_FCAT.
    W_FCAT-COL_POS       = '7' .
    W_FCAT-FIELDNAME     = 'WERKS' .
    W_FCAT-REF_TABNAME   = 'T320'.
    W_FCAT-REF_FIELDNAME = 'WERKS' .
    **w_fcat-seltext_m     = '# of Pcs Shipped'.
    APPEND W_FCAT TO T_FCAT.
    CLEAR W_FCAT.
    ENDFORM.                    " fieldcatalog
    *&      Form  display_output
          text
    -->  p1        text
    <--  p2        text
    FORM DISPLAY_OUTPUT .
      LOOP AT T_T320 INTO TY_T320.
        TY_ITAB-WERKS = TY_T320-WERKS.
        TY_ITAB-LGNUM = TY_T320-LGNUM.
        READ TABLE T_VBAK INTO TY_VBAK WITH KEY WERKS = TY_T320-WERKS.
        IF SY-SUBRC = 0.
        TY_ITAB-VBELN  = TY_VBAK-VBELN.
        TY_ITAB-VTWEG  = TY_VBAK-VTWEG.
        TY_ITAB-KWMENG = TY_VBAK-KWMENG + ty_itab-kwmeng.
        ENDIF.
        READ TABLE T_LTAK INTO TY_LTAK WITH KEY LGNUM = TY_T320-LGNUM.
        IF SY-SUBRC = 0.
        TY_ITAB-TANUM = TY_LTAK-TANUM.
        TY_ITAB-VISTA = TY_LTAK-VISTA + ty_itab-vista.
        ENDIF.
        READ TABLE T_LIKP INTO TY_LIKP WITH KEY WERKS = TY_T320-WERKS.
        IF SY-SUBRC = 0.
        TY_ITAB-LFIMG = TY_LIKP-LFIMG + ty_itab-lfimg.
        ENDIF.
        APPEND TY_ITAB TO T_ITAB.
      ENDLOOP.
    Function Module for Displaying Final Output ********
      W_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = SY-CPROG
          IS_LAYOUT          = W_LAYOUT
          IT_FIELDCAT        = T_FCAT[]
        TABLES
          T_OUTTAB           = T_ITAB.
    ENDFORM.                    " display_output
    *&      Form  f4_for_variant
          text
    -->  p1        text
    <--  p2        text
    FORM F4_FOR_VARIANT .
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          IS_VARIANT = GS_VARIANT
          I_SAVE     = X_SAVE
        IMPORTING
          E_EXIT     = G_EXIT
          ES_VARIANT = GX_VARIANT
        EXCEPTIONS
          NOT_FOUND  = 2.
      IF SY-SUBRC = 2.
        MESSAGE ID SY-MSGID TYPE 'S'      NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ELSE.
        IF G_EXIT = SPACE.
          P_VARI = GX_VARIANT-VARIANT.
        ENDIF.
      ENDIF.
    ENDFORM.                    " f4_for_variant
    *&      Form  pai_of_selection_screen
          text
    -->  p1        text
    <--  p2        text
    FORM PAI_OF_SELECTION_SCREEN .
      IF NOT P_VARI IS INITIAL.
        MOVE GS_VARIANT TO GX_VARIANT.
        MOVE P_VARI TO GX_VARIANT-VARIANT.
        CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
          EXPORTING
            I_SAVE     = X_SAVE
          CHANGING
            CS_VARIANT = GX_VARIANT.
        GS_VARIANT = GX_VARIANT.
      ELSE.
        PERFORM VARIANT_INIT.
      ENDIF.
    ENDFORM.                    " pai_of_selection_screen
    *&      Form  variant_init
          text
    -->  p1        text
    <--  p2        text
    FORM VARIANT_INIT .
      CLEAR GS_VARIANT.
      GS_VARIANT-REPORT = G_REPID.
    ENDFORM.                    " variant_init

  • Dynamic report issue

    Dears, I'm back again
    I have and issue with my dynamic report:
    My source:
    DECLARE
    vTABLE VARCHAR2(100);
    vCOLUMN VARCHAR2(100);
    vVALUE varchar2(100);
    vSQL VARCHAR2(1000);
    BEGIN
    vTABLE := :P46_TABLELIST;
    vCOLUMN:=:P46_COLUMNLIST;
    vVALUE:=:P46_COLVALUE;
         vSQL := 'SELECT '||vCOLUMN || ' FROM ' || vTABLE || 'WHERE '|| vCOLUMN ||'='||vVALUE||;
    RETURN vSQL;
    END;
    And it doesn't work fine.
    When I run it in SQL workshop i have this error :
    ORA-06550: line 11, column 88:
    PLS-00103: Encountered the symbol ";" when expecting one of the following:
    ( - + case mod new null
    avg
    count current max min prior sql stddev sum variance execute
    forall merge time timestamp interval date
    pipe
    1. DECLARE
    2. vTABLE VARCHAR2(100);
    3. vCOLUMN VARCHAR2(100);
    hx for your help
    Celio

    Celio, first you have to build function on database
    CREATE OR REPLACE FUNCTION your_function
    RETURN VARCHAR2
    IS
    vSQL varchar2(4000);
    BEGIN
    vSQL := 'SELECT '||v('P46_COLUMNLIST') || ' FROM ' ||v('P46_TABLELIST') || ' WHERE '||v('P46_COLUMNLIST') ||'='||v('P46_COLVALUE');
    RETURN vSQL;
    end;
    Second
    You have to run function in SQL region
    RETURN your_function;
    And last
    You have to check "Use Generic Column Names (parse query at runtime only)" radio and set number of column for example 1.
    Edited by: AndyPol on 2009-09-16 22:28
    Edited by: AndyPol on 2009-09-16 22:29
    Edited by: AndyPol on 2009-09-16 22:46

  • Can I create a dynamic report in the server without using a report template

    Hi,
    My company just bought a Crystal Report Server XI and it didn't have a report designer.
    I can't start creating report without the designer.
    The question is can  I generate a dynamic report at runtime (on the crystal report server ) without using report template?
    My project requirement is to use a crystal report server to manage the reports.
    Some client web application will just access this report server.
    I  hope the experts can provide me some guidance.
    regards,
    Rulix
    Edited by: Rulix Batistil on Nov 3, 2008 8:08 AM

    Hi Rulix,
    The latest version of CR Server is 2008. Therefore I'm assuming you are using CR Server 2008.
    New in CR 2008 is the .NET report modification software development kit (SDK). The report application server (RAS) SDK is now available for users of Crystal Reports .NET API without the use of a RAS server. Report modification such as changing, adding, or removing database providers, or adding, removing, or creating report objects, parameters, formulas, and sections can be achieved by accessing the RAS SDK through the Crystal Reports .NET SDK.
    Java developers however receive the JRC and Java SDK documentation through the free Crystal Reports for Eclipse download. This product will be updated on a separate schedule from Crystal Reports.
    Further Information and samples are available in our [Developer Library|https://www.sdn.sap.com/irj/sdn/businessobjects?rid=/webcontent/uuid/5001d5de-f867-2b10-00bf-8d27683c85a0]
    Kind regards,
    Tim

  • Declare dynamic internal table during runtime error

    Hi Gurus,
    I have encounter a problem here. I would like to have several block of alv list output; for each customer open items details. Thus, i need to create dynamic internal table duirng runtime as i do not know how many customers that should be output before user enter from the selection screen field for customer code.
    I tried to search in the forums and found this website [Runtime Declaration of Internal Table;.
    But when i tried to execute it, i have an error. The field symbols that i passed into the call function REUSE_ALV_BLOCK_LIST_APPEND for parameter t_outtab does not match. May i know how do i go about it?
    Or are there any other solutions to display this kind of reports? I ever think of using hierarchy list alv. But it does not match the requirement. I would like to display the total amount for each customer. Can hierarchy list able to do so? Or it can only display as the grand total at the end of the report? I think it would be best to display as alv block output.
    Your help will be much appreciated. <offer removed by moderator>
    Thanks
    Edited by: Thomas Zloch on Oct 22, 2010 11:23 AM

    the problem comes up, when there are fields in the table which represent numbers with decimals (type p). Best is to reference the field directly what comes from SAP. Replace the LOOP At idetails ... ENDLOOP with:
    LOOP AT idetails INTO xdetails.
        CLEAR xfc.
        xfc-fieldname = xfc-ref_field = xdetails-name .
        xfc-ref_table   = p_table.
    *    xfc-datatype = xdetails-type_kind.
    *    xfc-inttype = xdetails-type_kind.
    *    xfc-intlen = xdetails-length.
    *    xfc-decimals = xdetails-decimals.
        APPEND xfc TO ifc.
      ENDLOOP.

  • Dynamic report column groupings

    I'm builing an application that has a report based upon dynamic sql. It adds four columns for each store in the chain but as I don't want to redo the program everytime we add another store I am building that query string using a loop to add each extra set of columns.
    That works fine but to make the data readable I want to add columns groupings above the column headers. I can do this by adding a tag like this:
    *<th class="t5ReportHeader" colspan="4"> Academy </th>*
    for each store to the "Before Column Heading" section of my report template but that puts me back to modifying the app everytime we add a new store.
    Is there a way to modify the report template at runtime or somehow tie it to a variable that I can change so I can generate a set of tags in my application?

    Nudge

  • Dynamic Report Design - Adhoc Report

    Hi All,
    I have a requirement like designing dynamic report in the web.
    User can be able to edit the report which I am showing in the browser.
    He will pull few extra columns from the table which i used in the report.
    How is this possible.
    Please help to do this.
    I am using CR XI R2.
    Thank you,
    Saravanakumar.

    See these sample RAS Report Creation samples:
    http://wiki.sdn.sap.com/wiki/display/BOBJ/NETRASSDK+Samples#NETRASSDKSamples-Exporting%2FPrinting
    Thank you
    Don

  • Issue in Pricing Report Creation - V/LA

    Dear All,
    I have created a new pricing report in V/LA.
    Details:
    3 condition tables in the pricing configuration.
    1-SO / DC / Customer / Sales district / Material
    2-SO / DC / Customer / Material
    3-SO / DC / Material
    During report creation I select only "Material" field from the field selection screen & proceed with "AND" option.
    From Table selection screen, I select all those 3 condition tables.
    Now at executing of this report (In V/LD), I enter only "Customer" field (say customer 1000) in the selection criteria. (because I want to see all condition records exists for that customer 1000?
    When I execute the report it shows below 3 sections.
    1-SO / DC / Customer / Sales district / Material - All condition records exists for that customer/Sales District combination
    2-SO / DC / Customer / Material - All All condition records exists for that customer
    3-SO / DC / Material - All condition records maintained for Material level.
    But as per my selection criteria, system should show only 1 & 2 sections.
    How can I omit appearing sections 3 in my pricing report. ( Because I want to see condition records relevant to that customer only)
    Highly appreciate all your suggestions !!
    Thanks in advance !
    Edited by: Anupa Wijesinghe on Sep 24, 2009 8:32 AM
    Edited by: Anupa Wijesinghe on Sep 24, 2009 8:33 AM

    Dear Matthew,
    As per suggestion, I have to create 2 reports for the above requirement.
    1- with only Customer tables to see customer level prices. (For this I have to add only below 2 tables)
                          - SO / DC / Customer / Sales district / Material
                          - SO / DC / Customer / Material
    2- Other report to see material level prices. For that I have add all 3 tables.
                          - SO / DC / Customer / Sales district / Material
                          - SO / DC / Customer / Material
                          - SO / DC / Material
    So with this when user want to see price by customer, he has to select FIRST report & when he want to select price by Material, he has to select SECOND Report.
    It's not very user friendly, But yes, I can suggest it as a solution.
    Thanks for your reply ! 
    Really helpful !

  • Report Creation with Qucik Viewer(SQVI)

    Hi
    My client requirement is to get the CSO  report on the  items which are invoiced and the items are not invoiced in the CSO.
    i though i could generate the intended report wiht Quick Viewer (SQVI)
    kindly advise me how do i proceed with this kind of report.
    Regards
    TharakJReddy

    Your application is referencing the file craxDDrt.dll. In order to use this dll, you needed to obtain extra licensing. Since CR 10 has been out of support for over 5(?) years, I am not sure if you can still obtain the licensing. Contact sales at 866-681-3435 to find out.
    Alternatively, reference the craxDrt.dll. This dll does not require any extra licensing. However, the error you are getting indicates that you are using Report Creation APIs (RCAPI) from craxDDrt.dll. In my experience, there often were other ways of coding to achieve the same thing with craxdrt.dll. Let me know what RCAPIs you are using and I may be able to help out there.
    Ludek
    Follow us on Twitter http://twitter.com/SAPCRNetSup
    Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

  • How can i create an dynamic report in Java

    hello everybody,
    I want to make dynamic reports in Java. Report contain data and images with good layout.. such as crystal reports presentation..
    Reports fields decided at run time or we can say that it is generated according to user requirement...
    can it is possible in Java. If it is then which tool is better for it..
    please suggest me.. this is very urgent requirement for me...

    i don't know what types of tools are avaiable in market... Tools for what? You still didn't tell us what exactly you want to do.
    i just imagin that
    "An user create a database dynamically on server
    databaseNobody "dynamically creates a database".
    and he decide reports desgin according to
    his requirement..... we provide an control for this
    type possibilities....."
    so this is question is build in my mind.. so i
    forward this question to this forums..
    I am just going to check the physibility of my mind
    imagination...Feasibility you mean. IMHO, the feasibility of creating that stuff yourself is very low. Reinventing the wheel usually doesn't make it better, and it's likely to be more expensive to pay you for creating an inferior solution (not because of lack of skills, but simply because the available products had a few years time to grow, feature-wise) than to simply buy the licenses. Look at Crystal Reports or JFreeChart or Jasper Reports. Or use Google to look up J2EE-based reporting libraries. There might be more.
    Which of these is best, I don't know, I never used any of those. Also, the definition of "best" changes with the requirements. What's better, a Ferrari or a truck?

  • How to dynamically resize JPanel at runtime??

    Hello Sir:
    I met a problem, I need to resize a small JPanel called panel within a main Control JPanel (with null Layout) if I click the mouse then I can Drag and Resize this small JPanel Border to the size I need at runtime, I know I can use panel.setSize() or panel.setPreferredSize() methods at design time,
    But I have no idea how to do it even I search this famous fourm,
    How to dynamically resize JPanel at runtime??
    Can any guru throw some light or good example??
    Thanks

    Why are you using a null layout? Wouldn't having a layout manager help you in this situation?

  • Dynamic reporting in Crystal Reports XI

    Hi,
    Need to know about dynamic reporting feature using Crystal Reports XI.
    Is Business View helpful for dynamic reporting?
    Any link to get some material on dynamic reporting/ business views?
    appricate your comments.
    Thanks,
    Cherry

    In the SAP Service Marketplace, go to http://help.sap.com .  Under the Business Objects tab you can select Business Objects Enterprise, and in there is a Business Views Administrator Guide.  That should provide you all of the basic information on Business Views, how they work and how to use them.
    Business Views can be helpful to you depending on what you are looking to do with your data.

  • Financial Reporting making of Dynamic Reports v 11.1.1.2

    Hi,
    I have recently going through designing of a dynamic report in Financial Reporting which consists of financial representation as follows:
    There are some data which is there in the Schedules of accounts.
    Now the user wants to a make a drill down of all the account codes there in the schedule like
    schedule 13 other income.
    All the account codes in Schedule should bw drill down which I am able to make.
    Now for each account codes they want a sorting in descending order to find out which entity is contributing to how much revenue for the oraganistion or
    similarly for the cost which are in other schedules like 14,15,16 tc.
    After that they want a insertion of cell text function for each cell having a combination of account codes and entity which is having a adverse variance and analsis
    for the same.
    If someone can throw a light on this about how to do this.

    I think you have already posted this problem on another post, I said it is possible it could be a ports issue.
    Have a look at the following http://www.oracle.com/technetwork/middleware/bi-foundation/epm-component-communications-11121-354680.xls
    Select FR studio as the client and it should give indication to the ports that need to be opened.
    Cheers
    John
    http://john-goodwin.blogspot.com/

Maybe you are looking for

  • CRM5.2 UI-Call a dynamic URL on button click

    Hi all,             My requirement is to call a dynamic url on the click of a button in the overview page. I have added a custom button in  the method  IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS , and the related code in do_handle_event.I have created a

  • Conversion Agent Java API

    I'm looking for Conversion Agent Java API. Would you please advise where I can find this API. Thanks.

  • Resolution 1920x1080 pixelated

    I am using a Nvidia GeForce GTX 470 graphics card with the proprietary nvidia driver. When I set the resolution to something different than 1600x1200 pixels, all icons and fonts look pixelated. I would like to use the native resolution of 1920x1080 o

  • Problem Printing Report From Oracle Alert

    I cannot get it to print. I have an Oracle Alert which spawns a concurrent program which runs an Oracle Report. The report runs but does not print since there seems to be no way in which to pass the number of copies to Oracle Reports. This is probabl

  • I can't create an icloud account from my occasion iphone 5. I don't know why...

    I bought before some days an occasion iphone 5, but always when I like to create an icloud account, in final of the process, it appears a message like that "This device (iphone) is not allowed to create a free icloud". what I must do?