Downloading ALV to excel file

Hi all,
   i am trying to download ALV to excel file.
   but as the alv contains many fields,
   the row in the excel is automatically wrapped to the
   next row ..
   what i want is the row in excel should come as it is
   in the ALV (whole thing in one line) and should not wrap to next row
  Regards,
  Tarang

Hi Shah,
<b>
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'</b>
    EXPORTING
      I_CALLBACK_PROGRAM      = V_REPID
      I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
      IS_LAYOUT               = WA_LAYOUT
      I_SAVE                  = 'A'
      IT_FIELDCAT             = I_FLDCAT_HEAD
      IT_SORT                 = IT_SORT
      IT_EVENTS               = I_EVENTS
    TABLES
      T_OUTTAB                = IT_FINAL
    EXCEPTIONS
      PROGRAM_ERROR           = 1
      OTHERS                  = 2.
  IF SY-SUBRC = 0.
<b>     CALL FUNCTION 'GUI_DOWNLOAD'</b>
     EXPORTING
      BIN_FILESIZE                    =
        FILENAME                        = 'C:\Documents and Settings\vikranthk\Desktop\vikranth.xls'
       FILETYPE                        = 'ASC'
      APPEND                          = ' '
      WRITE_FIELD_SEPARATOR           = ' '
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
      CONFIRM_OVERWRITE               = ' '
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
    IMPORTING
      FILELENGTH                      =
      TABLES
        DATA_TAB                        = it_final.
      FIELDNAMES                      =
    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
Thanks
Vikranth Khimavath
Message was edited by: Khimavath Vikranth

Similar Messages

  • Download ALV into excel file

    Hi experts,
                   I used subtotals in ALV.first three columns I claculated based on the addition of individual column.In fourth column i calculated the value based on three calculated values ...It is  not problem.
              when i download this into excel file the original value is only coming .the calculated value i.e) calculated based on three values didnt get displayed in excel file..Help me please...
    Thank u,
    Manjula Devi.D

    Hi.
    I find that
    List > Export > Spreadsheet
    gives no subtotals, but
    List > Export > Local File and then Spreadsheet
    does give subtotals.
    I find that
    Views > Microsoft Excel
    followed by
    Save As
    does give subtotals.
    John

  • Download ALV to EXcel- Urgent pls help me

    Please help me in this...
    I have an ALV report around 120 column. The report is displayed perfectly on screen. But when I use the Export option to download as an excel file, some data is missing in SAP No field
    For example
    My report output is like this
    sap No    Name    Jobdes.   Dept
    00021     AAA      clerk1      FI
    00022     BBB      clerk1      FI
    00023     CCC      clerk1      FI
    00024     DDD      clerk1      FI
    00025     EEE      clerk1      FI
    00026     FFF      clerk1       FI
    Excel output is
    sap No    Name    Jobdes.   Dept
    00021     AAA      clerk1      FI
    Blank     BBB      clerk1      FI
    Blank     CCC      clerk1      FI
    Blank     DDD      clerk1      FI
    00025     EEE      clerk1      FI
    Blank    FFF      clerk1       FI
    Pls help me

    Hi Kumar,
              Pls try the below Function Modules to download the data to excel.
    ALSM_EXCEL_TO_INTERNAL_TABLE
    KCD_EXCEL_OLE_TO_INT_CONVERT – Uploads data directly from Excel sheet
    RH_START_EXCEL_WITH_DATA – Starts Excel with contents of an internal table
    or the below links also might help you.
    For uploading Excel to Internal Table??????
    Data from Excel sheet to my internal table
    Check the following link:
    http://www.sap-img.com/abap/upload-direct-excel.htm
    or even the below code might be helpful.
    Multiple excel sheets generation in a workbook
    CREATE OBJECT EXCEL 'EXCEL.SHEET'.
    GET PROPERTY OF EXCEL 'Application' = APPLICATION.
    SET PROPERTY OF APPLICATION 'Visible' = 1.
    CALL METHOD OF APPLICATION 'Workbooks' = BOOKS.
    CALL METHOD OF BOOKS 'Add' = BOOK.
    CALL METHOD OF BOOK 'WORKSHEETS' = SHEET.
    CALL METHOD OF SHEET 'ADD'.
    Fill all the sheets with relavant data
    PERFORM SHEET1 TABLES ITAB1.
    PERFORM SHEET2 TABLES ITAB2.
    PERFORM SHEET3 TABLES ITAB3.
    PERFORM SHEET4 TABLES ITAB4.
    Quit the excel after use
    CALL METHOD OF EXCEL 'QUIT'.
    FREE OBJECT: COLUMN,SHEET,BOOK,BOOKS,APPLICATION,EXCEL. "NO FLUSH.
    CLEAR V_SHEET.
    FORM FILL_CELL USING ROW COL VAL.
    CALL METHOD OF SHEET 'cells' = CELL NO FLUSH
    EXPORTING #1 = ROW #2 = COL.
    SET PROPERTY OF CELL 'value' = VAL.
    FREE OBJECT CELL NO FLUSH.
    ENDFORM. " FILL_CELL
    FORM SHEET1 TABLES ITAB1 STRUCTURE ITAB1.
    V_SHEET = Sheet Name.
    V_NO = V_NO + 1.
    CALL METHOD OF BOOK 'worksheets' = SHEET NO FLUSH EXPORTING #1 = V_NO.
    SET PROPERTY OF SHEET 'Name' = V_SHEET NO FLUSH.
    PERFORM FILL_SHEET1 TABLES ITAB1 USING V_NO V_SHEET.
    CALL METHOD OF SHEET 'Columns' = COLUMN.
    FREE OBJECT SHEET.
    CALL METHOD OF COLUMN 'Autofit'.
    FREE OBJECT COLUMN.
    ENDFORM.
    Repeat above procedure for all sheets you want to add
    FORM FILL_SHEET1
    TABLES ITAB1 STRUCTURE ITAB1
    USING V_NO V_SHEET.
    ROW = 1.
    PERFORM FILL_CELL USING ROW 1 'Column1 Name'.
    PERFORM FILL_CELL USING ROW 2 'Column2 Name'.
    PERFORM FILL_CELL USING ROW 3 'Column3 Name'.
    ROW = ROW + 1.
    LOOP AT ITAB1.
    PERFORM FILL_CELL USING ROW 1 ITAB1-Column1.
    PERFORM FILL_CELL USING ROW 2 ITAB1-Column2.
    PERFORM FILL_CELL USING ROW 3 ITAB1-Column3.
    ROW = ROW + 1.
    ENDLOOP.
    ENDFORM.
    Repeat above procedure for all sheets you want to add
    Try this also
    TYPE-POOLS: truxs.
    DATA: it_raw TYPE truxs_t_text_data.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    CALL FUNCTION 'F4_FILENAME'
    EXPORTING
    field_name = 'P_FILE'
    IMPORTING
    file_name = p_file.
    Upload Excel file
    CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
    EXPORTING
    I_FIELD_SEPERATOR =
    i_line_header = 'X'
    i_tab_raw_data = it_raw
    i_filename = p_file
    TABLES
    i_tab_converted_data = i_XCEL[]
    EXCEPTIONS
    conversion_failed = 1
    OTHERS = 2.
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    Pls reward if useful.
    THanks,
    Sirisha

  • Downloading report in excel file

    When I download reoprt in excel file then if material no is 0002134 then in the excel file this becomes 2134,
    I am saving file from the Menu System->Save-> Local fiie and then selecting spreadsheet.
    When I save as text file then it is not removing leading zeros, only in excel file it is removing leading zeros.
    I wanted to know that how to download in excel file so that my material no should download as it is .
    Thanks
    APrasad

    Menu System->Save-> Local fiie and then selecting spreadsheet.
    Spreadsheet is not EXCEL. It is a an internal format.
    if you enter xls as extension, then you just tell Microsoft to open this file with excel.
    Excel then automatically coverts it to its own rules.
    When download with Menu System->Save-> Local fiie and then selecting spreadsheet enter the file extension txt
    Then open Excel, use file > open
    find your file and open it, Excel will come up with an import assistant.
    there you can define if the column is to be loaded as numbers or text.

  • Downloading from alv to excel file

    hai
       while downloading from alv grid to excel  file
      i am not getting values properly. i have taken 110 fields. i am not getting prper way. can u plz tel me way....

    Hi ....
    I have the similar problem. My coumns are not in any sequence when I download it to excel sheet.
    How do I fix it.
    Neha

  • How to download alv to excel but translate char to number  ?

    i have alv report that the user want to download the
    result to excel , ok you have two ways  :
    1) excel inplace , its work good but in big amount of
       data the option is working slow and the user
       dont want to use it .
    2) download it as local file , the problem is that
    the fields that contain the amount is char format
    due to using dynamic columnes,
    so how can i convert the field that it will be download
    to excel as number  ?
    i tried to change the fieldcatalog to :
    LS_FCAT-DATATYPE  = 'QUAN'.
    LS_FCAT-INTTYPE = 'P' .
    but its not help .
    thanks .

    hi dakota,
    you could make your own download-routine.
    before downloading you move the data in an internal table where all fields have the wanted format.
    then download it with function module "GUI_DOWNLOAD" name the file ".xls" and use filetype "DBF".
    this way you get an excel with formatted rows as you like.
    br,
    matthias

  • Downloading ALV to EXCEL - in some fields the last character is missing ...

    Hi,
    I am experiencing this kind of problem when downloading ALV report into Excel :-
    "You are downloading an ALV result to an EXCEL file. In some fields the last character is missing."
    For example, if MATNR is 0000234567 in display but after downloading to excel it becomes only 23456.
    I found another related forum thread : Pronlem while downloading ALV grid to excel
    I tried the suggested method to apply OSS note 1075315. However, the note cannot be implemented in the system. I am working in a ECC6 environment (SAP version 700, 701).
    Kindly please help me if you came across the similar kind of issue. Thanks much.

    Hi gkGoh8     ,
    The link thread that you just gave already provided the answer, in your field catalog you need to activate field lzero.
    1. Check FM : REUSE_ALV_GRID_DISPLAY
    2. Import Parameter tab :IT_FIELDCAT
    3. Double click SLIS_T_FIELDCAT_ALV
    4. On type group SLIS, check line 93
    Regards,
    JQC

  • Reg: Download report into Excel file

    Hi All,
    While downloading the ALV report into excel file(System -> List -> Save -> Local file) or (List -> Export -> Local file), i cannot download full report in to excel. Even though the report contains just 200 rows(I can able to download about 90 lines).
    Some reports can able to download all the data, even the report is very big. Currently I am blind to solve, anyone can help me to solve this issue.
    Thanks in advance.

    The most elegant way of downloading ALV display data to EXCEL is displaying the excel in the SAP GUI screen itself.  Select "Excel in Place" and then save it from there. Before that you need to let the VB script of SAP know as trusted macro. This is done by opening a blank excel file then go to Tools > options > Security > Macro Security > Trusted Publishers (tab) > (check) Trust access to Visual Basic Project.  This activation is one time activation. Once you do this you can see ALV display exactly like in normal ALV with all the colors fields etc.

  • Regarding ME2L - Download output to Excel File

    Hi Friends,
    In ME2L, I have requirement to download the Purchasing Documents Per Vendor Report Output to a Excel File.
    Could be helpful is there any UserExit or Enhancement point to modified or Can let me know how to do this.
    Regards,
    sg.

    Hi,
    Go to me2l tcode.....then change the "Scope of List" into "ALV".....and execute it.....now on the tool bar...click on "LOCAL FILE"....now select the radio button "Spreadsheet".....and perform your work..
    Arunima

  • Error while downloading ALV to excel

    hI - I am dowaloading an ALV report to Excel file .
    But that ALV contains japenese charactres so after downloading to excel . it got converted to cryptic/garbage characters . Please advice

    HI Arun,
    The Japanese characters should also be available in the excel.
    You can change the default language in microsoft office to Japanese and then try again.
    Or you may have to import a japanese font into your fonts folder of your windows..
    Hope it helps.
    Lokesh
    Message was edited by:
            Lokesh Aggarwal

  • Japenese charc not prinitng while downloading ALV  to excel

    hI - I am dowaloading an ALV report to Excel file .
    But that ALV contains japenese charactres so after downloading to excel . it got converted to cryptic/garbage characters . Please advice

    HI Arun,
    The Japanese characters should also be available in the excel.
    You can change the default language in microsoft office to Japanese and then try again.
    Or you may have to import a japanese font into your fonts folder of your windows..
    Hope it helps.
    Lokesh
    Message was edited by:
            Lokesh Aggarwal

  • Download ALV to any file

    Hi Experts,
    I am not able to see the standard ALV toolbar to download the output to an Excel or local file..etc.
    I placed my ALV container on a screen below some I/O text boxes in display mode only.
    I also need to download the I/O text boxes.
    Can someone help me with this?
    Thanks
    Dany

    Hi Dany,
    Could you verify that in the layout the no_toolbar option is equal to space.
    Regards,
    Eric
    PD. The standard download button of the ALV, its only going to work for the data on your internal table. In order to download all the data of the screen you are going to need to program the button functionality yourself.
    Add a button to the toolbar and in the user_command do something like this (to export to excel).
    CASE sy-ucomm.
        WHEN 'DOWNLOAD'.
          filefilter = 'Ficheros EXCEL (*.XLS)|*.XLS|Ficheros de texto (*.TXT)|*.TXT|Fich.(todos) (*.*)|*.*|'.
          CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'
            EXPORTING
              file_filter       = filefilter
              default_extension = 'xls'
            IMPORTING
              filename          = filename
              path              = path
              fullpath          = fullpath
              user_action       = user_action.
          DATA: wa_filelength TYPE i,
                wa_archivo    TYPE string.
          CALL METHOD cl_gui_frontend_services=>gui_download
            EXPORTING
              filename                = fullpath
              filetype                = 'ASC'
              write_field_separator   = 'X'
            IMPORTING
              filelength              = wa_filelength
            CHANGING
              data_tab                = it_asc_file
            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.
    Declare a table in which you are going to save the data in the same way you want it at the output file
    DATA: BEGIN OF t_asc_file OCCURS 100,
            campo1(50)  TYPE c,
            campo2(50)  TYPE c,
            campo3(50)  TYPE c,
            campo4(50)  TYPE c,
            campo5(50)  TYPE c,
            campo6(50)  TYPE c,
            campo7(50)  TYPE c,
            campo8(50)  TYPE c,
            campo9(50)  TYPE c,
            campo10(50) TYPE c,
            campo11(50) TYPE c,
            campo12(50) TYPE c,
            campo13(50) TYPE c,
            campo14(50) TYPE c,
            campo15(50) TYPE c,
            campo16(50) TYPE c,
            campo17(50) TYPE c,
            campo18(50) TYPE c,
            campo19(50) TYPE c,
            campo20(50) TYPE c,
          END OF t_asc_file,
          it_asc_file LIKE t_asc_file OCCURS 0,
          wa_asc_file LIKE LINE OF it_asc_file.
    Reward points if helpful

  • Error while downloading data into excel file.

    Hi,
        I have a requirement to download data available in xstring to excel file.
    I have a RFC which has export parameter 'file_data' of type xstring. When i call RFC
    from web dynpro abap application it gives data out pout in xstring format.
    I am opening excel file using that xstring data as below
    cl_wd_runtime_services=>attach_file_to_response(
    i_filename = 'file.xls'
    i_content = ls_data_source-data_source   ***[xstring data from RFC]
    i_mime_type = 'x-excel/application'
    i_in_new_window = abap_true ).
    But excel file not coming in correct format. its  giving an error while download
    excel file
    Error is
          " the file you are trying to open , 'file[1].xls', is in a different format than
    specified by the file extension. Verify that the file is not corrupted and is from
    a trusted source before opening the file. Do you want to open the file now? "
    If i click on 'YES' button file opening but not in proper excel format. Data is coming
    in tab delimiter format in excel file.
    Please suggest any solution for this problem.
    Thanks,
    Venkat.

    Hi Thomas,
    Following is the logic implemented in RFC which is giving XSTRING as export parameter
    STEP1      create a dynamic internal table
               Create field catalog for the table   using LVC_FIELDCATALOG_MERGE
                   CALL METHOD cl_alv_table_create=>create_dynamic_table
                        EXPORTING
                           it_fieldcatalog = it_fieldcat
                         IMPORTING
                           ep_table        = dyn_table.
                  CREATE  EXCEL SHEET BY SENDING FIELD CATALOG AND DATA TAB
    STEP2 # Convert text table to xstring.
            CALL FUNCTION 'SCMS_TEXT_TO_XSTRING'
              IMPORTING
                buffer   = l_content
              TABLES
                text_tab = lt_data_tab
              EXCEPTIONS
                failed   = 1
                OTHERS   = 2.
    STEP3  *# Psss Data to Netweaver
              PERFORM pass_data_to_nw USING is_import
                                      CHANGING es_attachment_metadata.

  • Parameter in WEBADI How to Download the WebADI Excel File with Parameter

    Experts, How to Download the Oracle Web ADI Excel File followed by entering Parameters which means the spread sheet should display the data dynamically based on the parameter provided by the end user. Can anybody share any hint or idea? Regards, Gaurav Nagpal.

    Can anybody help me please!

  • Oracle WebADI: How to Download the WebADI Excel File with Parameter

    Hello Friends,
    How to Download the Oracle WebADI Excel File with Parameter??
    For Ex: How to download the Employees for Specific Department from Oracle WebADI.
    And After to change the specific changes on Employee Data to Upload.
    Thanks in Advance.

    Hi Team.
    Any Advise on it!!

Maybe you are looking for

  • After upgrading to Mavericks, I seem to have lost everything in my Outlook for imac 2011.

    after upgrading to Mavericks, I seem to have lost everything in my Outlook for imac 2011. all my email accounts, all my emails, all my folders & subfolders (received & sent) ... everything. help!

  • Create Save to folder if it does not exist

    I have a script that will save a file to a folder up one level.  In other words if the original file was in client/jpg I wanted it saved in client/digipics.  The client folder will always have a different name. I want to add code that will create the

  • APerture 2.1.3 Issue

    I keyword all my photos, and do it really fast by selecting all the photos i want to keyword, by Command clicking, with say 'Jesse' and then hit my shortcut key '2' and they all get that keyword. This is no longer working since i updated to 2.1.3. In

  • Importing 5D Mark II files to CS4 and Windows7

    I tried to import 5D MII native files directly to Adobe Premiere CS4.2.1, Media Encoder CS4 or After Effects CS4 in two different computers and this is what happened; First compuer Premiere Pro CS4 version 4.2.1 with Windows 7 operating system; Resul

  • External Alias for ODATA Service

    Hi, yesterday I tried to add an external alias for an OData service (TC: SICF), but I always got an 500 error after calling the service: 500 SAP Internal Server Error ERROR: URI-Verarbeitung - statischer Pfad in Konflikt mit URI (termination: RABAX_S