ALV to Excel problem

Good day,
I have a question on downloading the excel file from ALV list. ALV generates the correct output. However, when I download it to excel, the value is not populating correctly.
The field MATNR when displayed in ALV is 100000000000000001, 100000000000000002.
Output in excel is 100000000000000000, 100000000000000000.
Here is my code:
wa_fldcat-fieldname     = 'MATNR'.
  wa_fldcat-ref_tabname   = 'MARA'.
  wa_fldcat-ref_fieldname = 'MATNR'.
  APPEND wa_fldcat TO lt_fldcat.
  CLEAR  wa_fldcat.
  CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
   EXPORTING
*   I_INTERFACE_CHECK              = ' '
*   I_BYPASSING_BUFFER             =
*   I_BUFFER_ACTIVE                = ' '
*   I_CALLBACK_PROGRAM             = SY-REPID
*   I_CALLBACK_PF_STATUS_SET       = ' '
*   I_CALLBACK_USER_COMMAND        = ' '
*   I_STRUCTURE_NAME               =
     is_layout                      = lt_layout
     it_fieldcat                    = lt_fldcat
*   IT_EXCLUDING                   =
*   IT_SPECIAL_GROUPS              =
*   IT_SORT                        =
*   IT_FILTER                      =
*   IS_SEL_HIDE                    =
*   I_DEFAULT                      = 'X'
*   I_SAVE                         = ' '
*   IS_VARIANT                     =
*   IT_EVENTS                      =
*   IT_EVENT_EXIT                  =
*   IS_PRINT                       =
*   IS_REPREP_ID                   =
*   I_SCREEN_START_COLUMN          = 0
*   I_SCREEN_START_LINE            = 0
*   I_SCREEN_END_COLUMN            = 0
*   I_SCREEN_END_LINE              = 0
*   IR_SALV_LIST_ADAPTER           =
*   IT_EXCEPT_QINFO                =
*   I_SUPPRESS_EMPTY_DATA          = ABAP_FALSE
* IMPORTING
*   E_EXIT_CAUSED_BY_CALLER        =
*   ES_EXIT_CAUSED_BY_USER         =
    TABLES
      t_outtab                       = it_data
   EXCEPTIONS
     program_error                  = 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.
Can someone enlighten me on why my excel file is generating such values? What should I do to get the correct values?
Thanks so much.

see the following example:
REPORT z_down_xml LINE-SIZE 132 NO STANDARD PAGE HEADING.
TABLES:
  makt,                                "Mat description
  marc,                                "Material / plant
  t001w,                               "plant name
  bhdgd.                               "Batch heading
Internal tables
DATA:
  BEGIN OF gt_marc OCCURS 0,
    werks LIKE marc-werks,
    matnr LIKE marc-matnr,
  END OF gt_marc,
Table to be downloaded as xml. Each line stores start and end tags
and the value
  BEGIN OF gt_xml OCCURS 0,
    line(120),
  END OF gt_xml,
  g_maktx(120).
User-input
SELECT-OPTIONS:
  s_werks FOR marc-werks,
  s_matnr FOR marc-matnr.
START-OF-SELECTION.
Extract all required data
  PERFORM main_processing.
END-OF-SELECTION.
  SORT gt_marc BY werks matnr.
  LOOP AT gt_marc.
    AT FIRST.                          "First tag must be root
      CLEAR gt_xml.
      gt_xml-line = ''.
    APPEND gt_xml.
    CLEAR gt_xml.
display data
    FORMAT COLOR 2 ON.
    WRITE :/ gt_marc-matnr, makt-maktx.
    FORMAT COLOR 2 OFF.
  ENDLOOP.
The last tag must be the root closing tag --*
  gt_xml-line = '</LOCATIONS>'.
  APPEND gt_xml.
  CLEAR gt_xml.
  CALL FUNCTION 'DOWNLOAD'
       EXPORTING
            filename = 'C:PLANT1.XML'
            filetype = 'ASC'
       TABLES
            data_tab = gt_xml.
TOP-OF-PAGE.
  MOVE sy-title TO bhdgd-line1.
  MOVE sy-repid TO bhdgd-repid.
  MOVE sy-uname TO bhdgd-uname.
  MOVE sy-datum TO bhdgd-datum.
  MOVE '0' TO bhdgd-inifl.
  MOVE '132' TO bhdgd-lines.
  FORMAT INTENSIFIED ON COLOR COL_HEADING.
  PERFORM batch-heading(rsbtchh0).     "report header
Form READ_PLANT
FORM read_plant.
Get plant name
  CLEAR t001w.
  SELECT SINGLE name1
    INTO t001w-name1
    FROM t001w
   WHERE werks EQ gt_marc-werks.
ENDFORM.                               " READ_PLANT
Form MAIN_PROCESSING
FORM main_processing.
Material and plant basic data
  SELECT werks matnr
    INTO TABLE gt_marc
    FROM marc
   WHERE werks IN s_werks
     AND matnr IN s_matnr.
ENDFORM.                               " MAIN_PROCESSING
Form READ_DESCRIPTION
FORM read_description.
Material name
  CLEAR g_maktx.
  SELECT SINGLE maktx
    INTO g_maktx
    FROM makt
   WHERE matnr EQ gt_marc-matnr
     AND spras EQ 'E'.
Replace special character
  DO.
    REPLACE '&' WITH '*ù%;' INTO g_maktx.
    IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
  ENDDO.
  DO.
    REPLACE '*ù%;' WITH '&amp;' INTO g_maktx.
    IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
  ENDDO.
  DO.
    REPLACE '/' WITH '&#47;' INTO g_maktx.
    IF NOT sy-subrc IS INITIAL. EXIT.ENDIF.
  ENDDO.
ENDFORM.

Similar Messages

  • ALV TO EXCEL PROBLEM? ( 90 COLUMNS ALV CAN'T EXPORT TO EXCEL NORMALLY)

    HI ABAPERS,
    anyone have a alv that have over 90 columns and want to export to excel have experienced abnormal formating (like the header row show only up to 60 column and the rest show up in next row) and the data show in separate line.
    anyway can have a better format?
    also after 90 columns show up on alv, it can't show anymore except modify the layout in run time.
    can we do something before that?
    thanks & regards,
    HOWARD

    Hi HOWARD,
    My Report ouput having more than 90 columns in ALV, while downloading data from ALV to Excel sheet am facing alignment problem. (ie) the output column > 66 are appearing in next line of the excel sheet leads to improper alignment.
    Pls give me a solution as u had already come across this issue..
    Thank & Regards,
    Paramesh.

  • Export from ALV to Excel - problem with numeric values

    hi folks,
    when exporting from alv to excel and we have negative values (and using an u.s.a. setting where . and , are different to r/3) negetive values are not shown correctly in excel.
    when changing in win nt the regional settings to europe one's (e.g. germany) everything works fine.
    any hints welcome,
    kind regards
    oliver

    I guess this has something to do with the excel settings. In the control panel you have regional settings.try some options there. It might work.
    Regards
    Sudhi

  • ALV to Excel problems

    HI
         I have created an ALV report with 87 fields in it. Whenever I am trying to download that report into excel the number of column breaks into 2 rows. In this case, The downloaded file contains 57 Columns in 1 row and remaining 29 Columns in second row. Can anyone please help me in understanding why this is happening while downloading this report into excel file and what will be the solution to correct it.
    Thanks,
    Sreekanth.G

    Try this,
    HEADING FOR EXCEL SHEET
    DATA: BEGIN OF IT_EXCEL1 OCCURS 0,
            SAPID           LIKE PERNR-PERNR,
            UNAME           LIKE SY-UNAME,
          END OF IT_EXCEL1.
    assigning column names in excel sheet
      IT_EXCEL1-SAPID = 'Personnel number'.
      IT_EXCEL1-UNAME = 'User Name'.
      APPEND IT_EXCEL1.
    to get desktop path
      DATA : DESKTOP TYPE STRING.
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_DESKTOP_DIRECTORY
        CHANGING
          DESKTOP_DIRECTORY    = DESKTOP
        EXCEPTIONS
          CNTL_ERROR           = 1
          ERROR_NO_GUI         = 2
          NOT_SUPPORTED_BY_GUI = 3
          OTHERS               = 4.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL METHOD CL_GUI_CFW=>FLUSH
        EXCEPTIONS
          CNTL_SYSTEM_ERROR = 1
          CNTL_ERROR        = 2
          OTHERS            = 3.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CONCATENATE DESKTOP '\filename.xls' INTO DESKTOP.
    to download into excel sheet
    FOR TITLES
      CALL FUNCTION 'GUI_DOWNLOAD'                     " for titles
        EXPORTING
      BIN_FILESIZE                    =
          FILENAME                        = DESKTOP
         FILETYPE                        = 'ASC'
         WRITE_FIELD_SEPARATOR           = 'X'
        TABLES
          DATA_TAB                        = IT_EXCEL1.
    FOR DATA
      CALL FUNCTION 'GUI_DOWNLOAD'                     " for data
        EXPORTING
          FILENAME                        = DESKTOP
         FILETYPE                        = 'ASC'
         APPEND                          = 'X'
         WRITE_FIELD_SEPARATOR           = 'X'
        TABLES
          DATA_TAB                        = IT_DOWNLOAD.
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
        EXPORTING
          DOCUMENT               = DESKTOP
       APPLICATION            =
       PARAMETER              =
       DEFAULT_DIRECTORY      =
       MAXIMIZED              =
       MINIMIZED              =
       SYNCHRONOUS            =
          OPERATION              = 'OPEN'
    EXCEPTIONS
       CNTL_ERROR             = 1
       ERROR_NO_GUI           = 2
       BAD_PARAMETER          = 3
       FILE_NOT_FOUND         = 4
       PATH_NOT_FOUND         = 5
       FILE_EXTENSION_UNKNOWN = 6
       ERROR_EXECUTE_FAILED   = 7
       SYNCHRONOUS_FAILED     = 8
       NOT_SUPPORTED_BY_GUI   = 9
       OTHERS                 = 10
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

  • ALV download to Excel--Problem with Column Headers

    Hi,
    I have created a dynamic internal table and displaying it as ALV using SALV classes. Problem is that  when I download this ALV to Excel I'm not getting Column headings same as they are in ALV display.
    I mean in Excel it is showing Column headings taken from domain or data element.
    While creating dynamic table i'm passing short/ Medium & Long text too. Still it is not working.
    Any kinda help is appreciated.
    Thanks & Regards,
    Vivek Gaur
    Edited by: Vivek  Gaur on Nov 4, 2009 2:04 PM

    Look I cant actually post the code as it is divided in some global classes and main program. But i can elaborate the steps little further:
    1: I have created a field catalog for Dynamic internal table. In it i have passed every necessary field along with short/medium/Long texts.
    2: I fill up this dynamic table with data.
    3: I assign a field symbol to this dynamic internal table.
    4: I pass this field symbol to the factory method of CL_SALV_TABLE  Class.
    Thats it buddy..Hope u have understood my problem.

  • ALV to excel download problem through standard tool bar

    I am downloading data into excel from ALV , When there are 128 column data in execl coming as 2 row for 1 row of data in alv. This problem is not there for 78 columns report.
    Kindly suggest some solution.

    i think there is a limit to the number of columns for ALV and which is i think 92 ..this can be the cause of the issue
    amit

  • Problem in ALV to Excel Download

    Good Morning Experts,
      I am facing one issue related ALV to excel Download.
    I Developed one custom report the output is correct displaying.
    the output is like for example i am taking 3 columns (plant, material, amt).
    plant material amt
    1001  aaa     1000
    1001  bbb     2000
    while downloading to excel
    it displaying like
    plant
    material
    amt
    1001
    aaa
    1000
    1001
    bbb
    2000
    I dont know why its coming like that.
    this is my code
    DEFINE field_cat.
    wa_field-row_pos = &1.
    wa_field-fieldname = &2.
    wa_field-tabname = &3.
    wa_field-seltext_m = &4.
    wa_field-outputlen = &5.
    wa_field-currency = &6.
    wa_field-ref_fieldname = &7.
    wa_field-ref_tabname = &8.
    APPEND wa_field to it_field.
    clear wa_field.
    END-OF-DEFINITION.
    field_cat '1' 'BUKRS' 'IT_FINAL' 'Company Code' '6' '' '' ''.
    field_cat '2' 'BUTXT' 'IT_FINAL' 'Comp Descrip' '25' '' '' ''.
    field_cat '3' 'LIFNR' 'IT_FINAL' 'Vendor No' '10' '' '' ''.
    field_cat '4' 'NAME1' 'IT_FINAL' 'Vendor Name' '35' '' '' ''.
    field_cat '5' 'STRAS' 'IT_FINAL' 'Vendor Addres' '35' '' '' ''.
    field_cat '6' 'FDGRV' 'IT_FINAL' 'Nature Of Work' '30' '' '' ''.
    field_cat '7' 'DMBTR' 'IT_FINAL' 'Net Amount' '16' 'X' 'WAERS' 'IT_FINAL'.
    field_cat '8' 'QBSHB' 'IT_FINAL' 'TDS Amount' '16' 'X' 'WAERS' 'IT_FINAL'.
    field_cat '9' 'TOTAL' 'IT_FINAL' 'Total Amount' '16' 'X' 'WAERS' 'IT_FINAL'.
    it_layout-zebra = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
       I_CALLBACK_PROGRAM                = sy-repid
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
       IS_LAYOUT                         = it_layout
       IT_FIELDCAT                       = it_field
       I_SAVE                            = 'X'
      TABLES
        t_outtab                          = it_final
    EXCEPTIONS
       PROGRAM_ERROR                     = 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.
    endform.                    " DISPLAY_ALV
    FORM TOP_OF_PAGE.
    REFRESH it_head. CLEAR it_head.
    wa_head-typ = 'H'.
    wa_head-info = 'Vendorwise Expense Details'.
    APPEND wa_head to it_head.
    wa_head-typ = 'S'.
    IF NOT s_MONAT-high is INITIAL.
      CONCATENATE 'Period : ' p_gjahr '.' s_MONAT-low ' to ' p_gjahr '.' s_MONAT-high INTO wa_head-info.
    ELSE.
      CONCATENATE 'Period : ' p_gjahr '.' s_MONAT-low INTO wa_head-info.
    ENDIF.
    APPEND wa_head to it_head.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        it_list_commentary       = it_head.
    ENDFORM.
    Regards,
    Dhina..

    Hi,
    You can also try in this way
    in the output screen
      click List (in app tool bar) -> Export -> Spreadsheet
    and save at your desired location.
    (It will be save in .mhtml format , just rightclick on it and you can open it with excel )
    Then you will be able to view in your required format.
    Regards,
    koolspy.

  • Download data from ALV to excel issue

    Hi All,
    Could you please tell me if there has any restriction on ALV grid data download to excel? I've a report contains 68 columns and about 500 rows, I want to download the data using the standard menu list->export->save to local file. but after I download them, I found the first 65 columns display in one line and the rest columns display in next line, just like ALV do not allow too many characters in one row and have to switch to new line. I can hide some columns but it's very strange that even after i hide 3 columns to fit the 500 rows download, then if the rows increase, the same problem occurs.
    I searched the forum and in the thread Re: Export ALV in EXCEL Issue Mr. Suvajit provided a solution by using menu List->export->spreadsheet, it looks very good. But I still want to know how this happen and is there a standard way to download data with more than 65 columns to local file with extension .xls so that user can open it directly?
    PS: I'm using FM REUSE_ALV_GRID_DISPLAY and the SAP version is SAP ECC6 with kernal package SAPKB70103.
    Thank you very much.
    Best Regards,
    Jeff
    Edited by: Jeff_liu_2010 on Mar 10, 2011 7:21 AM

    Hi Jeff,
    Please check if following analysis is helpful to you.
    Analysis/Solution:
    When we export ALV data to excel worksheet, as sap notes say the maximum lenght allowed is 1023 charaters and the max no of columns supported is 90.
    (I never faced any issue related to no of columns as it worked fine for columns >90 too)
    Issue occured when row size of exported data gets more than 1023 character.
    Therefore the row data must not exceed 1023 character, otherwise column splits and moves to next row.
    One additional aspect generally missed is that:
    When data in any particular column changes it's length, alv header also changes its lengh (short text, medium text, long text; depending on the length of of the longest cell in the column)
    therefore even if you have total length of row less than 1023 character, there might be cases when your ALV header size exceeds this length.
    Reducing the header size (by forcing to use short text or specifying own header names) should resolve the issue.
    Regards,
    Parveen

  • The data type DEC while downloading from ALV to EXCEL

    The data type DEC while downloading from ALV to EXCEL is giving some invalid data .
    Ex : In ALV field is the time difference in  hours:minutes
      if the value is  :23 in Excel it will be 22:59 .
    Please Suggest immediately

    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

  • Exporting ALV to Excel

    Hi,
    I have a report in ALV and my problem is that the columns in Excel are in different sequence to the report if the Export->Spreadsheet route is taken.
    However, If i do it as Export->local file the columns in Excel appear in the same sequence as in report.
    Can any one explain me how to get the same sequence of columns via the Export->Spreadsheet also.
    Regards.

    instead of dat try doin dis..
    After ALV is displayed..press CtrlShiftF7
    ull b able 2 see the ALV in Spreadsheet n den u can save it..
    Hope dis helps..

  • Dump when exporting an ALV to excel at Portal

    Hi there,
    I am getting a dump ( Exception condition "CNTL_ERROR" raised) when exporting an ALV to an excel document. 
    I've done the following:
       1 - Create an ALV report at SAP R3 (with option export to excel);
       2 - Create a SAP transaction iview to show the ALV report at portal;
       3 - At portal, I am trying to export the ALV to excel.
    Isn't this correct?
    How can I get throught this problem. I really need to export this ALV to excel.
    Thanks and best regards,
    Vasco Brandã

    Hi,
    if it should not dump then it_output_alv-gehalt_eff this should be of type C. is it type char.
    and can you show the fieldcat of the field <b>gehalt_eff</b>, that might causing the problem. though you changed the type.
    Regards
    vijay

  • Download from ALV to excel sheet.

    When i am downloading the Alv to excel sheet. I want to get the field descritption also in the excel sheet.

    Refer:
    https://forums.sdn.sap.com/click.jspa?searchID=14433981&messageID=3603627

  • REUSE_ALV_GRID_DISPLAY (column headings from ALV to EXCEL) Max please help

    Hi Max,
    If you remember in one of my last post I asked for changing the column headings in ALV display for example from 'Material' to 'Material used'.
    I am using
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
          I_CALLBACK_PROGRAM                = repid
          IT_FIELDCAT                       = field_body
          I_SAVE                            = g_save
          IS_VARIANT                        = g_variant
          IT_EVENTS                         = events
        TABLES
          T_OUTTAB                          = itab.
    And you suggested me the following way....
    loop at field_body into field_wa.
    case field_wa-fieldname.
      when 'Material'.
         field_wa-seltext_l = 'Material used'.
         field_wa-seltext_m = 'Material used'.
         field_wa-seltext_s = 'Material used'.
    endcase.
    modify field_body from field_wa.
    endloop.
    It is working well. In ALV display the column heading is changed to what I wanted. But the question is when I export the displayed ALV to Excel using ALV functionality, Export->Spreadsheet... I see that <b>I dont get the Column Heading into Excel as it was in the ALV display.</b>
    I get in the Excel as 'Material u' or 'Mat. Used'. But when I add this line in the code.....
    when 'Material'.
         field_wa-seltext_l = 'Material used'.
         field_wa-seltext_m = 'Material used'.
         field_wa-seltext_s = 'Material used'.
        <b> field_wa-outputlen = 20.</b>
    Then I see that I get the complete heading in the Excel. But this way the columns with outputlen 20 are taking much space in ALV display.
    Is there any fix for this. May be not mentioning the outputlen but still get the column headings into Excel as it was in ALV display.
    Anyone with ideas please respond. Waiting for replies. Thanks

    Hi
    The labels have a fixed size:
    seltext_l is long   text: 20 char
    seltext_m is medium text: 15 char
    seltext_s is short  text: 10 char
    The text 'Material used' is long 13 char so you should write:
    field_wa-seltext_l = 'Material used'.
    field_wa-seltext_m = 'Material used'.
    field_wa-seltext_s = 'Mat. used'.
    You can try to set the field colwidth_optimize of parameter IT_LAYOUT.
    This field should optimize the width of the colunm
    So
    data layout type SLIS_LAYOUT_ALV.
    layout-colwidth_optimize = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = repid
    IT_LAYOUT   = layout       
    IT_FIELDCAT = field_body
    I_SAVE = g_save
    IS_VARIANT = g_variant
    IT_EVENTS = events
    TABLES
    T_OUTTAB = itab.
    and you can decide which label has to be used:
    field_wa-seltext_l = 'Material used'.
    field_wa-seltext_m = 'Material used'.
    field_wa-seltext_s = 'Mat. used'.
    If you want to set the short text
    field_wa-ddictxt   = 'S'.
    ...medium
    field_wa-ddictxt   = 'M'.
    ...long
    field_wa-ddictxt   = 'L'.
    Max

  • ALV TO EXCEL Using 'ALV_XXL_CALL'

    Hi,
    This is very urgent. you will reward points.
    We are trying to convert ALV TO EXCEL using this FM 'ALV_XXL_CALL'
    we are getting' Type conflict Error'.
      i_fieldcat TYPE slis_t_fieldcat_alv. " Field catalog
    w_fieldcat TYPE slis_fieldcat_alv.
    Column 1
      w_fieldcat-col_pos = v_pos.
      w_fieldcat-row_pos = 1.
      w_fieldcat-tabname = 'I_OUTPUT'.
      w_fieldcat-fieldname = c_deptno.    "Dept code
      w_fieldcat-seltext_l = 'Afdeling'(001).
      w_fieldcat-just = c_just.
      w_fieldcat-fix_column = 'X'.
      APPEND w_fieldcat TO i_fieldcat.
      CLEAR  w_fieldcat.
    Column 2
      v_pos = v_pos + 1.
      w_fieldcat-col_pos = v_pos.
        w_fieldcat-row_pos = 1.
      w_fieldcat-tabname = 'I_OUTPUT'.
      w_fieldcat-fieldname = c_deptname.    "Dept name
      w_fieldcat-seltext_l = 'Naam afdeling'(002).
      w_fieldcat-just = c_just.
      w_fieldcat-fix_column = 'X'.
      APPEND w_fieldcat TO i_fieldcat.
      CLEAR  w_fieldcat.
    CALL FUNCTION 'ALV_XXL_CALL'
      EXPORTING
        i_tabname                    = 'I_OUTPUT'
        it_fieldcat                  = i_fieldcat[]
      tables
        it_outtab                    = i_output[]
    EXCEPTIONS
       FATAL_ERROR                  = 1
       NO_DISPLAY_POSSIBLE          = 2
       OTHERS                       = 3
    please let me know row pos & col pos is correct to convert Excel and also what is field in field catalog for  columm heading in Excel sheet?  Give me some sample code.

    hi,
    check your fieldname parameter in fieldcat. pass it in caps btween ''
    check my example program
    REPORT ZSKC_ALV_XXL.
    TYPE-POOLS : KKBLO.
    DATA : ITAB LIKE T100 OCCURS 0,
    T_FCAT_LVC TYPE LVC_S_FCAT OCCURS 0 WITH HEADER LINE,
    T_FCAT_KKB TYPE KKBLO_T_FIELDCAT.
    START-OF-SELECTION.
    Get data.
    SELECT * UP TO 20 ROWS
    FROM T100
    INTO TABLE ITAB
    WHERE SPRSL = SY-LANGU.
    CHECK SY-SUBRC EQ 0.
    Create the field catalog.
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
    I_STRUCTURE_NAME = 'T100'
    CHANGING
    CT_FIELDCAT = T_FCAT_LVC[]
    EXCEPTIONS
    INCONSISTENT_INTERFACE = 1
    PROGRAM_ERROR = 2
    OTHERS = 3.
    CHECK SY-SUBRC EQ 0.
    make sure you pass the correct internal table name in the field catalog.
    t_fcat_lvC-tabname = 'ITAB'.
    MODIFY T_FCAT_LVC TRANSPORTING TABNAME WHERE TABNAME NE SPACE.
    Transfer to KKBLO format.
    CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'
    EXPORTING
    IT_FIELDCAT_LVC = T_FCAT_LVC[]
    IMPORTING
    ET_FIELDCAT_KKBLO = T_FCAT_KKB
    EXCEPTIONS
    IT_DATA_MISSING = 1
    IT_FIELDCAT_LVC_MISSING = 2
    OTHERS = 3.
    CHECK SY-SUBRC EQ 0.
    Call XXL.
    CALL FUNCTION 'ALV_XXL_CALL'
    EXPORTING
    I_TABNAME = 'ITAB'
    IT_FIELDCAT = T_FCAT_KKB
    TABLES
    IT_OUTTAB = ITAB[]
    EXCEPTIONS
    FATAL_ERROR = 1
    NO_DISPLAY_POSSIBLE = 2
    OTHERS = 3.
    IF SY-SUBRC 0.
    ENDIF.
    regards
    prasanth

  • Download ICONS from ALV to EXCEL

    Dear Friends,
    IS there a way of downloading the ICON image exactly
    from alv to EXCEL,right now,when the icon is downloaded
    from alv to the excel,i can only see ascii characters in
    the icon column in the excel.
    kind regards
    kaushik hegde

    Hi Jeff,
    Please check if following analysis is helpful to you.
    Analysis/Solution:
    When we export ALV data to excel worksheet, as sap notes say the maximum lenght allowed is 1023 charaters and the max no of columns supported is 90.
    (I never faced any issue related to no of columns as it worked fine for columns >90 too)
    Issue occured when row size of exported data gets more than 1023 character.
    Therefore the row data must not exceed 1023 character, otherwise column splits and moves to next row.
    One additional aspect generally missed is that:
    When data in any particular column changes it's length, alv header also changes its lengh (short text, medium text, long text; depending on the length of of the longest cell in the column)
    therefore even if you have total length of row less than 1023 character, there might be cases when your ALV header size exceeds this length.
    Reducing the header size (by forcing to use short text or specifying own header names) should resolve the issue.
    Regards,
    Parveen

Maybe you are looking for