Error in Downloading the Text file on Application Server

Hi All,
          I am working on ECC6.0. I have written a program in whcih I am downloading the text file on
          application server in UTF-8 format. However when I am opening this file in Excel I am getting
          garbage value for some characters(as Excel does not support UTF-8 format). So now I
          want to download the data on application server in text file in non unicode format(Like ANSI or
          other non unicode format) which is supported by excel. When I am writing the code as
          OPEN DATASET DN_FILE FOR OUTPUT IN LEGACY TEXT MODE it is giving me dump saying
          CHARACTER CONVERSION FROM CODE PAGE '4102' to CODEPAGE '1100' NOT POSSIBLE.
          Same in case if I add the code OPEN DATASET DN_FILE FOR OUTPUT IN LEGACY TEXT
          MODE CODE PAGE '8000' is also giving dump.
          So please let me know how can I download the file in non unicode format ?
          Any help would be greatly appricated.
Thanks & Regards
Jitendra Gujarathi.

OPEN DATASET l_filename FOR INPUT IN TEXT MODE  ENCODING NON-UNICODE IGNORING CONVERSION ERRORS.
CHECK sy-subrc EQ 0.
  DO.
    CLEAR wa_file_content.
    READ DATASET l_filename INTO wa_file_content.
    IF sy-subrc EQ 0.
      APPEND wa_file_content TO it_file_content.
    ELSE.
      EXIT.
    ENDIF.
  ENDDO.
  CLOSE  DATASET l_filename.
  t_filedata[] = it_file_content[].
can you use like this.

Similar Messages

  • Placing the text file in application server

    Hi all,
    I am uploading the text file into application server.
    the line length is 1028 characters.But in application server i am not able to see whole line.it is showing only some data and reamaining data is not coming.
    Please let em know how can we increase the line length in application server.
    Regards,
    Shoban

    SE38 is the ABAP Editor transaction.
    Use function module ‘GUI_UPLOAD’ to create an upload the data. 
    *Use function module ‘GUI_UPLOAD’ to create an upload the data.
    Example Code >>>
    REPORT  zuploadtab                    .
    PARAMETERS: p_infile  LIKE rlgrap-filename
                            OBLIGATORY DEFAULT  '/usr/sap/'..
    *DATA: ld_file LIKE rlgrap-filename.
    DATA: gd_file type string.
    *Internal tabe to store upload data
    TYPES: BEGIN OF t_record,
        name1 LIKE pa0002-vorna,
        name2 LIKE pa0002-name2,
        age   TYPE i,
        END OF t_record.
    DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0,
          wa_record TYPE t_record.
    *Internal table to upload data into
    DATA: BEGIN OF it_datatab OCCURS 0,
      row(500) TYPE c,
    END OF it_datatab.
    *Text version of data table
    TYPES: BEGIN OF t_uploadtxt,
      name1(10) TYPE c,
      name2(15) TYPE c,
      age(5)  TYPE c,
    END OF t_uploadtxt.
    DATA: wa_uploadtxt TYPE t_uploadtxt.
    *String value to data in initially.
    DATA: wa_string(255) TYPE c.
    CONSTANTS: con_tab TYPE x VALUE '09'.
    *If you have Unicode check active in program attributes then you will
    *need to declare constants as follows:
    *class cl_abap_char_utilities definition load.
    *constants:
       con_tab  type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
    *AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_INFILE.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_infile.
      CALL FUNCTION 'WS_FILENAME_GET'
           EXPORTING
                def_filename     = p_infile
                mask             = ',*.txt.'
                mode             = 'O'
                title            = 'Upload File'(078)
           IMPORTING
                filename         = p_infile
           EXCEPTIONS
                inv_winsys       = 1
                no_batch         = 2
                selection_cancel = 3
                selection_error  = 4
                OTHERS           = 5.
    *START-OF-SELECTION
    START-OF-SELECTION.
      gd_file = p_infile.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = gd_file
          has_field_separator     = 'X'  "file is TAB delimited
        TABLES
          data_tab                = it_record
        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.
        IF sy-subrc NE 0.
          write: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.
          skip.
        endif.
    Alternative method, where by you split fields at each TAB after you
    have returned the data. No point unless you dont have access to
    GUI_UPLOAD but just included for information
    CALL FUNCTION 'GUI_UPLOAD'
          EXPORTING
               filename        = gd_file
               filetype        = 'ASC'
          TABLES
               data_tab        = it_datatab  "ITBL_IN_RECORD[]
          EXCEPTIONS
               file_open_error = 1
               OTHERS          = 2.
    IF sy-subrc NE 0.
    ELSE.
       LOOP AT it_datatab.
         CLEAR: wa_string, wa_uploadtxt.
         wa_string = it_datatab.
         SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
                                         wa_uploadtxt-name2
                                         wa_uploadtxt-age.
         MOVE-CORRESPONDING wa_uploadtxt TO wa_record.
         APPEND wa_record TO it_record.
       ENDLOOP.
    ENDIF.
    *END-OF-SELECTION
    END-OF-SELECTION.
    *!! Text data is now contained within the internal table IT_RECORD
    Display report data for illustration purposes
    LOOP AT it_record INTO wa_record.
      WRITE:/     sy-vline,
             (10) wa_record-name1, sy-vline,
             (10) wa_record-name2, sy-vline,
             (10) wa_record-age, sy-vline.
    ENDLOOP.
    Edited by: Nikhil Jathar on Jan 9, 2008 7:38 AM

  • Downloading a text file from application server

    Hi Freinds,
    I am genarating a text file in our application server (Folder /usr/sap/dbi/) I need to download this text file in my destop pc or some other windows server.
    What do I have to do? What is the procedure, Pls help.
    If someone have sample code, pls send.
    We are running SAP ECC5.0 on an iSeries (AS/400) Database DB2/400.
    Regards
    Thanura

    Hi,
    try this:
    REPORT ZGRO_TEST.
    DATA: DATEI_A(30) TYPE C VALUE '/tmp/matnr.txt'.
    DATA: DATEI_PC TYPE STRING VALUE 'C:\MATNR.TXT'.
    DATA: ITAB        TYPE TABLE OF MARA WITH HEADER LINE.
    START-OF-SELECTION.
      PERFORM DATEI_EINLESEN.
      PERFORM DATEI_DOWNLOAD.
    FORM DATEI_EINLESEN.
      OPEN DATASET DATEI_A FOR INPUT IN TEXT MODE.
      IF SY-SUBRC NE 0. STOP. ENDIF.
      DO.
        READ DATASET DATEI_A INTO ITAB.
        IF SY-SUBRC <> 0. EXIT. ENDIF.
        APPEND ITAB.
      ENDDO.
      CLOSE DATASET DATEI_A.
      IF SY-SUBRC NE 0. STOP. ENDIF.
    ENDFORM.                    "DATEI_EINLESEN
    FORM DATEI_DOWNLOAD.
    Datei downloaden
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
        EXPORTING
          FILENAME                = DATEI_PC
          FILETYPE                = 'ASC'
        CHANGING
          DATA_TAB                = ITAB[]
        EXCEPTIONS
          FILE_WRITE_ERROR        = 1
          NO_BATCH                = 2
          GUI_REFUSE_FILETRANSFER = 3
          INVALID_TYPE            = 4
          NO_AUTHORITY            = 5
          UNKNOWN_ERROR           = 6
          HEADER_NOT_ALLOWED      = 7
          SEPARATOR_NOT_ALLOWED   = 8
          FILESIZE_NOT_ALLOWED    = 9
          HEADER_TOO_LONG         = 10
          DP_ERROR_CREATE         = 11
          DP_ERROR_SEND           = 12
          DP_ERROR_WRITE          = 13
          UNKNOWN_DP_ERROR        = 14
          ACCESS_DENIED           = 15
          DP_OUT_OF_MEMORY        = 16
          DISK_FULL               = 17
          DP_TIMEOUT              = 18
          FILE_NOT_FOUND          = 19
          DATAPROVIDER_EXCEPTION  = 20
          CONTROL_FLUSH_ERROR     = 21
          NOT_SUPPORTED_BY_GUI    = 22
          ERROR_NO_GUI            = 23
          OTHERS                  = 24.
      IF SY-SUBRC NE 0. STOP. ENDIF.
    ENDFORM.                    "DATEI_DOWNLOAD
    Regards, Dieter

  • Error while downloading the PDF file on presentation server

    Hi all,
    i have converted OTF file into PDF one and then downloading it to the presentation server . But it gives the error as follows
    'Access to file denied'    . Can anyone tell me what may be the issue ? Below is my code
    DATA: i_lines TYPE tline OCCURS 0 WITH HEADER LINE.
    DATA: ws_bin_size TYPE i.
    DATA: t_otf  TYPE TABLE OF itcoo,
                ws_filename TYPE string.
      t_otf[] = wa_job_info-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
        EXPORTING
          format        = 'PDF'
          max_linewidth = 132
        IMPORTING
          bin_filesize  = ws_bin_size
        TABLES
          otf           = t_otf
          lines         = i_lines.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          bin_filesize = ws_bin_size
          filename     = 'C:\ABC.PDF'
          filetype     = 'BIN'
        TABLES
          data_tab     = i_lines.

    Hi Sayeed,
          You may not having the permissions to create files in 'C' folder. Change the path and try again.

  • Download text file from application server to client server.

    Hi all,
    I am facing a format issue while downloading text file from application server to the client machine.
    The issue is that, say I have 6 to 10 lines in my text file in application server. but when i store it on the hard drive,
    it shoes all the data in a single line. Where as i need to download data in same format as in application server.
    Awaiting for your responses.
    Regards,
    Jose

    Hi,
    If we want to upload file data from the application server to the internal table, there is no function module or class static method which we can use, we must wirte the code by ourselves.
    1. For the file data which has no seperator between field columns.
    PARAMETERS p_file  TYPE dxfile-filename.
    START-OF-SELECTION.
    OPEN DATASET p_file IN TEXT MODE ENCODING DEFAULT FOR INPUT.
      DO.
        READ DATASET p_file INTO gds_data.
        IF sy-subrc <> 0.
          EXIT.
        ENDIF.
        APPEND gds_data TO gdt_data.
      ENDDO.
    CLOSE DATASET p_file.2. For the file data which has tab separator between field columns.
    DATA: gds_field_split type gts_data.
    FIELD-SYMBOLS: <fs_field> TYPE gts_data.
    PARAMETERS p_file  TYPE dxfile-filename.
    START-OF-SELECTION.
    OPEN DATASET prf_file IN TEXT MODE ENCODING DEFAULT FOR INPUT.
      DO.
        READ DATASET p_file INTO gds_field.
        SPLIT gds_field  AT cl_abap_char_utilities=>horizontal_tab
             INTO TABLE gdt_field_split.
       LOOP AT gdt_field_split  into gds_field_split.
           gdf_index = gdf_index + 1.
           ASSIGN COMPONENT gdf_index OF STRUCTURE
                 gds_data to <fs_field>.
          IF sy-subrc = 0.
              <fs_field> = gds_field_split.
          ENDIF.
       ENDLOOP.
        APPEND gds_data TO gdt_data.
      ENDDO.
    CLOSE DATASET p_file.
    Thanks & regards,
    ShreeMohan

  • Log Error Messages in the Text File using Flex

    Hi,
    I am using try/Catch block to catch exception and am trying to write these error messages in the text file.
    I do not know how to achive such funcionality.
    looking forward for your help in this regard. Please have a look on the code as pasted below:
    private function onItemRollOver(evt : ListEvent) : void
                    try
                             var s:String= evt.target.Participation;
                               var partRange:Number = evt.rowIndex;
                            if (partRange == 2)
                                    dgCohorts.setStyle( "rollOverColor", "red" );
                            if (partRange == 7)
                                dgCohorts.setStyle( "rollOverColor", "green" );
                            dgCohorts.validateNow();
                       catch(e:Error)
                                var callLaterErrorEvent:DynamicEvent = new DynamicEvent("callLaterError");                        
                                callLaterErrorEvent.error = e;
                                systemManager.dispatchEvent(callLaterErrorEvent);
    Thanks,
    Vivek Jain

    Hi,
    I am using try/Catch block to catch exception and am trying to write these error messages in the text file.
    I do not know how to achive such funcionality.
    looking forward for your help in this regard. Please have a look on the code as pasted below:
    private function onItemRollOver(evt : ListEvent) : void
                    try
                             var s:String= evt.target.Participation;
                               var partRange:Number = evt.rowIndex;
                            if (partRange == 2)
                                    dgCohorts.setStyle( "rollOverColor", "red" );
                            if (partRange == 7)
                                dgCohorts.setStyle( "rollOverColor", "green" );
                            dgCohorts.validateNow();
                       catch(e:Error)
                                var callLaterErrorEvent:DynamicEvent = new DynamicEvent("callLaterError");                        
                                callLaterErrorEvent.error = e;
                                systemManager.dispatchEvent(callLaterErrorEvent);
    Thanks,
    Vivek Jain

  • How to delete the Generated files from application server(open hub)?

    hi experts,
    when i try to execute process chain the DTP it is giving below dump. Exception CX_RSBK_REQUEST_LOCKED logged.
    when i execute the DTP manually and trying to delete the previous request, it is giving for dump ITAB_DUPLICATE_KEY.
    so to delete the generated file from application server, how to delete it for specific dates?
    Information on where terminated
    Termination occurred in the ABAP program "GPD6S3OE0BCVGC6L9DBNVYQARZM" - in
    "START_ROUTINE".
    The main program was "RSBATCH_EXECUTE_PROZESS ".
    In the source code you have the termination point in line 2874
    of the (Include) program "GPD6S3OE0BCVGC6L9DBNVYQARZM".
    The program "GPD6S3OE0BCVGC6L9DBNVYQARZM" was started as a background job.
    and when i check the dump it is point out at below code
    " Populate the lookup table for 0STOR_LOC
    SELECT * from /BI0/TSTOR_LOC
    into CORRESPONDING FIELDS OF table L_0STOR_LOC_TEXT
    FOR ALL ENTRIES IN SOURCE_PACKAGE WHERE
    STOR_LOC = SOURCE_PACKAGE-STOR_LOC.
    but the programme is syntactically correct only.
    how to rectify the issue.
    regards
    venuscm
    Edited by: venugopal vadlamudi on Sep 28, 2010 1:59 PM

    hi experts,
    We have written start routine to get the storage location text and sending to File located at Application server through OPEN HUB.
    here is the code written in the Transformations
    In the global section
    Text for 0STOR_LOC
        DATA: l_0stor_loc_text TYPE HASHED TABLE OF /bi0/tstor_loc
              WITH UNIQUE KEY stor_loc.
        DATA: l_0stor_loc_text_wa TYPE /bi0/tstor_loc.
    and in the code to get the text
    " Populate the lookup table for 0STOR_LOC
        *SELECT * from /BI0/TSTOR_LOC*
          into CORRESPONDING FIELDS OF table L_0STOR_LOC_TEXT
          FOR ALL ENTRIES IN SOURCE_PACKAGE WHERE
                  STOR_LOC = SOURCE_PACKAGE-STOR_LOC.
    im sure there is problem with the Routine only. i think i need to change the code if so please provide me the modified one.
    thanks
    venuscm
    Edited by: venugopal vadlamudi on Sep 29, 2010 9:37 AM

  • Sending EMail "Text-File" from Application Server!

    Hi Experts,
    how can I sending a Text-File from Application Server via Email?
    Is there existing a Function Modul?
    With Kind regards
    Ersin
    Moderator message: sending emails = FAQ, please search before posting.
    Edited by: Thomas Zloch on Nov 25, 2010 4:23 PM

    STF (Search the forum)!  This type of question has been asked...and answered....many times.

  • Problem with saving data in text file in Application server

    Hello Experts,
    I am trying to save a text file in application server.When I text file have less that 60000 (i.e 59999) records, it saves the file successfully, but if records in text file (saved in application server) is more than 60000 (i.e 60002), it creates a new file at the 60000th record with the continued records.
    Can anyone please advise, why it is creating a new file if records are more that 60000. I tested it with 59000 records in my internal table and it is working fine. I have not given any restriction in my program to create a new file if records are more than 60000.
    The logic I implemented is the following:
    *Open file
      open dataset g_accnt_file for output in text mode encoding utf-8.
      if sy-subrc = 0.
        clear g_header_record.
    *Building header record for Accounting Validation file
        concatenate gc_hdr_desc
                    gc_filetype
                    gc_sequence
                    gc_idntf_refresh
                    gc_cmpny_idntf
                    gc_accnt_id
                    sy-datum
                    sy-uzeit
                    gc_linde_group
                    sy-sysid
                    gc_not_used into g_header_record separated by
                                               gc_deliminator.
        transfer g_header_record to g_accnt_file.
    *Move Cost center data to file to create a detail record for Accounting
    *Validation file
        loop at gt_csks into gs_csks.
    *Remove leading Zeros
          call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
            exporting
              input  = gs_csks-kostl
            importing
              output = gs_csks-kostl.
    *      Overlay gs_csks-kostl with space.
    *      SHIFT gs_csks-kostl RIGHT DELETING TRAILING gc_space.
    *Prepare Cost Centre String
          perform prepare_costcentre_string.
    *Prepare detail record with Company Code & Cost Centre
          perform prepare_detail_record.
          clear:g_detail_record,gs_csks,g_coa.
        endloop.
    *Move Order data to file to create a detail record for Accounting
    *Validation file
        loop at gt_aufk into gs_aufk.
    *Remove leading Zeros
          call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
            exporting
              input  = gs_aufk-aufnr
            importing
              output = gs_aufk-aufnr.
    *      SHIFT gs_aufk-aufnr RIGHT DELETING TRAILING gc_space.
    *Prepare Order String
          perform prepare_order_string.
    *Prepare detail record with Company Code & Order
          perform prepare_detail_record.
          clear:g_detail_record,gs_aufk,g_coa.
        endloop.
    *Move WBS data to file to create a detail record for Accounting
    *Validation file
        loop at gt_prps into gs_prps.
          call function 'CONVERSION_EXIT_ABPSP_OUTPUT'
            exporting
              input  = gs_prps-pspnr
            importing
              output = g_wbs_element.
    *      SHIFT g_wbs_element RIGHT DELETING TRAILING gc_space.
    *Prepare WBS Element String
          perform prepare_wbs_string.
    *Prepare detail record with Company Code & WBS Element
          perform prepare_detail_record.
          clear:g_detail_record,gs_prps,g_coa.
        endloop.
    *Building trailer record for Accounting Validation file which will
    *contain the total number of detail records in file
        concatenate gc_trail_desc
                    g_total_count
                    into g_trailer_record
                    separated by gc_deliminator.
        transfer g_trailer_record to g_accnt_file.
    *Close file
        close dataset g_accnt_file.
        if sy-subrc = 0.
          message s036(/lig/fi).
        endif.
      endif.
    endform.                    " SELECT_DATA
    Edited by: Matt on Sep 30, 2010 11:02 AM - added   tags

    Hi Pankaj,
    Can u check the concatenate statement with one more data. Check the no of lines for a single file.
        concatenate gc_hdr_desc
                    gc_filetype
                    gc_sequence
                    gc_idntf_refresh
                    gc_cmpny_idntf
                    gc_accnt_id
                    sy-datum
                    sy-uzeit
                    gc_linde_group
                    sy-sysid
                    sy-subrc
                    gc_not_used into g_header_record separated by
                                               gc_deliminator.
    Regards,
    Amitava

  • Error when loading a flat file from Application server.

    Hi,
    I am trying to load a flatfile from the application server, and I am getting the message
    Error while accessing the application server file
    Message no. RSDS_ACCESS002
    I checked for notes and found only one:
    Note 1033978 - Correction: Loading Unicode files from application server
    but we have 19 SP level, and the note says it needs 13 SP level, so I think it would not be of any help.
    does anybodie know what to do??
    thanks for the help.
    Mauricio

    Error in accessing while application server file..
    when i am trying load the data to psa
    when i am taking the file name: text-type file from app server
    plz reslove me for this problem??
    another question
    when i am saving the file with using * in the  filename in .CSV file its not saving,
    whats the reason????
    ASHOK

  • How to Select the Latest file from Application Server?

    Dear All,
    I am working on object, which had requirement to Pick the file from application server.
    The Application server contain the files in ‘/temp/sms/’ directory. The files are having the name Like ‘smsqry_yyyymmddhhmmss.txt’ and I have to Pick the Latest file (Base on file name for eg. 'smsqry_20060713102333’) from that all and after getting the file I have to delete the file from application server.
    So How to do this.
    Regards

    hi,
    look function group EPSF-
    esp. fm EPS_GET_DIRECTORY_LISTING
    if you're looking fo OS-date and time
    look here:Re: How do I convert MTIME to date and time?
    A.
    Message was edited by: Andreas Mann

  • How to make the Open/Save dialogue download the text file instead of JSP

    I am currently coding on a JSP program, which searches the database and writes the resultset into a file on the server, and then allows the client to download this tab delimited text file onto their local machine. But I met a problem, when the default Open or Save dialogue appears, it shows that it's trying to download the running JSP file from my local host instead of the newly-created text file. Despite this, when I click OK to either Open or Save the file, a warning dialogue will appear saying: The explorer cann't download this file, it's unable to find this internet site or something like that. I get no error message from the server but I was always told that Javax.servlet.ServletException: getWriter() was already called. What does this mean?
    I guess maybe this is caused by the mix use of outputStreams in my program. I don't know if there is a way to directly read the resultset from the database and then send it through outputStream to the client. My solution is: first create a file on the server to hold the resultset, and then output this file to the client. I did all these in one JSP program: Create file on the server, search database, and then read file and output the contents to client. Is this correct? I attached my code, please feel free to correct any of my mistake? Thanks!
    //global.class is a class dealing with database connection
    <%@ page language="java" import="java.sql.*,java.util.*,java.math.*,java.io.*,ises.*,frmselection.*" %>
    <jsp:useBean id="global" scope="session" class="ises.Global" />
    />
    <!--start to process data-->
    <%
    //get query statement from the session
    String sQuery = "";
    if (session.getAttribute("sQuery")!=null && !(session.getAttribute("sQuery").toString()).equals(""))
    sQuery = session.getAttribute("sQuery").toString();
    String path = "c:/temp";
    String fileName = "temp.TXT";
    File file= null;
    FileOutputStream fo = null;
    PrintStream ps = null;
    try {
         file = new File(path,fileName);
         if(file.exists()) {
         file.delete();
         file.createNewFile();
         fo = new FileOutputStream(file);
         ps = new PrintStream(fo);
    }catch(IOException exp){
         System.out.println("IO Exception: " +exp.toString() );
    java.sql.ResultSet recResults     = null;
    java.sql.Statement STrecResults = null;
    STrecResults = global.getConnection().createStatement();
    recResults = STrecResults.executeQuery(sQuery);
    ResultSetMetaData meta = recResults.getMetaData();
    int columns = meta.getColumnCount();
    String [] tempColumnName = new String[columns];
    String [] ColumnName =null;
    int DisColumns = 0;
    int unDisCol = 0;
    String sLine = "";
    if(recResults.next()) {     //if_1
    for(int n=0;n<columns;n++) {
    String temp = meta.getColumnName(n+1);
    if(!temp.equals("PROJECTID")&&!temp.equals("BUILDINGID")&&!temp.equals("HAZMATPROFILEID")) {
    sLine = sLine + "'" + temp + "'" + " ";
    tempColumnName[DisColumns] = temp;
    DisColumns ++;
    ColumnName = new String[DisColumns];
    }else {
    unDisCol ++;
    }//end for
    for(int i=0;i<(columns-unDisCol);i++) {
    ColumnName[i] = tempColumnName;
    ps.println(sLine);
    do{
    sLine = "";
    for(int n=0;n<(columns-unDisCol);n++) {
    String tempColName = recResults.getString(ColumnName[n]);
    if(tempColName==null) {
    sLine = sLine + "" + " ";
    } else {
         sLine = sLine + "'"+tempColName+"'" + " ";
    ps.println(sLine);
    }while(recResults.next());
    }     //end if_1
    recResults.close();
    recResults = null;
    STrecResults.close();
    STrecResults = null;
    %>
    <!--end of processing data-->
    <!--start of download.jsp-->
    <%
    //set the content type to text
    response.setContentType ("plain/text");
    //set the header and also the Name by which user will be prompted to save
    response.setHeader ("Content-Disposition", "attachment;filename=temp.TXT");
    //Open an input stream to the file and post the file contents thru the servlet output stream to the client
    InputStream in = new FileInputStream(file);
    ServletOutputStream outs = response.getOutputStream();
    int bit = 256;
    try {
         while ((bit) >= 0) {
         bit = in.read();
    outs.write(bit);
    } catch (IOException ioe) {
    ioe.printStackTrace(System.out);
    outs.flush();
    outs.close();
    in.close();     
    %>
    <!--end of download -->

    Thanks. I believe something wrong with this statement
    in my program:
    You are correct there is something wrong with this statement. Seeing how you are doing this in a jsp, not really what they're made for but thats another topic, the output stream has already been called. When a jsp gets compiled it creates a few implicit objects, one of them being the outputstream out, and it does this by calling the response.getWriter(). getWriter or getOutputStream can only be called once, other wise you will get the exception you are experiencing. This is for both methods as well, seeing how the jsp compiles and calls getWriter means that you cannot call getOutputStream. Calling one makes the other throw the exception if called as well. As far as the filename problem in the browser goes I'm guessing that it's in IE. I've had some problems before when I had to send files to the browser through a servlet and remember having to set an inline attribute of some sort in the content-dis header inorder to get IE to see the real filename. The best way to solve this is to get the orielly file package and use that. It is very easy to use and understand and does all of this for you already. Plus it's free. Cant beat that.
    ServletOutputStream outs =
    response.getOutputStream();
    because I put a lot of printout statement within my
    code, and the program stops to print out exactly
    before the above statement. And then I get the
    following message, which repeats several times:
    ServletExec: caught exception -
    javax.servlet.ServletException: getWriter() was
    already called.

  • Error while downloading the xml file

    i am having a internal table which contains data in xml format but i am unable to download the data into local system by using 'GUI_DOWNLOAD' fn. module
    its error its showing is as :
    The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    A name contained an invalid character. Error processing resource 'file:///D:/XX.XML'. Line 4, Position 4
    MOD/><RPTSX/><MANDT/><SYPSY/><SYSID/><SAPRL/></T682><T682><KVEWE>A</KV...

    hello Durairaj,
    i am fwd the code go thru it and check why the xml file is not downloading,
    and after downloading the file i want that file to be in displayed in  .pdf.
    REPORT  ZCCSV_TO_XML.
    DATA : BEGIN OF TABLE OCCURS 0,
            TABNAME(15) TYPE C,
           END OF TABLE.
    DATA : BEGIN OF HEADER_NAMTAB OCCURS 0,
            NAMTAB TYPE STRING,
           END OF HEADER_NAMTAB.
    DATA : BEGIN OF CONVERT_ITAB_TO_XML OCCURS 0,
            FIELDNAME(255) TYPE C,
           END OF CONVERT_ITAB_TO_XML .
    DATA : BEGIN OF CONVERT_XML_TO_ITAB OCCURS 0,
            FIELDNAME(255) TYPE C,
           END OF CONVERT_XML_TO_ITAB.
    DATA DREF TYPE REF TO DATA.
    DATA TNAME LIKE DD02L-TABNAME.
    DATA BEGIN OF ZDFIES OCCURS 0.
            INCLUDE STRUCTURE DFIES.
    DATA END OF ZDFIES.
    DATA: xml_out TYPE string .
    DATA: xml_TO_ITAB TYPE string .
    data : wa_indx type indx.
    DATA : DETAIL(30).
    DATA : DATA1 TYPE STRING.
    DATA : COMMA . "VALUE ','.
    DATA : DBTAB1(15) TYPE C.
    FIELD-SYMBOLS: <ITAB> TYPE ANY TABLE,
                   <WA>    TYPE ANY,
                    <WA1> TYPE ANY .
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME,
                       SKIP 1.
    PARAMETERS : SPOOL    RADIOBUTTON GROUP rad1 DEFAULT 'X',
                 CSV      RADIOBUTTON GROUP rad1 ,
                 XMLTOPDF RADIOBUTTON GROUP rad1.
    SELECTION-SCREEN : SKIP 1,
                       END OF BLOCK b1.
        TABLE-TABNAME = 'T681'.
        APPEND TABLE.
        TABLE-TABNAME = 'T682'.
        APPEND TABLE.
      IF SPOOL = 'X'.
       PERFORM SPOOL.
      ELSEIF CSV = 'X'.
        PERFORM CSV.
      ELSEIF XMLTOPDF = 'X'.
        PERFORM XMLTOPDF.
      ENDIF.
    *&      Form  CSV
    form CSV .
    LOOP AT TABLE.
      dbtab1 = TABLE-TABNAME.
      TNAME = dbtab1.
      PERFORM GETFIELDS.
      LOOP AT HEADER_NAMTAB.
       WRITE: HEADER_NAMTAB-NAMTAB, COMMA.
      ENDLOOP.
      PERFORM GET_DETAIL_LIST.
    ENDLOOP.
    endform.                    " CSV
    form XMLTOPDF .
    LOOP AT TABLE.
      PERFORM GET_DETAIL_LIST.
    ENDLOOP.
    endform.                    " XMLTOPDF
    GETTING THE HEADER OF THE TABLE                                     *
    FORM GETFIELDS.
      REFRESH HEADER_NAMTAB.
      CALL FUNCTION 'GET_FIELDTAB'
       EXPORTING
           LANGU              = SY-LANGU
           ONLY               = SPACE
           TABNAME            = TNAME
           WITHTEXT           = 'X'
       TABLES
           FIELDTAB           = ZDFIES
       EXCEPTIONS
           INTERNAL_ERROR      = 01
           NO_TEXTS_FOUND      = 02
           TABLE_HAS_NO_FIELDS = 03
           TABLE_NOT_ACTIV     = 04.
      CASE SY-SUBRC.
        WHEN 0.
          LOOP AT ZDFIES.
            HEADER_NAMTAB-NAMTAB = ZDFIES-SCRTEXT_M.
            APPEND HEADER_NAMTAB.
          ENDLOOP.
        WHEN OTHERS.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH  SY-SUBRC.
      ENDCASE.
    ENDFORM.                  " GETFIELEDS
    *&      Form  GET_DETAIL_LIST
    form GET_DETAIL_LIST .
      CREATE DATA DREF TYPE STANDARD TABLE OF (TABLE)
                                WITH NON-UNIQUE DEFAULT KEY.
      ASSIGN DREF->* TO <ITAB> .
      SELECT * FROM (TABLE) INTO TABLE <ITAB>.
      CALL TRANSFORMATION ('ID')
      SOURCE tab = <ITAB>[]
      RESULT XML xml_out.
    Convert to TABLE
    CALL FUNCTION 'HR_EFI_CONVERT_STRING_TO_TABLE'
    EXPORTING
    i_string = xml_out
    i_tabline_length = 100
    TABLES
    et_table = CONVERT_ITAB_TO_XML.
    Download
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    filetype = 'ASC'
    filename = 'D:\XX.XML'
    TABLES
    data_tab = CONVERT_ITAB_TO_XML
    endform.

  • Remote function module to download the text file

    Hi Experts,
                   I have a requirement of text file should be downloaded from RFC connection by which function module.Can you please tell me whether this method is used to download text file (CALL METHOD cl_gui_frontend_services=>gui_upload).

    Hi Jaswanth,
    FM used to upload the data from the non sap system to the SAP sytem is the GUI_UPLOAD ans GUI_DOWLOAD is downloading the data from SAP to the presentation server .This file can be xls,tab or space deliminatior ettxt fiel.
    I think this was your requirement.
    Pooja

  • Error while downloading the stack file

    Hi,
    I'm in the process of upgrading my EhP4 system to EhP5.
    While trying to generate the file via MOPZ, I just can't seem to "Continue" with the Enhancement package installation option.
    The error's as follows:
    "Successor installed for SAP SNC 2007."--Check SMSY. (SMSY is perfectly reflecting whatever's installed on the ECC system.)
    I just can't figure out where SNC has cm in from.
    I do have the component ECC-SE on 604...does this have anything to do with it?
    Pls. help..
    Thank You,
    Saba.

    Hi Saba,
    I've had the same problem as you building the stack file for an EHP5 upgrade and have CPRXRPM version 400 installed. I used you idea of adding SAP SNC 7.0 as an installed product under the ERP system which enabled be to continue the mopz config and build a stack file.
    Now when attempting the upgrade I get :-
    "The Installation/Upgrade Package for Add-on SCMSNC rel. 700 is not available"
    This is not that surprising I guess as its not installed.
    Did you also come across this, if so were you able to bypass this?
    Thanks
    Warren

Maybe you are looking for

  • Looking for a good folio case for the iPad mini... any suggestions?

    I'm interested in a good folio case that includes the smart cover feature.  I'm particularly interested in a case that has durability (most of the inexpensive ones on Amazon seem to fall apart over time). The other feature I'd like would be for the c

  • Bad RAM on PowerMac G5 - Interpreting POST

    I have a problem with RAM DDR400 on a PowerMac G5 2x2 GHz (July 2004 model with 8 DIMM slots) equipped with 4 x 256 Mo and 2 x 512 Mo SDRAM all installed in pairs by the vendor . Recently, after updating to OSX Tiger - 10.4.7 or 8 - I discover that t

  • Table on Page One Blocking Layout/Section Break & Distinct Headers/Footers

    Is there any way to start a new Header/Footer on page 2, after a page one table that fills the page? I've created my first page as a Table (entire page) in order to recreate the front page of my newsletter, as used by a previous editor. Works great,

  • Problems with jdbc and .jar files.

    I am having a problem with connecting to my database when running my .jar file as an executable. It connects correctly when I use the java command in command prompt and it also runs correctly when using my IDE. Is there something that needs to be add

  • SERIOUS ADOBE ACROBAT PROFESSIONAL 8 ERROR

    Hi I am using (or TRYING to use!) Adobe Acrobat Professional 8. But every time it loads up I receive the following pop-up message: "A serious error has been detected and Adobe Acrobat 8 Professional cannot continue. Please re-install the application