Exporting to Excel - ALV Grid

Dear Experts,
I have come across a strange scenarion where in the "Export to Excel" functionality from an ALV grid behaves differently for different layout selections.
for eg: I have my output list with 10 fields displayed. If I export the list to the excel using the button from the application tool bar of the grid, my output excel is having only the column headings without any values. Where in say, if i select all the fields of the output list (around 20), then the output is perfect into the excel.
Kindly let me know what would be the problem and how to handle them.
Lots of rewards awaiting.
Thanks.
Arunkumar S

Hi Arunkumar,
Some time export to excel through Local file-->spreadsheet option behave abnormally.
You can do one thing as you have all your data in internal table.
Add a button " Export to excel" in Menu painter and use following code in subroutine user_command
  CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
    EXPORTING
      DEFAULT_EXTENSION = 'XLS'
      DEFAULT_FILE_NAME = L_FILE_NAME
    CHANGING
      FILENAME          = L_FILENAME
      PATH              = L_PATH
      FULLPATH          = L_FULLPATH.
thanks,
shilpa

Similar Messages

  • Want to export output of alv grid to excel automatically

    hi friends.............
      i want to export output of alv grid without displaying on screen to excel file .......................
    how i m able to do it ..............................
    in the same way as after alv grid display click on LOCAL FILE-> SPREADSHEET-> ........................
    plz rply me soon if anyone of u know abt that.................
    thanks allot.............

    actually in output through 'REUSE_ALV_GRID_DISPLAY' some title is also there through TOP_OF_PAGE how can download it also and data table in excel sheet ...................
    actually when an alv output is displayed then some title data  is also displayed in alv grid then we can download it by clicking on icon 'local file--> spreadsheet........and soon ' ..........
    my req. is download it automatically without doing this process and without displaying it on screen......... it means i want to interrupt to alv grid output to only download without displaying it in output screen............
    if u clear my question then reply me.............

  • Leading Zeros Missing - When exporting data from ALV grid display to Excel

    Hi,
    Am exporting the data from ALV GRID DISPLAY to Excel sheet using standard toolbar icon 'Local file'
    the leading zeros displayed in the ALV output is missing in the EXCEL sheet.
    (eg)  in ALV o/p - 0029. 
            in Excel - Only 29 is appearing.
    As per the requiement i have to show the leading zeros in excel also.
    Pls help on this issue.
    Thanks in advance..

    Hi ,
      Please set the property  :
      wa_fieldcat-lzero = 'X' .
    when you are creating field catalog for display alv data .
    your prob will solved .
    Regards ,
    Nilesh Jain

  • Exporting content of ALV grid in Web Dynpro for ABAP

    Hello Experts
    I have a following request which seems to be giving some headaches.
    I need to export results from one of the Web Dynpro reports (ABAP) I have developed to the Excel spreadsheet. Results are stored on ALV component. Request is to add header to export file with additional information like report title, selection criteria, date when report has been executed. By default export file contains only column names and data. I have set the header for ALV grid with all extra information I need to be passed to Excel file but it does not seem to be transferred at all.
    At the moment I see 2 possible solutions: 1) write my own Excel export 2) use PDF export where it is possible to set header/footer text. None of these solutions are ideal, I'd rather set header in standard Excel export. Is that even possible? Please help.
    Regards
    Michael
    Edited by: Soltuion Manager on Apr 20, 2009 10:08 AM
    Edited by: Soltuion Manager on Apr 20, 2009 10:26 AM

    Hello Michael,
    I haven't tried using the builtin functionality of ALV to achieve a similar fnctionality as yours but can suggest you a workaround for that. As how you might be already knowing you can try using the CL_WD_RUNTIME_SERVICES=>attach_file_to_response to download the contents into Excel/notepad/word. So just can modify the internal table to contain the extra information that you need. You can use the approach below for using the attach_file_to_response method:
    1) First read the table's data into an internal table.
    2) Convert the internal table data to STRING format.
    3) Now convert it into tab separated format as how desired.
    4) Convert this STRING format to XSTRING format
    5) Make use of the attach_file_to_response method.
    Regards,
    Uday
    METHOD onactionon_submit .
      DATA: lv_node TYPE REF TO if_wd_context_node,
            lt_mara TYPE if_main=>elements_mara,
            wa_mara TYPE if_main=>element_mara,
            lead_selection_index TYPE i,
            mara_string  TYPE string,
            mara_xstring TYPE xstring.
      lv_node = wd_context->get_child_node( name = 'MARA' ).
      CALL METHOD lv_node->get_static_attributes_table
        IMPORTING
          table = lt_mara.
      LOOP AT lt_mara INTO wa_mara.
        CONCATENATE mara_string
                    wa_mara-matnr
                    wa_mara-ersda
                    wa_mara-ernam
                    wa_mara-matkl
                    wa_mara-meins
                    cl_abap_char_utilities=>cr_lf INTO mara_string
                                            SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
      ENDLOOP.
    ** Now you need to add the column headers & the desired extra information through coding to
    ** mara_string
      CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
        EXPORTING
          text   = mara_string
        IMPORTING
          buffer = mara_xstring.
      CL_WD_RUNTIME_SERVICES=>attach_file_to_response(  i_filename  = 'TEMP.XLS'
                                                        i_content   = mara_xstring
                                                        i_mime_type = 'EXCEL' ).
    ENDMETHOD.

  • Excel-Export in ALV-Grid not available

    Hello,
    I have a strange problem with the Export-functionality within ALV Grid. The Export-options "Spreadsheet", "Word processing", "Local file" and "Send" are not available at all PC's. I don't know if this issue is related to  SAP Gui, Patches ...

    Thanks for info - I was original thinking of the "Expert mode" option in some Report Writer outputs... but that was a different issue...
    Is it user specific or PC specific?  If the former, you might like to look in table SALV_BS_ADMIN (which can be maintained via report SALV_BS_ADMIN_MAINTAIN) as this can impact what the user sees in some ALV options - we were having problems a few weeks ago on an ECC5 system in this area - Note 1080608 and others explain more.
    Jonathan

  • Alv grid with data

    hey,
    alv grid method for export data from alv grid  to itab.
    regards,
    purna

    Hey,
    Any methods for exporting  alv grid data into itab.

  • Running report with alv grid in background and exporting to excel

    Hi Guys,
                  I've created a report program that uses the alv grid. When I run the report in foreground, I can easily export it to excel. However, if I run it in background, then display the spooled report and try to export to excel, it does not put it in excel format (seems to go over as one big column rather than individual columns that are defined in the report). Is there a way to run it in background ,export to excel properly and i have to email also in Excel sheet format.?
    Thanks,
    Gopi.

    In background u cannot do a download to excel. you can do is create CSV format file
    or
    write a report for output with tabs then call that report using
      submit yXXXX exporting list to memory
               and return.
      call function 'LIST_FROM_MEMORY'
        tables
          listobject = report_list
        exceptions
          not_found  = 1
          others     = 2.
    and send the report_list to email users

  • Problem while alv grid display exporting to excel sheet

    Hi,
      I have done an ALV report using reuse_alv_grid _display , out put is fine , but when i click on excel view icon i could only see an excel sheet without any data ., but when i use export to local file and choose spread sheet its giving the data in excel, but the user wants to click only the excel view icon.
    Best Regards

    Hi,
    Check this link
    [Problem with Excel button in ALV Grid...URGENT;
    Regards,
    Sathish Reddy.

  • How to remove values formatting in export to excel from ALV grid

    Hi all,
    I have small issue, I have ALV Grid with some data, but the problem is with columns containing e.g. gross amounts, because it is displayed in the grid as e.g. 1.764,81, and after export to excel it is still in this format (with dot and comma), so excel doesn't treat it as numeric value but as text, and then when I try to calculate total on the column then this values are not taken to the total. Do you know if that is possible to remove column formatting?
    kind regards,
    Marcin

    I replied too soon to Peter's suggestions.  For some reason, I was able to add new info. to my first new row, but not the second.  However, I finally figured out the problem.
    I found the Help Center page on: "Here are ways to change custom formats and apply changes to table cells:"
    To change the elements associated with a custom format that’s been applied to cells, select the cells and click Show Format in the Format pane of the Table inspector.
    I saw that the "cell format" was listed as "automatic," so I changed it to "Custom;" then left the new custom window at it's default settings. Now my cells would accept pasted info. without spreading it through the lower rows.  Whatever automatic was in the table, it was not what I wanted. Doing this to other new cells, solved my problem.  Thanks again.

  • Exporting ALV Grid output to Excel sheet

    Hi All,
           How can i export the output displayed using Grid to an Excel sheet. I tried with default option from list->export->excel sheet/local file but i am not getting complete data and the data which i am getting also notin proper format. Please help me in this regard.
    Best Regards,
    Sunil

    Check out the ALV grid toolbar for export options.
    Regards
    Raja

  • Error While ALV Grid is exported to Excel.

    Hi Experts,
    I get an error OBJECTS_NOT_CHARLIKE , while I try to download an ALV Grid , to an excel file using the standard icon Export  present on the ALV Grid.
    Regards.
    Edited by: sunitha j on May 19, 2009 1:15 PM

    This happens when your output list contains qty. or amount fields.
    To fix the error use sap table name instead of your internal table name while preparing field catalog.
    In case you are forced to use int. table name while preparing field catalog , add "quantity" field for qty figures and "currency" field for amount figures.
    Example :
    it_catalog-fieldname = 'MENGE'.
    it_catalog-quantity = 'NOS'.
    it_catalog-tabname = 'i_bseg'.
    it_catalog-seltext_s = 'Quantity'.
    APPEND it_catalog TO it_fieldcat.
    it_catalog-fieldname = 'DMBTR'.
    it_catalog-tabname = 'i_bseg'.
    it_catalog-seltext_s = 'Amount'.
    it_catalog-currency = 'INR'.
    APPEND it_catalog TO it_fieldcat.

  • ALV Grid Exporting to Excel - Columns out of order

    Hi,
    In my ALV grid everything is in order as it is in the structure. When however I export to excel from ALV grid, the columns are out of order. First it lists the string columns, then number columns and lastly date columns. Is there a way to make excel keep the same order as it is in ALV grid?
    Thanks,
    Sergiy

    I am not much of an ABAPer but I was able to set the column position during data declaration with
    gs_fcat_line-col_pos = 1, for example.
    That would put the column in the first position in ALV as well as the excel export.
    Thanks for your inputs.
    Sergiy

  • Problem: User has problems to export ALV Grid to Excel...

    Hello experts,
    I have a very strange problem with an single user: when she tries to export ALV Grid data from SAP into Excel by List/Export/Spreadsheet, she's only able to export this to an xml-based file on her local client, every other user gets the popup to choose the spreadsheet format (XXL...).
    What I did so far:
    - Look up Excel Makro Security --> the same as on other desktops
    - SAP GUI Patch Level --> the same as on other desktops
    - Test with an different user on her desktop on SAP Report S_ALR_87012284 --> it worked perfectly
    - User parameters are the same as for the test user
    - Security regarding ALV is the same (S_GUI ACTVT = 61...)
    Has there ever been a similar problem to anyone else?
    Many thanks in advance for your feedback!

    Hi ,
    This problem looks very weired. Just try running that FM from SE37 from the same system and see that what is happening there.... if the problem is similar then it is not the problem of your report and some patch may be missing in that system.

  • Total problem in Exporting ALV GRID to Excel

    Hi all,
    I have manipulated the Total of ALV Grid by using GET_SUBTOTALS and REFRESH method of CL_GUI_ALV_GRID. The ALV Output is also correct. When i export to Excel,only the Original total is displaying not the calculated one. How to download the exact output which is displaying in the ALV Grid to Excel.
    Please help me out to solve this.
    Thanks,
    Ramesh

    DEAR,
    AS U WANT UPLOAD WITH THE SUB TOTAL YOU TRY THIS.
    FIRST to get subtotal in ALV output you select at least one column of total and then press ctrl + F6 . u will see the sub total .
    and now how to download it so press  ctrl + shift + F9 .
    now screen appears and select second option ie spreadsheet and press enter
    now a screen appear  in wich u have to give file name.
    so double click on search button of file name . click on desktop  give ur file name as u want suppose zreport u have given.
    and save type = excel file.
    now save it and then generate it your output bytes will be transmitted .
    now u can see in your desktop in your file name . ur output with subtotal.
    regards
    navin

  • ALV GRID Export to Excel button Missing

    HI All,
    I am facing some problem with ALV GRID. When excuting the report with my user id I am able to see the 'Export to Local file' button in the ALV GRID where as if i am excuting with another user id which is having less authorisations than the button is greyed out.  I checked by giving all authorisation than we are able to see the button.
    Could anyone please tell me which authorisation object we have to assign to see the buttons.
    Thanks & Regards,
    Murali.

    Hi,
    Before clicking on the Export to Excel button, start the debugging session by placing the command /H in the command prompt.
    Now, put the break point at statement AUTHORITY-CHECK. Now it will trigger all the authorization objects relevant to this.
    check the sy-subrc value gets failed.
    Regards,
    Santhosh.

Maybe you are looking for