Download files in excel format

Hi,
Can anyone help me for downloading file in excel format? I have scheduled a job repeated everyday at a particular time, but it dumps a text file, NOT in excel format. My programme is an ALV.
Code snippet would be verymuch helpfull.
Thank,
Thushara.

Hello Thushara,
here is a code i am giving you . It will take the data from a database , and download it into the excel format..
You just can customize this program to download the data from an ALV ....
Here is the sample code...
REPORT  ZKUN_FILE4                              .
TABLES: USR03,DD02L.
DATA: ZX030L LIKE X030L.
DATA BEGIN OF ZDFIES OCCURS 0.
     INCLUDE STRUCTURE DFIES.
DATA END OF ZDFIES.
DATA: BEGIN OF FLDITAB OCCURS 0,
      FLDNAME(11) TYPE C,
      END OF FLDITAB.
DATA ITABUSR03 LIKE USR03 OCCURS 0 WITH HEADER LINE.
DATA TNAME LIKE DD02L-TABNAME.
SELECT * FROM USR03 INTO TABLE ITABUSR03.
TNAME = 'USR03'.
PERFORM GETFIELEDS.
PERFORM SHOW123.
FORM GETFIELEDS.
     CALL FUNCTION 'GET_FIELDTAB'
      EXPORTING
          LANGU              = SY-LANGU
          ONLY               = SPACE
          TABNAME            = TNAME
          WITHTEXT           = 'X'
      IMPORTING
          HEADER             = ZX030L
      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.
               FLDITAB-FLDNAME = ZDFIES-FIELDNAME.
               APPEND FLDITAB.
          ENDLOOP.
        WHEN OTHERS.
             MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              with  SY-SUBRC.
      ENDCASE.
ENDFORM.
FORM SHOW123.
CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
     EXPORTING
          FILE_NAME                 = 'C:\USR03.XLS'
          DATA_SHEET_NAME           = 'USER LIST'
    TABLES
         DATA_TAB                  =  ITABUSR03
         FIELDNAMES                =  FLDITAB
    EXCEPTIONS
         FILE_NOT_EXIST            = 1
         FILENAME_EXPECTED         = 2
         COMMUNICATION_ERROR       = 3
         OLE_OBJECT_METHOD_ERROR   = 4
         OLE_OBJECT_PROPERTY_ERROR = 5
         INVALID_FILENAME          = 6
         INVALID_PIVOT_FIELDS      = 7
         DOWNLOAD_PROBLEM          = 8
         OTHERS                    = 9.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM.
Hope this solves your problem.
Regards,
Kunal.
Note : Reward points if found useful.

Similar Messages

  • ALV Grid to be run in background & to generate output file in Excel format

    I use  REUSE_ALV_GRID_DISPLAY in my program for the ALV output
    My Requirement is Program to be run in a background since it is getting timed out when executed in foreground and also to generate the output file in Excel format. And we are using 4.6 C version.
    how do i attain this?

    Hello,
    One alternate solution can be :
    Execute your report in background and then send the data to Spool .
    From this spool , you can download the data in excel file.
              SUBMIT xyz TO SAP-SPOOL
                 SPOOL PARAMETERS gt_print_parameters.
    Regards,
    Sandeep

  • How to Download Data in Excel Formate

    Hi  Friend,
    I have one doubt on webdynpro with java.  Req: For download data in Excel formate.
    I will follow this http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/3596. [original link is broken] [original link is broken] [original link is broken]
      i am doing upto 3rd Step here.. Up to Step 3 i am doing after 3rd Step  I am not understand. Could u explain 4step.
    1. I have to place TableUtilities.java
    2. I have Create tableutilities value attribute
    3. in Modify view--- This is -SecondView -
    This is having Table UI Element.
         if(firstTime)
    IWDTextView tv = (IWDTextView)view.getElement("total");
    wdContext.currentContextElement().setTableutility(new TableUtilities(wdContext.nodeDepartments()));
    //Returns attribute info of a dynamically created attribute which can be bound to the UI element neeed.
    tv.bindText(wdContext.currentContextElement().getTableutility().CalculateSum("Departments","NoOfPeople"));
    4. Creating an Excel File
    How to Create Excel File here can u explain
    I am not understand this 4th step. Pls give me Breef Explanation. How to write this code...here...
    Regards
    Vijay Kalluri
    Edited by: KalluriVijay on May 4, 2010 8:00 PM
    Edited by: KalluriVijay on May 4, 2010 8:02 PM

    Hi Vijay,
    Please open Microsoft Excel from your system and then create some entries (ex. having 3 columns and 3 rows). Save this file to some location in your system. Later you will need to give the location path of this saved file when uploading it from your web dynpro application.
    Creating of an Excel file (i.e the 4th step) is no where related to Web Dynpro and NWDS.
    Hope this helps!
    Regards,
    Kishan

  • HT201279 convert Numbers file to Excel format

    When I convert my Numbers file to Excel format, each worksheet name is appended with "Table - 1". 
    Each subsequent conversion adds another "Table - 1" to the name of every worksheet as well.
    How do I stop this from happening?

    If you are exporting then importing repeatedly, it will keep appending these things to the names.
    Numbers document with two sheets, both with a single table called "Table 1" will get exported as two Excel worksheets: "Sheet 1 - Table 1" and "Sheet 2 - Table 1". It creates a separate Excel worksheet for every table and names each with the sheet and table name.
    Reimporting this to Numbers will result in a Numbers document with a sheet called "Sheet 1 - Table 1" and another called "Sheet 2 - Table 1" and both will contain a single table called "Table 1".  It imports each Excel worksheet as a Numbers Sheet and creates a table for each called "Table 1".
    It really doesn't work well to import & export repeatedly. Much better to use one app or the other.

  • In new Numbers, can you export a file into excel format?

    In new Numbers, can you export a file into excel format? Or is this something else thats been removed!!??
    HELP!!

    Hi AMGracie,
    In Numbers 3.0 on a MacBook Pro running OS X 10.9
    Regards,
    Ian.

  • Upload a file of Excel Format into Internal Table!!!

    Dear All,
    Currently i have a question for upload a file of excel format, I can just convert the file of excel format to text format first. Then it would be OK.
    As we all know, Frequently,The users would always like to provide the excel format to us. Thus, Is there any solutions directly uploaded the file of Excel format into database for web dynpro for ABAP? Not web dynpro for Java.
    Appreciated what you reply!
    Thanks in advance.
    Richard

    Richard,
    I saw my developer use LSMW to load the excel file to the db table. You must careful with the data that you're going to upload.
    Cheers.
    P/S Point reward is appreciated.

  • Downloading report in excel format.

    Hi,
    I'm newbie on apex. I'm trying to make a report which is enabled to download in excel format. Report is working correctly what I expected.
    But I found single colume data was split multiple cell in downloaded excel file. I don't know how I can merge this cells into one.
    I made a sample report with data.
    http://apex.oracle.com/pls/apex/f?p=9971:2:0::NO
    If you download this report, you can see 'Long Text' is split into two or three cells.
    Any information will be welcomed.
    Thanks
    Jaenyun

    Thanks for your reply.
    If I change column display type in input form to text field from textarea, It makes to prevent to input enter key in text data.
    But I hope user can input enter key in text data. So still I need another way to download data into single cell.

  • Error while downloading output in excel format using FM Gui_download

    Hello All,
    <removed by moderator>
    While downloading the necessary output of a Ztransaction in excel format the excel file only shows one 1 record whereas in the output there were 88 records.
    When I am downloading it in other formats like Rich text etc. the data is getting downloaded correctly as per the output.
    Now this problem is occuring in Production & Quality whereas in Development the excel file is downloading data correctly.
    I have compared the code in the different clients as well as debugged it but the code is the same in each case.
    There is no data corruption in the final internal table as well.
    So what else can be done?....
    The data needs to be downloaded as it is in the output in the excel format.
    Kindly give me some suggestion and help me out in this regard.
    Edited by: Thomas Zloch on Nov 1, 2011 10:04 AM

    Hi,
    Did you the use the GUO_download using the following values:
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename         = fullpath
        filetype         = 'ASC'
        codepage         = space
        write_bom        = 'X'
      TABLES

  • Render a CSV file in Excel format

    Hi
    I am trying to render a report from BI Publisher in a CSV format. In OBIEE when the report is downloaded as csv, it gets rendered in Excel format. Is there some way to do the same in BI Publsiher also?
    Regards
    Sujith

    Now, i dont think, you can get it automatically open with excel.
    Even if you create RTF template, and get excel output, its not going to be a comma separated file, but it will be a excel file.
    I guess, you have to create RTF template and choose excel option and see, if it fits your requirement.

  • Converting Text seperated file into excel format file without opening Excel

    Hello Sir,
    I am posting this question again,since i did not get any response,sorry for the inconvinience caused..
    I have a Text file(Test.txt,the data inside it is in specific format seperated by TAB) which i would like to convert it into an Excel file(Test.xsl) without opening MS-Excel.Is there any java code to accomplish it.If yes, can i please get the source code for the same or some Utility.
    I am working on a Windows 2000 platform, on J2EE application server and on CRM based application.
    I had gone through many topics related to my problem,but could not get satisfactory results...
    Any help would be appreciated,
    Thanks in advance

    Hello Sir,
    I am rephrasing my question,i have a Comma Separated File (1042-1.txt)which i would like to convert it into an Excel file (1042-1.xls) without opening MS-Excel using java code...
    So that the data in the Text file gets populated into the columns of the Excel sheet using the java code.
    I am working on a CRM based application and the application is generating a Text file(1042-1.txt) through PL/SQL Packages on the Servers particular directory and this file is getting Downloaded.
    My requirment is that the Users of my application should be presented with an Excel file(1042-1.xls), so that they do not have to Open the Text file in Excel and then do the Importing...instead they should be provided with the Excel file itself...
    Please Can anybody provide me with a solution for the same...
    Thanks,
    Regards.

  • Issue while downloading file in .CSV format

    Hi,
    I need to download the file in .CSV format.
    I hade used FM SAP_CONVERT_TO_CSV_FORMAT  and then used GUI_Download.
    Now when I am opening file which is downloaded, it gives all the data in a single column. If there are 5 fields in my table, the generated file gives the data of all the 5 fields in a single column.
    Could you please help?

    Hi try wi th the following code.
    TYPE-POOLS : truxs.
    DATA: t_file TYPE STANDARD TABLE OF type_file.
    data:t_conv_data TYPE truxs_t_text_data.
    CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'
      EXPORTING
        i_field_seperator          = ', '
      TABLES
        i_tab_sap_data             = t_file
    CHANGING
       i_tab_converted_data       = t_conv_data
    EXCEPTIONS
       conversion_failed          = 1
       OTHERS                     = 2.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                = 'C:\TESTCSV.CSV'
        filetype                = 'ASC'
        write_field_separator   = '  '
      TABLES
        data_tab                = t_file
       fieldnames              = names
      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
        OTHERS                  = 22.

  • Download file in different formats(its urgent)

    Hi experts,
    I have a problem when downlaod a file in different formats.
    File should be downloaded 3 Formats.
    1. DWG
    2. DXF
    3. PDF
    this file is used for CAD Drawings.
    So i required a Functional Modules to generate a file in 3 different formats.

    Hi,
    You can download an internal table data (of report format) into PDF
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    * BIN_FILESIZE =
    filename = i_pfad
    filetype = 'BIN'
    * IMPORTING
    * FILELENGTH =
    TABLES
    data_tab = i_att_cont
    EXCEPTIONS
    file_write_error = 1
    no_batch = 2
    gui_refuse_filetransfer = 3
    invalid_type = 4
    OTHERS = 5.
    But DWG DXF are third party specific, i think in SAP we don't have functional modules to download in these
    aRs
    Points are always welcome

  • Save file to excel format

    -the 3... version of SQL developer has one very important function (from my point of wiev) done unnecessarily difficult.
    - in earlier versions (2...) was simply “export data, -> xls- “ and the out coming file was ..in any editable form of Excel – format
    - I (personally) moved back using TOAD – main reason was because that sort of unnecessary inconvenience of transferring data to the format my clients wants -- it is boring
    Eero M

    I see your point, but I applaud the new Excel output options. I use this feature constantly, and the couple of extra default values and clinks are worth it. Options:
    *Maybe just add a "finish" button to the Wizard so that it skips the next "tab" in it (basically defaults to the old Excel export technique). Even with the new features, I think that it is literally just one extra click compared to prior versions.
    *Fix the issue where there is an empty column appended to the right of the data (this has been there in all versions to date). To see it, unload to Excel. Open the file in Excel and hit ctrl-end.
    *Allow the system to use an Excel "template" so that it uses default fonts, colors, etc. Within the "template", allow you to pick the worksheet and cell that the output goes to (e.g. Summary!A4).
    *Fix the date issues, so that when it is exported to Excel, Excel treats dates as real dates not strings
    *Support the newer Excel 2007 file format (this has been around for 3 years now)
    *Make the SQL easier to read (great feature, difficult to read it). We use SQL Developer to handle a lot of ad hoc queries, and it is convenient to have the SQL worksheet since it saves documenting and debugging time dramatically. The SQL output that is shown on the "Unload Summary" looks right, but when it gets exported, the carriage returns don't display nicely.
    All of the above have been entered into the "Exchange" before. Obviously, we can't expect everything to be done by Oracle, but it is great to see them adding capability to this area of the tool. I'd probably try making an extension, but I don't know Java.

  • Download File In Csv Format

    Hi all,
        I want to create a file on the presentation server with csv format. i used gui_download function. The file is created but it is not csv format.
    it is urgent please can you help e out in this
    I used filetype as 'ASC' then CSV but in vain
    GV_ERR_FNAME = '
    SAM\ERRORFILE.CSV'
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        FILENAME                        = GV_ERR_FNAME
        FILETYPE                        = 'ASC'
        WRITE_FIELD_SEPARATOR           = 'X'
      TABLES
        DATA_TAB                        = GT_ERROR_TAX
    THANKX IN ADV

    Please check out this sample program.
    report zrich_0001.
    data: begin of itab occurs 0,
          fld1(10) type c,
          fld2(10) type c,
          fld3(10) type c,
          end of itab.
    data: begin of iout occurs 0,
          rec(1000) type c,
          end of iout.
    parameters: p_file type localfile default 'C:test.csv'.
    data: file type string.
    start-of-selection.
    * Build the ITAB
      itab-fld1 = 'A'.
      itab-fld2 = 'B'.
      itab-fld3 = 'C'.
      append itab.
      itab-fld1 = 'D'.
      itab-fld2 = 'E'.
      itab-fld3 = 'F'.
      append itab.
      itab-fld1 = 'G'.
      itab-fld2 = 'H'.
      itab-fld3 = 'I'.
      append itab.
    * Build the output internal table from ITAB
    * Concatenate all fields into IOUT-REC
      loop at itab.
        concatenate itab-fld1 itab-fld2 itab-fld3 into iout-rec
                    separated by ','.
        condense iout-rec no-gaps.
        append iout.
      endloop.
    * Now Download
      file = p_file.
      call function 'GUI_DOWNLOAD'
           exporting
                filename = file
           tables
                data_tab = iout
           exceptions
                others   = 22.
    Regards,
    Rich Heilman

  • Download file in particular format

    I want to download a file. The downloaded file should open in its corresponding application. A �.DOC� file should open in MS Word and �.XLS� file should open in MS Excel. What should be set in HttpRequest and/or HttpResponse objects to achieve this?
    thx in advance

        String      objectName = "whatever_you_like.doc";
        response.setContentType( "application/octet-stream" );
        response.setHeader( "Content-Disposition", "attachment; filename=\"" + objectName + "\";" );
        OutputStream        out = response.getOutputStream();
        //....

Maybe you are looking for

  • Authorisation object for Supplier field in Shopping Cart

    Hi Team, In Shopping Cart Source of Supply tab field Supplier is not getting displayed as it in hidden for some users, sor those users an authorisation object has to be provided to display the Supplier field. Can you please Suggest me the authorisati

  • Why Is My iPhone 4 Struggling To Pick Up a Wifi Signal My Macbook Has No Problem Receiving?

    I have both an iPhone 4 and a late 2009 Macbook.  I work at an office just a few yards from the local hospital.  The hospital has a public wifi that is definitely receivable, although weak in spots.  But what I have noticed is that my iPhone 4 has a

  • Stream from Thunderbolt to TV

    I'm using a MacBook Pro 8.2 and want to stream video to a Sony Bravia TV. I've connected them with a cable from the Thunderbolt port to the HDMI port on the TV. I bought the cable for this purpose at an Apple store ans was toldit would work. But now

  • Lid closed

    Hi i noticed this at the office today when i packed my baby into it's little slip case. When you close the lid and the two clasps click in, are the corners evelvated ? Mine the right hand end is away from the base by several mm, that's nearly 1/5 of

  • Can someone help with problems with Silverlight already downloaded on my MacBook?  Not working and can't trash!  Please help!

    Have a new Mac Book pro and have Netflix program that does not stream down.  Have talked with Netflix, Microsoft and Mac support - who referred me back to Microsoft - and no one has been able to get the Silverlight folder trashed so I can redownload