Problem displaying data in Excel with Jsp

HI,
For some reason when i save data from jsp to excel, my Excel dont display data.This code was working fine from past 3 years all of sudden it starts givin this problem.
However When i open my .xls file in notepad i see data there. The problem is because of XML declaration (<?xml version="1.0" encoding="UTF-8"?> which parsed generate. If i remove this it works fine.
Out put in file looks like this
<?xml version="1.0" encoding="UTF-8"?>
<table border=1 width="100%">
<tr>
<TH>Name</TH>
<TH>Last Name</TH>
<TH>state</TH>
<TH>Country</TH>
<TH>Currency</TH>
</tr>
<tr>
<TD class="odd">John</TD>
<TD class="odd">Hayden</TD>
<TD class="odd">IL</TD>
<TD class="odd">USA</TD>
<TD class="odd">USD</TD>
</tr>
<tr>
<tr>
<TD class="odd">Ricky</TD>
<TD class="odd">Ponting</TD>
<TD class="odd">IL</TD>
<TD class="odd">USA</TD>
<TD class="odd">EUR</TD>
</tr>
</tr>
</table>
Jsp Code
String rptHTML = (String)session.getAttribute("ReportStrHTML");
     System.out.println(rptHTML);
     response.setHeader("Content-Disposition","attachment;filename=Test.xls");
     response.setContentType("application/vnd.ms-excel");
Thanks

In Excel, Tools > Macro > security > medicum and Trusted tab check To access VB.

Similar Messages

  • Upload data from excel with vba by calling a function module

    Hello all,
    i have a problem with the function module "ALSM_EXCEL_TO_INTERNAL_TABLE". I will call this function module with vba to load data from excel to sap with a Buttonclick. I have copied this function module and set it remotable. But i can´t call it from excel.
    Can you give me some tips how can i
    upload data from excel with vba by click a button.
    The problem seems the function: call method cl_gui_frontend_services=>clipboard_import in the function module, because when i comment this function call the vba-call is true but no results. 
    How can I call the function module correct with vba?
    Thanks a lot for your tips!!!!
    Chris
    Message was edited by:
            Christoph Kirschner

    HI
    Uploading data directly from Excel file format
    * Upload data direct from excel.xls file to SAP
    REPORT ZEXCELUPLOAD.
    PARAMETERS: filename LIKE rlgrap-filename MEMORY ID M01,
                begcol TYPE i DEFAULT 1 NO-DISPLAY,
                begrow TYPE i DEFAULT 1 NO-DISPLAY,
                endcol TYPE i DEFAULT 100 NO-DISPLAY,
                endrow TYPE i DEFAULT 32000 NO-DISPLAY.
    * Tick don't append header
    PARAMETERS: kzheader AS CHECKBOX.
    DATA: BEGIN OF intern OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern.
    DATA: BEGIN OF intern1 OCCURS 0.
            INCLUDE STRUCTURE  alsmex_tabline.
    DATA: END OF intern1.
    DATA: BEGIN OF t_col OCCURS 0,
           col LIKE alsmex_tabline-col,
           size TYPE i.
    DATA: END OF t_col.
    DATA: zwlen TYPE i,
          zwlines TYPE i.
    DATA: BEGIN OF fieldnames OCCURS 3,
            title(60),
            table(6),
            field(10),
            kz(1),
          END OF fieldnames.
    * No of columns
    DATA: BEGIN OF data_tab OCCURS 0,
           value_0001(50),
           value_0002(50),
           value_0003(50),
           value_0004(50),
           value_0005(50),
           value_0006(50),
           value_0007(50),
           value_0008(50),
           value_0009(50),
           value_0010(50),
           value_0011(50),
           value_0012(50),
           value_0013(50),
           value_0014(50),
           value_0015(50),
           value_0016(50),
           value_0017(50),
           value_0018(50),
           value_0019(50),
           value_0020(50),
           value_0021(50),
           value_0022(50),
           value_0023(50),
           value_0024(50),
           value_0025(50),
           value_0026(50),
           value_0027(50),
           value_0028(50),
           value_0029(50),
           value_0030(50),
           value_0031(50),
           value_0032(50),
           value_0033(50),
           value_0034(50),
           value_0035(50),
           value_0036(50),
           value_0037(50),
           value_0038(50),
           value_0039(50),
           value_0040(50),
           value_0041(50),
           value_0042(50),
           value_0043(50),
           value_0044(50),
           value_0045(50),
           value_0046(50),
           value_0047(50),
           value_0048(50),
           value_0049(50),
           value_0050(50),
           value_0051(50),
           value_0052(50),
           value_0053(50),
           value_0054(50),
           value_0055(50),
           value_0056(50),
           value_0057(50),
           value_0058(50),
           value_0059(50),
           value_0060(50),
           value_0061(50),
           value_0062(50),
           value_0063(50),
           value_0064(50),
           value_0065(50),
           value_0066(50),
           value_0067(50),
           value_0068(50),
           value_0069(50),
           value_0070(50),
           value_0071(50),
           value_0072(50),
           value_0073(50),
           value_0074(50),
           value_0075(50),
           value_0076(50),
           value_0077(50),
           value_0078(50),
           value_0079(50),
           value_0080(50),
           value_0081(50),
           value_0082(50),
           value_0083(50),
           value_0084(50),
           value_0085(50),
           value_0086(50),
           value_0087(50),
           value_0088(50),
           value_0089(50),
           value_0090(50),
           value_0091(50),
           value_0092(50),
           value_0093(50),
           value_0094(50),
           value_0095(50),
           value_0096(50),
           value_0097(50),
           value_0098(50),
           value_0099(50),
           value_0100(50).
    DATA: END OF data_tab.
    DATA: tind(4) TYPE n.
    DATA: zwfeld(19).
    FIELD-SYMBOLS: <fs1>.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
           EXPORTING
                mask      = '*.xls'
                static    = 'X'
           CHANGING
                file_name = filename.
    START-OF-SELECTION.
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           EXPORTING
                filename                = filename
                i_begin_col             = begcol
                i_begin_row             = begrow
                i_end_col               = endcol
                i_end_row               = endrow
           TABLES
                intern                  = intern
           EXCEPTIONS
                inconsistent_parameters = 1
                upload_ole              = 2
                OTHERS                  = 3.
      IF sy-subrc <> 0.
        WRITE:/ 'Upload Error ', SY-SUBRC.
      ENDIF.
    END-OF-SELECTION.
      LOOP AT intern.
        intern1 = intern.
        CLEAR intern1-row.
        APPEND intern1.
      ENDLOOP.
      SORT intern1 BY col.
      LOOP AT intern1.
        AT NEW col.
          t_col-col = intern1-col.
          APPEND t_col.
        ENDAT.
        zwlen = strlen( intern1-value ).
        READ TABLE t_col WITH KEY col = intern1-col.
        IF sy-subrc EQ 0.
          IF zwlen > t_col-size.
            t_col-size = zwlen.
    *                          Internal Table, Current Row Index
            MODIFY t_col INDEX sy-tabix.
          ENDIF.
        ENDIF.
      ENDLOOP.
      DESCRIBE TABLE t_col LINES zwlines.
      SORT intern BY row col.
      IF kzheader = 'X'.
        LOOP AT intern.
          fieldnames-title = intern-value.
          APPEND fieldnames.
          AT END OF row.
            EXIT.
          ENDAT.
        ENDLOOP.
      ELSE.
        DO zwlines TIMES.
          WRITE sy-index TO fieldnames-title.
          APPEND fieldnames.
        ENDDO.
      ENDIF.
      SORT intern BY row col.
      LOOP AT intern.
        IF kzheader = 'X'
        AND intern-row = 1.
          CONTINUE.
        ENDIF.
        tind = intern-col.
        CONCATENATE 'DATA_TAB-VALUE_' tind INTO zwfeld.
        ASSIGN (zwfeld) TO <fs1>.
        <fs1> = intern-value.
        AT END OF row.
          APPEND data_tab.
          CLEAR data_tab.
        ENDAT.
      ENDLOOP.
      CALL FUNCTION 'DISPLAY_BASIC_LIST'
           EXPORTING
                file_name     = filename
           TABLES
                data_tab      = data_tab
                fieldname_tab = fieldnames.
    *-- End of Program
    <b>Excel Upload Alternative - KCD_EXCEL_OLE_TO_INT_CONVERT</b>
    *Title : Excel Uploading
    TYPES:   BEGIN OF t_datatab,
             col1(25)  TYPE c,
             col2(30)  TYPE c,
             col3(30)  TYPE c,
             col4(30)  TYPE c,
             col5(30)  TYPE c,
             col6(30)  TYPE c,
             col7(30) TYPE c,
             col8(30)  TYPE c,
             col9(30)  TYPE c,
             col10(30)  TYPE c,
             col11(30)    TYPE c,
           END OF t_datatab.
    DATA: it_datatab TYPE STANDARD TABLE OF t_datatab INITIAL SIZE 0,
          wa_datatab TYPE t_datatab.
    Data : p_table type t_datatab occurs 0 with header line.
    DATA : gd_scol   TYPE i VALUE '1',
           gd_srow   TYPE i VALUE '1',
           gd_ecol   TYPE i VALUE '256',
           gd_erow   TYPE i VALUE '65536'.
    DATA: it_tab TYPE filetable,
          gd_subrc TYPE i.
    field-symbols : <fs>.
    *Selection screen definition
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS:  p_file LIKE rlgrap-filename
                   DEFAULT 'c:test.xls' OBLIGATORY.   " File Name
    SELECTION-SCREEN END OF BLOCK b1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
      REFRESH: it_tab.
      CALL METHOD cl_gui_frontend_services=>file_open_dialog
        EXPORTING
          window_title     = 'Select File'
          default_filename = '*.xls'
          multiselection   = ' '
        CHANGING
          file_table       = it_tab
          rc               = gd_subrc.
      LOOP AT it_tab INTO p_file.
    *    so_fpath-sign = 'I'.
    *    so_fpath-option = 'EQ'.
    *    append so_fpath.
      ENDLOOP.
    START-OF-SELECTION.
      PERFORM upload_excel_file TABLES   it_datatab
                                 USING   p_file
                                         gd_scol
                                         gd_srow
                                         gd_ecol
                                         gd_erow.
    * END-OF-SELECTION.
    END-OF-SELECTION.
      LOOP AT it_datatab INTO wa_datatab.
        WRITE:/ wa_datatab-col1,
                wa_datatab-col2,
                wa_datatab-col3,
                wa_datatab-col4,
                wa_datatab-col5,
                wa_datatab-col6,
                wa_datatab-col7,
                wa_datatab-col8,
                wa_datatab-col9,
                wa_datatab-col10,
                wa_datatab-col11.
      ENDLOOP.
    *&      Form  UPLOAD_EXCEL_FILE
    *       upload excel spreadsheet into internal table
    *      -->P_TABLE    Table to return excel data into
    *      -->P_FILE     file name and path
    *      -->P_SCOL     start column
    *      -->P_SROW     start row
    *      -->P_ECOL     end column
    *      -->P_EROW     end row
    FORM upload_excel_file TABLES   p_table
                           USING    p_file
                                    p_scol
                                    p_srow
                                    p_ecol
                                    p_erow.
      DATA : lt_intern TYPE  kcde_cells OCCURS 0 WITH HEADER LINE.
    * Has the following format:
    *             Row number   | Colum Number   |   Value
    *      i.e.     1                 1             Name1
    *               2                 1             Joe
      DATA : ld_index TYPE i.
    * Note: Alternative function module - 'ALSM_EXCEL_TO_INTERNAL_TABLE'
      CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
        EXPORTING
          filename                = p_file
          i_begin_col             = p_scol
          i_begin_row             = p_srow
          i_end_col               = p_ecol
          i_end_row               = p_erow
        TABLES
          intern                  = LT_INTERN
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
        FORMAT COLOR COL_BACKGROUND INTENSIFIED.
        WRITE:/ 'Error Uploading file'.
        EXIT.
      ENDIF.
      IF lt_intern[] IS INITIAL.
        FORMAT COLOR COL_BACKGROUND INTENSIFIED.
        WRITE:/ 'No Data Uploaded'.
        EXIT.
      ELSE.
        SORT lt_intern BY row col.
        LOOP AT lt_intern.
         MOVE lt_intern-col TO ld_index.
         assign component ld_index of structure
         p_table to <fs>.
    move : lt_intern-value to <fs>.
    *     MOVE lt_intern-value TO p_table.
          AT END OF row.
            APPEND p_table.
            CLEAR p_table.
          ENDAT.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    "UPLOAD_EXCEL_FILE
    Regards
    Pavan

  • Display data in excel

    Hi, I have program which display data in Excel layout of ALV loaded from internal table..
    It means that in sap i received excel sheet with all its functionality.
    The problem is that sometimes there are missed some rows with data.
    Did someone meet with similar situation?
    Regards,
    Joanna

    HI
    DATA: v_file LIKE rlgrap-filename,
            v_filename TYPE string.
      REFRESH i_matcontrol.
      CLEAR   i_matcontrol.
      TRANSLATE v_exten TO UPPER CASE.
      IF v_exten = 'XLS'.
        v_file = p_p_file.
        CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
          EXPORTING
            i_field_seperator    = 'X'
            i_tab_raw_data       = ws_rawdata
            i_filename           = v_file
          TABLES
            i_tab_converted_data = i_data.
      ELSEIF v_exten = 'TXT'.
        v_filename = p_p_file.
    File upload
        CALL FUNCTION 'GUI_UPLOAD'
          EXPORTING
            filename                = v_filename
            filetype                = 'ASC'
            has_field_separator     = 'T'
          TABLES
            data_tab                = i_data
          EXCEPTIONS
            file_open_error         = 1
            file_read_error         = 2
            no_batch                = 3
            gui_refuse_filetransfer = 4
            invalid_type            = 5
            no_authority            = 6
            unknown_error           = 7
            bad_data_format         = 8
            header_not_allowed      = 9
            separator_not_allowed   = 10
            header_too_long         = 11
            unknown_dp_error        = 12
            access_denied           = 13
            dp_out_of_memory        = 14
            disk_full               = 15
            dp_timeout              = 16
            OTHERS                  = 17.
        CASE sy-subrc.
          WHEN 1.
            MESSAGE e001(00) WITH text-001.
            STOP.
          WHEN 2.
            MESSAGE e001(00) WITH text-002.
            STOP.
          WHEN 0.
            IF i_data IS INITIAL.
              MESSAGE s001(00) WITH text-008.
            ENDIF.
        ENDCASE.
      ENDIF.
      DELETE i_data WHERE matnr IS INITIAL AND
                                  werks IS INITIAL.

  • Displaying data in xml using jsp

    how do we display data in database from jsp using xlst format in xml browser view

    how do we display data in database from jsp using xlst
    format in xml browser viewRefer this Post
    http://forum.java.sun.com/thread.jsp?forum=45&thread=482077&tstart=0&trange=15
    -Regards
    Manikantan

  • Date can not display correctly in excel from .jsp

    Hi,
    I create a .jsp report to export the data to excel. the report run OK, except the date field can not display correctly.
    for example in database :start date ='01-oct-2003'
    in the except it displays to 02/06/02.
    It seem all the date field can not be control in the report, and control by somthing else
    Doese anyone come accross this problem?
    Thanks

    Hi Rong,
    Are you using the following demonstration to build your JSP?
    http://otn.oracle.com/products/reports/htdocs/getstart/demonstrations/index.html
    (Output to Excel with Oracle9i Report)
    I tried to do the same, and inserted a database date field in the JSP using Reports. I found the following:
    While making the template inside Excel, if I make sure that the format of the date cells is "Date" - some particular date format, the date field values from Reports does not get exported correctly.
    However, if you make sure that inside the template, the format of the date cells is not date, but "General", then the date field values are correctly exported to Excel.
    Pl try it and let us know.
    Navneet.

  • Problem displaying data in Crystal Viewer

    Hi,
    First time posting on here, so apologies if I've got the wrong thread....
    Currently developing an application that uses ASP, via a COM+ object to connect to SQL Server 2005 Db.  My problem is that since the users default printer might not be visible on the application server anymore, we have had to use a Crystal viewer on the front end to print.  To do this we have moved some code from the COM+ and placed it in an asp page. 
    This page then creates a connection and runs a stored procedure, putting the results of the query into a recordset.  This is then used to populate CrystalRuntime Application, Report and PageEngine objects.  This page #Includes the SmartViewerActiveX.asp file which then in turn calls rptserver.asp.
    The viewer is displayed on the screen, but with the fields displaying only the field types, no data from the Db is displayed.  I have no idea why and am at my wits end!!!   Can anyone give any advice or hints that I could investigate.  I've never used Crystal Viewer before and could do with any helpfull advice.   The SmartViewerActiveX.asp and rptserver.asp files have not been ameneded.  Do I need to do anything with the ttx files????
    Thanks in advance....
    Code of the originating asp page :-
    <object runat=server progid = Print.print id=objPrint></object>
    <object runat=server progid = com.session id=objSession></object>
    <object runat=server progid = com.login id=objLogin></object>
    <object runat=server progid = com.request id=objRequest></object>
    <!#INCLUDE FILE="gen_funcs.asp">
    <!#INCLUDE FILE="adovbs.inc">
    <%
         Dim rsSession
         Dim strUserID
         Dim iUserType
         Dim strSalutation1
         Dim strNewRequestASP
         Dim rsDetails     
         Dim varRetValue
         Dim Comm
         Dim Conn
         Dim ADORs
         Dim adoRS1
         Dim adoRS2
         Dim adoRS3
         Dim oApp
         Dim oRpt
         Dim oPageEngine
         strUserID = getWindowsLogIn
         'Retrieve Session Data from session object
         Set rsSession = objSession.GetDetails(strUserID)
         strSalutation = rsSession.Fields("login_data")
         iUserType = rsSession.Fields("user_type")
         Set rsSession = Nothing
         varRetValue = "true"
    If IsObject(session("oRpt")) then
         Set session("oRpt") = nothing
    End if 
    set Comm = Server.CreateObject("ADODB.Command")
    set Conn = Server.CreateObject("ADODB.Connection")
    set session("AdoRS") = Server.CreateObject("ADODB.Recordset")
    Comm.CommandTimeout=60
    mStr = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Initial Catalog=DEV;Data Source=GBNBS1501;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=GBNBS0500;Use Encryption for Data=False;Tag with column collation when possible=False"
    mstr=replace(mstr, "Integrated Security=SSPI;","")
    Conn.Open Mstr & ";Trusted_Connection=no", "crystaluser", "crystalpassword"
    set Comm.ActiveConnection = Conn
    Comm.CommandText = "usp_get_customer_letter"
    Comm.CommandType = adCmdStoredProc
    Comm.Parameters.Append Comm.CreateParameter("@requestID", adBigInt, adParamInput, 8, Request.QueryString("RequestID"))
    set session("AdoRS") = Comm.Execute
    If Not IsObject (session("oApp")) Then                             
         set session("oApp") = Server.CreateObject("CrystalRuntime.Application.11")
    End If
    If IsObject(session("oRpt")) then
         Set session("oRpt") = nothing
    End if
    'This "While/Wend" loop is used to determine the physical path (eg: C:\) to the
    'Crystal Report file by translating the URL virtual path (eg: http://Domain/Dir) 
    dim path
    Path = Request.ServerVariables("PATH_TRANSLATED")                    
    While (Right(Path, 1) <> "\" And Len(Path) <> 0)                     
    iLen = Len(Path) - 1                                                 
    Path = Left(Path, iLen)                                              
    Wend                                                                               
    path=path + "Reports\"
    set session("oRpt") = session("oApp").OpenReport(path & "Letter.rpt", 1) 
    session("oRpt").MorePrintEngineErrorMessages = False
    session("oRpt").EnableParameterPrompting = False
    session("oRpt").DiscardSavedData
    Set crDatabase = session("oRpt").Database
    Set crTables = crDatabase.Tables
    Set crTable = crTables.Item(1)
    crTable.SetPrivateData 3, session("AdoRS")
    on error resume next
         adoRS1 = objPrint.GetSubReportSuccessful(Request.QueryString("RequestID"))
         adoRS2 = objPrint.GetSubReportUnsuccessful(Request.QueryString("RequestID"))
            'This section adds subreport data for successful traces to the letter
         If adoRS1.EOF = False Then
                 Set crSections = session("oRpt").Sections
                  For x = 1 To crSections.Count
                      Set crSection = crSections(x)
                      Set crReportObjs = crSection.ReportObjects
                          For y = 1 To crReportObjs.Count
                              If crReportObjs.Item(y).Kind = crSubreportObject Then
                                  Set crSubreportObj = crReportObjs.Item(y)
                                  If crSubreportObj.Name = "Schemes" Or crSubreportObj.Name = "WelshSchemes" Then
                                      Set crSubreport = session("oRpt").OpenSubreport(crReportObjs(y).Name)
                                      crSubreport.DiscardSavedData
                                      Set crDatabase = crSubreport.Database
                                      Set crTables = crDatabase.Tables
                                      Set crTable = crTables.Item(1)
                                      crTable.SetPrivateData 3, adoRS1
                                  End If
                              End If
                          Next
                  Next
              End If
            'This section adds subreport data for unsuccessful traces to the letter
               If adoRS2.EOF = False Then
                 Set crSections = session("oRpt").Sections
                  For x = 1 To crSections.Count
                      Set crSection = crSections(x)
                      Set crReportObjs = crSection.ReportObjects
                          For y = 1 To crReportObjs.Count
                             If crReportObjs.Item(y).Kind = crSubreportObject Then
                                  Set crSubreportObj = crReportObjs.Item(y)
                                  If crSubreportObj.Name = "Unsuccessful_traces" Then
                                      Set crSubreport = oRpt.OpenSubreport(crReportObjs(y).Name)
                                      crSubreport.DiscardSavedData
                                      Set crDatabase = crSubreport.Database
                                      Set crTables = crDatabase.Tables
                                      Set crTable = crTables.Item(1)
                                      crTable.SetPrivateData 3, adoRS2
                                  End If
                              End If
                          Next
                  Next
              End If
    session("oRpt").ReadRecords
    If IsObject(session("oPageEngine")) Then                             
         set session("oPageEngine") = nothing
    End If
    set session("oPageEngine") = session("oRpt").PageEngine
    set Conn = nothing
    set Comm = nothing
    %>
    <!-- #include file="SmartViewerActiveX.asp" -->
    <%

    Here's the code...
    <object runat=server progid = Print.print id=objPrint></object>
    <object runat=server progid = com.session id=objSession></object>
    <object runat=server progid = com.login id=objLogin></object>
    <object runat=server progid = com.request id=objRequest></object>
    <!#INCLUDE FILE="gen_funcs.asp">
    <!#INCLUDE FILE="adovbs.inc">
    <%
         Dim rsSession
         Dim strUserID
         Dim iUserType
         Dim strSalutation1
         Dim strNewRequestASP
         Dim rsDetails     
         Dim varRetValue
         Dim Comm
         Dim Conn
         Dim ADORs
         Dim adoRS1
         Dim adoRS2
         Dim adoRS3
         Dim oApp
         Dim oRpt
         Dim oPageEngine
         strUserID = getWindowsLogIn
         'Retrieve Session Data from session object
         Set rsSession = objSession.GetDetails(strUserID)
         strSalutation = rsSession.Fields("login_data")
         iUserType = rsSession.Fields("user_type")
         Set rsSession = Nothing
         varRetValue = "true"
    If IsObject(session("oRpt")) then
         Set session("oRpt") = nothing
    End if 
    set Comm = Server.CreateObject("ADODB.Command")
    set Conn = Server.CreateObject("ADODB.Connection")
    set session("AdoRS") = Server.CreateObject("ADODB.Recordset")
    Comm.CommandTimeout=60
    mStr = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=sa;Initial Catalog=DEV;Data Source=GBNBS1501;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=GBNBS0500;Use Encryption for Data=False;Tag with column collation when possible=False"
    mstr=replace(mstr, "Integrated Security=SSPI;","")
    Conn.Open Mstr & ";Trusted_Connection=no", "crystaluser", "crystalpassword"
    set Comm.ActiveConnection = Conn
    Comm.CommandText = "usp_get_customer_letter"
    Comm.CommandType = adCmdStoredProc
    Comm.Parameters.Append Comm.CreateParameter("@requestID", adBigInt, adParamInput, 8, Request.QueryString("RequestID"))
    set session("AdoRS") = Comm.Execute
    If Not IsObject (session("oApp")) Then                             
         set session("oApp") = Server.CreateObject("CrystalRuntime.Application.11")
    End If
    If IsObject(session("oRpt")) then
         Set session("oRpt") = nothing
    End if
    'This "While/Wend" loop is used to determine the physical path (eg: C:\) to the
    'Crystal Report file by translating the URL virtual path (eg: http://Domain/Dir) 
    dim path
    Path = Request.ServerVariables("PATH_TRANSLATED")                    
    While (Right(Path, 1) <> "\" And Len(Path) <> 0)                     
    iLen = Len(Path) - 1                                                 
    Path = Left(Path, iLen)                                              
    Wend                                                                               
    path=path + "Reports\"
    set session("oRpt") = session("oApp").OpenReport(path & "Letter.rpt", 1) 
    session("oRpt").MorePrintEngineErrorMessages = False
    session("oRpt").EnableParameterPrompting = False
    session("oRpt").DiscardSavedData
    Set crDatabase = session("oRpt").Database
    Set crTables = crDatabase.Tables
    Set crTable = crTables.Item(1)
    crTable.SetPrivateData 3, session("AdoRS")
    on error resume next
         adoRS1 = objPrint.GetSubReportSuccessful(Request.QueryString("RequestID"))
         adoRS2 = objPrint.GetSubReportUnsuccessful(Request.QueryString("RequestID"))
            'This section adds subreport data for successful traces to the letter
            If adoRS1.EOF = False Then
                 Set crSections = session("oRpt").Sections
                  For x = 1 To crSections.Count
                      Set crSection = crSections(x)
                      Set crReportObjs = crSection.ReportObjects
                          For y = 1 To crReportObjs.Count
                              If crReportObjs.Item(y).Kind = crSubreportObject Then
                                  Set crSubreportObj = crReportObjs.Item(y)
                                  If crSubreportObj.Name = "Schemes" Or crSubreportObj.Name = "WelshSchemes" Then
                                      Set crSubreport = session("oRpt").OpenSubreport(crReportObjs(y).Name)
                                      crSubreport.DiscardSavedData
                                      Set crDatabase = crSubreport.Database
                                      Set crTables = crDatabase.Tables
                                      Set crTable = crTables.Item(1)
                                      crTable.SetPrivateData 3, adoRS1
                                  End If
                              End If
                          Next
                  Next
              End If
            'This section adds subreport data for unsuccessful traces to the letter
               If adoRS2.EOF = False Then
                 Set crSections = session("oRpt").Sections
                  For x = 1 To crSections.Count
                      Set crSection = crSections(x)
                      Set crReportObjs = crSection.ReportObjects
                          For y = 1 To crReportObjs.Count
                             If crReportObjs.Item(y).Kind = crSubreportObject Then
                                  Set crSubreportObj = crReportObjs.Item(y)
                                  If crSubreportObj.Name = "Unsuccessful_traces" Then
                                      Set crSubreport = oRpt.OpenSubreport(crReportObjs(y).Name)
                                      crSubreport.DiscardSavedData
                                      Set crDatabase = crSubreport.Database
                                      Set crTables = crDatabase.Tables
                                      Set crTable = crTables.Item(1)
                                      crTable.SetPrivateData 3, adoRS2
                                  End If
                              End If
                          Next
                  Next
              End If
    session("oRpt").ReadRecords
    If IsObject(session("oPageEngine")) Then                             
         set session("oPageEngine") = nothing
    End If
    set session("oPageEngine") = session("oRpt").PageEngine
    set Conn = nothing
    set Comm = nothing
    %>
    <!-- #include file="SmartViewerActiveX.asp" -->
    <%

  • ALV: Problem in exporting to excel with too many columns

    Hi,
    While exporting from ALV report to excel following issue was faced:
    ALV report contains 81 columns out of which 67 columns are displayed properly but from 68th column onwards data is dispalyed on next row
    I want all columns displayed on single row..
    Any help will greatly appreciated..
    Thanks,
    Deepak

    Hi Deepak,
    I was browsing through these threads to find anwer for the same issue.
    So thought of putting my analysis which helped me resolve my problem.
    Analysis/Solution:
    When we export ALV data to excel worksheet, as sap notes say the maximum lenght allowed is 1023 charaters and the max no of columns supported is 90.
    (I never faced any issue related to no of columns as it worked fine for columns >90 too)
    Issue occured when row size of exported data gets more than 1023 character.
    Therefore the row data must not exceed 1023 character, otherwise column splits and moves to next row.
    One additional aspect generally missed is that:
    When data in any particular column changes it's length, alv header also changes its lengh (short text, medium text, long text; depending on the length of of the longest cell in the column)
    therefore even if you have total length of row less than 1023 character, there might be cases when your ALV header size exceeds this length.
    Hopefully it will be helpful for you too.
    Regards,
    Parveen

  • Error displaying data in Excel Layout of ALV

    Hi,
    I am trying to display ALV data in a Excel layout. After changing the layout i am not able to view the data, rather the excel template is alone displayed.
    Is there setting that i am supposed. I did not try this on a  custom report but i used SE16 to display data.
    Any help will be really appreciated!!!
    Thanks in advance,
    Kathirvel

    Hi,
    Please make sure that you have made a <b>global</b>
    <b>declaration</b> for the ALV Grid control.If not try
    with this
    Please reward points if this explanation is useful.
    Regards,
    Siva

  • Excel with JSP

    Hi everyone
    I relly do need some help...
    I have an Oracle Database and I need to:
    1. View my results (of any request) in an excel spreadsheet using JSP (I think this part is the easiest...)
    2. And that is my real problem: Use an excel spreadsheet to insert values in the database with JSP...
    I hope I made it clear because even for me it's really tricky...
    Thanks a lot...
    Yassi

    There is a example in Marty Hal;l's book"Core Servlets and JSP pages".
    It is static, but the same idea would work coming from a database.
    <HTML>
    <HEAD>
    <TITLE>Comparing Apples and Oranges</TITLE>
    </HEAD>
    <BODY>
    <CENTER>
    <H2>Comparing Apples and Oranges</H2>
    <%
    String format = request.getParameter("format");
    if ((format != null) && (format.equals("excel"))) {
    response.setContentType("application/vnd.ms-excel");
    %>
    <TABLE BORDER=1>
    <TR><TH></TH><TH>Apples<TH>Oranges
    <TR><TH>First Quarter<TD>2307<TD>4706
    <TR><TH>Second Quarter<TD>2982<TD>5104
    <TR><TH>Third Quarter<TD>3011<TD>5220
    <TR><TH>Fourth Quarter<TD>3055<TD>5287
    </TABLE>
    </CENTER>
    </BODY>
    </HTML>

  • Problem Displaying data from oracle in JTable

    Please can any one help me? I have a problem displaying the data fetched from oracle database(ResultSet) in JTables. Can any one provide me with any possible way out(and any alternative).

    User,
    As suggested in the other post - Google/Books/find a mentor is the best option.

  • Problem displaying a related field with an ADF Table

    I am trying to use an ADF table to display data that is setup with TopLink as a one-to-one mapping. The database table is the TICKET table and it has a field STATUS_ID. I would like to display the STATUS from the STATUS table instead of the STATUS_ID. The STATUS table has a STATUS_ID key and the ticket table is setup with a FK constraint on the STATUS table.
    I have two objects, Ticket and Status, that were created from the TopLink reverse engineer. I have created the TopLink mapping and generated the data controls ( this is the same process I used when going through the SRdemo). From the data control palette I dragged the FindAllTickets to my listTicket,jspx page and it shows a menu of options. I selected the ADF Read only table option and the only fields available in the dialog are from the TICKET table??
    The ADF table works and display all the data in the TICKET table but I have not been able to add another column to show the status from the STATUS table. There is a node under the findAllTickets data controlI for the Status. I dragged the individual fields over as ADF output test I can see the data from all the fields including the STATUS.STATUS field but I only see the last row. Also,this is not in a table format.
    Does anyone know how to set this up with an ADF table or is there a better way?
    Thank you
    Todd

    Hello,
    I'm encountering the same problem. One solution seems to use business components (a view object based on many entitiy objects) as described in the ADFBC tutorial, but like you i've based my development on the ADF tutorial and i think there is a solution but i didn't find it for the moment. I'm keep looking for a solution and if i find something, i'll send it to you.
    Good luck
    tif

  • Problems Displaying data from RFC on Adobe Forms

    Hi,
    I have some Problems with creating an Adobe Form and hope, someone can help me or give me some hinds to some tutorials, which can help me.
    I'm developing an webdynpro-application which get data from a R/3 via RFC-Call.
    Context-Binding and so on is done and works. I created also an interactive form and can display some datas on it.
    Here my questions:
    I have an field 'unit' which shoulb be displayed on several positions onto the form. My problem is, i can display it only once. If i copy the field, there is no output in it. What can i do, to solve the problem?
    From the RFC i get a table with several rows of data, i want to display on the form.
    With drag&drop i can place the fields onto the form but they are displayed only once. I want one line for every row from the table.
    What do i have to do? Are there tutorials which show the steps?
    When I am not using a form, i can display the data from RFC in a table with no problems (i create a table ui and choose create binding from context menue). Are the nescessary steps for displaying the data on an interactive form the same.
    I read something about creating a dynamic form design. Do i have to create it? What are the steps i have to do.
    Many questions, but i hope that someone can give me some helpful hints.
    Many thanks
    Mathias Lange

    Hi Mathias,
    If I caught you correctly, you want to display data in Adobe forms in form of tabel, right?
    So, follow the steps:
    1. Insert one sub form on your adobe form.
    2. Set its type as "flow content" in object->subform property.
    3. Set flow direction as "Table".
    4. Insert another subform inside this subform.
    5. set its type as "flow content" and flow direction as "Table row".
    6. Now, choose binding tab, and there check "repeat subform for each Data item check box" and specify min. count for your rows.
    7. Now, insert your column fields inside this sub form once.
    8. Format its look and feel as you want.
    When you run this application, it will show you multiple data as table on Adobe form.
    Regards,
    Bhavik

  • How to display data in table with dynamic rows, section wise in a page.

    Hello all,
    I work on report creation in BI Publisher where I need to display data from xml in a table in pdf format.The output page is divided into two vertical sections , containing tables, with exactly same columns on left and right sections. The number of rows in table depends on the output of the fetching query. The page is to be populated in such a way that, at first, the left table is populated, then the next rows fill up the table on the right section of the page, if more rows are left, they fill up the tables on next page[first the left table, and then the right one, in a similar fashion as in page 1]
    On a bird's eye view, the data needs to be simply mapped to a table, with dynamic number of rows, and so can span number of pages depending on size of data. On a implementation level, I am stuck in getting the left section of the page populated first, then the right section[in place of the right page], and then the next page.
    Please guide me if someone has any idea in getting this achieved.
    Thanks in advance.

    Thanks for the response...
    I am able to get the desired functionality. I just need the tables to be inside a bigger table, that also has a dividing line between the two columns. This is was is intended in the req. provided to me. The column formatting option provides me a line ,but that is not further modifiable .Please help me in getting a perpendicular line between the two columns, which I need to be of a specified width and color.

  • Problem displaying date

    Hi,
    I am trying to display date, the source code is:
    code]import java.lang.*;
    import java.text.*;
    import java.util.*;
    class Date {
    public static void main(String args[]) {
    Date date = new Date();
    System.out.println("the date is:" + date.toString());
    The output is: the date is:Date@187c6c7
    I'm using Sun Java Studio Enterprise 8.1
    Any guess? where i'm going wrong..

    Hi,
    I am trying to display date, the source code is:
    e]import java.lang.*;
    import java.text.*;
    mport java.util.*;
    class Date {
    public static void main(String args[]) {
    Date date = new Date();
    ystem.out.println("the date is:" + date.toString());
    ode]
    The output is: the date is:Date@187c6c7
    I'm using Sun Java Studio Enterprise 8.1
    Any guess? where i'm going wrong..You ought not create a class with the same name as a class in the standard library (Date), and you need to provide a toString method that outputs what you want to output.
    Good Luck
    Lee

  • Export Data to Excel with commands API

    Hello,With commands API, we want to add the possibility to Export Data to Excel to our users, but we don't want to give them the acess to the mouse right button, because they can change others things that we don't want.How can we do that ?Thanks.

    Hello,With commands API, we want to add the possibility to Export Data to Excel to our users, but we don't want to give them the acess to the mouse right button, because they can change others things that we don't want.How can we do that ?Thanks.

Maybe you are looking for