Export to excel in ALV

Hi,
I am encountering a problem while exporting the ALV grid output to excel.
The ALV output has 39 columns. When exported to excel the first 38 columns comes in one row and the 39th column comes as a second row under the first column.
Please let me know what is the problem here.
Thanks & Regards,
Soumya.

Hi Soumya,
This is a common problem When list width is more than 1023 Character.
The solution is use 'EXCEL - list viewer interface' . For this follow the menu path List->Export->Spreadsheet...
This will use FM 'XXL_FULL_API' and whole list will be downloaded perfectly.
Regds.
Suman

Similar Messages

  • 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.

  • Tranlation of text 'Export nach Excel' for ALV in WD ABAP

    Hi,
    I've created a WD that uses an ALV component. The problem I have is related to standar ALV texts. There are several buttons in the ALV header but just one is important in this case. The one is 'Export nach Excel'.
    I execute the WD for Spanish language but this text always appears in German. The funny thing is that if I execute in English the text appears translated in English. Spanish language is loaded in the system so this is not the problem.
    I've tried to find this 'Expot nach Excel' text in Se63 but without success. Also I had a look to table LTDXT with no luck.
    Any ideas where I can find this text and translate it into Spanish?
    Thanks.

    Hi,
    there might be incomplete language transports in your system or other things. But first you could position the cursor on the button in the application and then press F1. Then the help information is displayed together with the technical information where you should see the technical info about the object.
    Regards, Heidi

  • Unable to export to excel from ALV

    Hi,
    i was trying to display information in an ALV report and it shows up properly. however, when i click on the excel icon it is not populating the data in the spread sheet though the excel window shows up in place of the report.
    any suggestions will be rewarded. i attached the code below
    Regards,
    ravi.
                F O R M    F I L L _ A L V _ D A T A                    
    FORM fill_alv_data.
      DATA: ls_fieldcat TYPE slis_fieldcat_alv,
            ls_sort TYPE slis_sortinfo_alv.
      CLEAR ls_fieldcat.
    field catalog information
    Purchase order number
      ls_fieldcat-fieldname = 'EBELN'.
      ls_fieldcat-datatype  = 'C'.
      ls_fieldcat-seltext_m  = 'P.O NUMBER'.
      ls_fieldcat-key = 'X'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
    P.O line item
      ls_fieldcat-fieldname = 'EBELP'.
      ls_fieldcat-datatype  = 'NUMC'.
      ls_fieldcat-seltext_m  = 'P.O Line item'.
      ls_fieldcat-key = 'X'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
    Doc. condition number
      ls_fieldcat-fieldname    = 'KNUMV'.
      ls_fieldcat-datatype  = 'C'.
      ls_fieldcat-seltext_m  = 'doc. conditon no'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
    P.O date
      ls_fieldcat-fieldname    = 'BEDAT'.
      ls_fieldcat-datatype  = 'DATS'.
       ls_fieldcat-seltext_m  = 'P.O date'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
    purchasing org
      ls_fieldcat-fieldname    = 'EKORG'.
      ls_fieldcat-datatype  = 'C'.
       ls_fieldcat-seltext_m  = 'Purchasing org.'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
    purchasing group
      ls_fieldcat-fieldname    = 'EKGRP'.
      ls_fieldcat-datatype  = 'C'.
      ls_fieldcat-seltext_m  = 'Purchasing group'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
    vendor number
      ls_fieldcat-fieldname    = 'LIFNR'.
      ls_fieldcat-datatype  = 'C'.
      ls_fieldcat-seltext_m  = 'Vendor number'.
    ls_sort-subtot    = 'X'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
    company code
      ls_fieldcat-fieldname    = 'BUKRS'.
      ls_fieldcat-datatype  = 'C'.
      ls_fieldcat-seltext_m  = 'Company code'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
    short text
      ls_fieldcat-fieldname    = 'TXZ01'.
      ls_fieldcat-datatype  = 'C'.
      ls_fieldcat-seltext_m  = 'Text'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
    Material group
      ls_fieldcat-fieldname    = 'MATKL'.
      ls_fieldcat-datatype  = 'C'.
      ls_fieldcat-seltext_m  = 'Material group'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
    order quantity
      ls_fieldcat-fieldname    = 'MENGE'.
      ls_fieldcat-datatype  = 'QUAN'.
      ls_fieldcat-seltext_m  = 'order quantity'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
    order unit
      ls_fieldcat-fieldname    = 'MEINS'.
      ls_fieldcat-datatype  = 'UNIT'.
      ls_fieldcat-seltext_m  = 'order unit'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
    Gross amount
      ls_fieldcat-fieldname     = 'BRTWR'.
      ls_fieldcat-datatype      = 'CURR'.
      ls_fieldcat-outputlen = '15'.
      ls_fieldcat-seltext_m  = 'Gross amount'.
      ls_fieldcat-do_sum = 'X'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
    Discount Condition
      ls_fieldcat-fieldname     = 'KSCHL'.
      ls_fieldcat-datatype      = 'C'.
      ls_fieldcat-do_sum = 'X'.
      ls_fieldcat-seltext_m  = 'Discount Cond.'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
    Discount amount
      ls_fieldcat-fieldname     = 'DISV'.
      ls_fieldcat-datatype      = 'CURR'.
      ls_fieldcat-outputlen = '15'.
      ls_fieldcat-do_sum = 'X'.
      ls_fieldcat-seltext_m  = 'Discount amount'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
    Net amount
      ls_fieldcat-fieldname     = 'NETWR'.
      ls_fieldcat-datatype      = 'CURR'.
      ls_fieldcat-outputlen = '15'.
      ls_fieldcat-seltext_m  = 'Net amount'.
      ls_fieldcat-do_sum = 'X'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
    Tax code
      ls_fieldcat-fieldname     = 'MWSKZ'.
      ls_fieldcat-datatype      = 'C'.
      ls_fieldcat-seltext_m  = 'Tax code'.
      ls_fieldcat-do_sum = 'X'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
    Tax amount
      ls_fieldcat-fieldname     = 'NAVNW'.
      ls_fieldcat-datatype      = 'CURR'.
      ls_fieldcat-outputlen = '15'.
      ls_fieldcat-seltext_m  = 'Tax amount'.
      ls_fieldcat-do_sum = 'X'.
      APPEND ls_fieldcat TO gt_fieldcat.
      CLEAR ls_fieldcat.
    Striped pattern
      gs_layout-zebra = 'X'.
    sort by p.o number
      ls_sort-fieldname = 'LIFNR'.
      ls_sort-spos      = 1.
      ls_sort-up        = 'X'.
      ls_sort-subtot    = 'X'.
      APPEND ls_sort TO gt_sort.
    ENDFORM.                    "fill_alv_data
                F O R M   A L V _ D I S P L A Y                         
    FORM alv_display.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = 'zreport'
          is_layout          = gs_layout
          it_fieldcat        = gt_fieldcat[]
          it_sort            = gt_sort
          it_events          = gt_events[]
        TABLES
          t_outtab           = T_PO.
      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.                    "alv_display

    Hi Ravi,
    Normally we dont have to write any code for getting data in ALV's Excel inplace View. It is taken by SAP itself.
    Any way waht we can try is just comment
       <b>it_events = gt_events[]</b>
    and test whether the data is getting populated in excel..

  • Error while Exporting to Excel from ALV Report

    Dear Experts,
    When I am exporting my report output to an Excel Sheet  directly some of the headers are appearing in Row No 1 and some are displaying in Row No. 2. Hence the corresponding values are also showing in the same manner.
    I want to show all the Rows in a single row in row No 1. I am unable to find the solution for this.
    But when I am exporting the same report into the MHTML Excel format the Report Headings are showing correctly in a single row and hence the respective values are also showing correctly in a single row. And if I save the same MHTML Excel as normal EXCEL(97-2003) format then also it is showing correctly.
    The problem comes only when I as exporting it directly into EXCEL(97-2003) format. 
    Plz help.

    Hi,
    This is the Technical limitation of ABAP list export to local file.
    ALV grid greater than 1023 characters per line will be split into 2 lines.
    To prevent a line break occuring when you download the list as a local spreadsheet file, you must reduce the width of the list in ALV. You can do this either by hiding columns or by changing the column widths in the ALV. Take care that the column heading characters also dont exceed 1023 characters. This will work.
    Thanks
    LG

  • Problem with Export to Excel from ALV view.

    Hello @all,
    i have a problem on my webdynpro application. I use the component SALV_WD_TABLE. I become display my data but when i want to export the table to ecel, i became a short dump with the message in the browser: Access via 'NULL' object reference not possible.
    When i look at ST22. The system show this text.
    What happened?
        Error in the ABAP Application Program
        The current ABAP program "CL_SALV_WD_A_MODEL_TABLE======CP" had to be
         terminated because it has
        come across a statement that unfortunately cannot be executed.
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_SY_REF_IS_INITIAL', was no
         caught in
        procedure "IF_SALV_BS_MODEL_COLUMN~GET_HEADER_BIND_DDIC_FIELD" "(METHOD)
         was it propagated by a RAISING clause.
        Since the caller of the procedure could not have anticipated that the
        exception would occur, the current program is terminated.
        The reason for the exception is:
        You attempted to use a 'NULL' object reference (points to 'nothing')
        access a component (variable: "LR_HEADER").
        An object reference must point to an object (an instance of a class)
        before it can be used to access components.
        Either the reference was never set or it was set to 'NULL' using the
        CLEAR statement.
    How to correct the error
        If the error occures in a non-modified SAP program, you may be able to
        find an interim solution in an SAP Note.
        If you have access to SAP Notes, carry out a search with the following
        keywords:
        "OBJECTS_OBJREF_NOT_ASSIGNED" "CX_SY_REF_IS_INITIAL"
        "CL_SALV_WD_A_MODEL_TABLE======CP" or "CL_SALV_WD_A_MODEL_TABLE======CM0
        "IF_SALV_BS_MODEL_COLUMN~GET_HEADER_BIND_DDIC_FIELD"
        If you cannot solve the problem yourself and want to send an error
        notification to SAP, include the following information:
        1. The description of the current problem (short dump)
           To save the description, choose "System->List->Save->Local File
        (Unconverted)".
        2. Corresponding system log
           Display the system log by calling transaction SM21.
           Restrict the time interval to 10 minutes before and five minutes
        after the short dump. Then choose "System->List->Save->Local File
        (Unconverted)".
        3. If the problem occurs in a problem of your own or a modified SAP
        program: The source code of the program
           In the editor, choose "Utilities->More
        Utilities->Upload/Download->Download".
        4. Details about the conditions under which the error occurred or which
        actions and input led to the error.
    The exception must either be prevented, caught within proedure
    "IF_SALV_BS_MODEL_COLUMN~GET_HEADER_BIND_DDIC_FIELD" "(METHOD)", or its
      possible occurrence must be declared in the
    RAISING clause of the procedure.
    To prevent the exception, note the following:
    Information on where terminated
        Termination occurred in the ABAP program "CL_SALV_WD_A_MODEL_TABLE======CP" -
         in "IF_SALV_BS_MODEL_COLUMN~GET_HEADER_BIND_DDIC_FIELD".
        The main program was "SAPMHTTP ".
        In the source code you have the termination point in line 19
        of the (Include) program "CL_SALV_WD_A_MODEL_TABLE======CM030".
        The termination is caused because exception "CX_SY_REF_IS_INITIAL" occurred in
        procedure "IF_SALV_BS_MODEL_COLUMN~GET_HEADER_BIND_DDIC_FIELD" "(METHOD)", but
         it was neither handled locally nor declared
        in the RAISING clause of its signature.
        The procedure is in program "CL_SALV_WD_A_MODEL_TABLE======CP "; its source
         code begins in line
        1 of the (Include program "CL_SALV_WD_A_MODEL_TABLE======CM030 ".
    Source Code Extract
    Line  SourceCde
        1 method if_salv_bs_model_column~get_header_bind_ddic_field.
        2
        3   data:
        4     ls_column type if_salv_bs_model_columns=>s_type_column.
        5
        6   ls_column = me->if_salv_bs_model_columns~get_column( column ).
        7
        8 *... get column
        9   data:
       10     lr_column type ref to cl_salv_wd_column.
       11
       12   lr_column ?= ls_column-r_column.
       13
       14   data:
       15     lr_header type ref to cl_salv_wd_column_header.
       16
       17   lr_header = lr_column->get_header( ).
       18
    >>>>>   value = lr_header->get_ddic_binding_field( ).
       20
       21 endmethod.
    i hope anybody can help me.
    Regards
    Chris

    Dear
    How you resolved this issue please let us know.
    Thanks

  • 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 in ALV export to Excel (Local File)

    Hi guys,
    I'm using the option export data do local file, option excel, but some strange behave is happening...
    Some columns are exported without the last digit...
    Ideas?
    Regards,
    LMS

    Hi LMS,
    Use this link.
    Export to excel in ALV
    Problem with Export to Excel from ALV Grid
    Hope this will help you to resolve your problem.
    Regards,
    Vijay

  • 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

  • Header of ALV with space when exported to excel using Standard ALV

    Hi,
    I am Using Reuse alv grid display    to dispaly my report and it works fine and I am using the standard SAP application tool to export it to excel.
    But for some of the header fields I am getting space in the excel sheet but there is no space while displaying through ALV.
    I am using the following field catalog for the same.
    wa_fieldcat-col_pos = 10.
      wa_fieldcat-fieldname = 'SOLLWERT'.
      wa_fieldcat-seltext_l  = 'text-t10'.      "Target value (* this has no space here)
      wa_fieldcat-outputlen = 32.
    wa_fieldcat-colwidth_optimize = 'X'.
      APPEND wa_fieldcat to it_fieldcat.
    but there are still space for this Colomn when exported to excel if after optimizing the column.
    kindly suggest what field needs to be passed to the field catalogoe to avoid spaces in excel for the header.
    Thanks
    Ritesh

    hey all,
    Thanks everyone for the reply.
    I am using the foloowing field cat:
    l_col_pos = l_col_pos + 1.
        wa_fieldcat-col_pos = l_col_pos.
        wa_fieldcat-outputlen = 32.            
         wa_fieldcat-fieldname = 'SOLLWERT'.
         wa_fieldcat-inttype   = 'P'.             
    *    wa_fieldcat-tabname = 'i_final'.      
        wa_fieldcat-seltext_l = text-t11.         "Target Value
        APPEND wa_fieldcat TO i_fieldcat.
        CLEAR wa_fieldcat.
    I have use this also in the field cat but stil i get space in the excel header.
    wa_fieldcat-REF_FIELDNAME = 'SOLLWERT'.
    *    wa_fieldcat-REF_TABNAME =  'QAMV'.
    Also the space comes with the descrip[tion in the cell of excel.
    its like [space Target Value] and i dont need this Space.
    I have also used  wa_layout-colwidth_optimize = 'X'. but it doesnt wrk.
    Please suggest

  • ALV List export to Excel when program is run in background

    Hello,
    I am running into an issue with a custom ALV report which contains an export to Excel option on the input screen. However, when I attempt to run the report in background due to high volume of records/expected performance constraints, the job fails to produce a spool when the "export to Excel" option is selected. When I deselect that option, the background job successfully generates a spool, which I can then export to Excel (albeit the formatting will not look the same).
    Is the above an accurate statement or does anyone know of a way where either;
    1) The background job can create and store the Excel output into a cached directory?
    2) The spool generated, when exported to Excel, can match the format of the foreground Excel output?
    Thanks in advancce.

    Check out the sample program of the provided link ..
    http://www.sap-img.com/abap/download-in-background-in-excel-format.htm

  • 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

  • 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 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.

  • ALV grid export to Excel 2003-f.01

    Hi all,
    I have an issue with ALV grid export to excel 2003 ,when i tried to download with the option as local file > xls file ,the report downloads with page breaks which the user does not want , each break comeswith header .
    With the option of list>export>xml sheet - the report downloads with out page break but with no header information like the name of the report and reporting period .The tcode is f.01 and the system is ECC6.
    Can any one suggest  how to download the report with tiltle of the report with no page break ?
    Thanks
    ske

    Hi
    What happens if you use the export/local file option - does that help at all or can you change the layout? Haven't got access to your release to check.
    Cheers
    David
    Edited by: David Berry on Oct 28, 2010 9:38 PM

Maybe you are looking for