Pass header from alv to excel

hi,
can any one explain me how to pass header from my alv report when i wish to download it to excel.
but the problem here is the header of my alv report comes form a table in to which more fields can be added in future.now the table contains 10 fields in future fields may grow up to n.
pls help with good solution i am using gui download to pass data to excel but only body of the report is downloaded.
thnks
vamsi

Sample Code -
  CALL FUNCTION 'ALV_XXL_CALL'
       EXPORTING
            i_tabname           = 'T_GRID'    " Name of the Internal table
            it_fieldcat         = t_fcatk[]       " Field catalog
       TABLES
            it_outtab           = t_grid           " Interbnal table with data
       EXCEPTIONS
            fatal_error         = 1
            no_display_possible = 2
            OTHERS              = 3.
  IF sy-subrc <> 0.
    MESSAGE e806(bk).
  ENDIF.
It opens the excel and passes the data directly. All you need to do is to pass your ALV's field catalog here. Just transfer your field catalog in the form of KKBLO_T_FIELDCAT. Thats it.

Similar Messages

  • Heading from ALV to EXCEL

    i have an ALV report, when i make export to excel i want to get in the first line of excel the <b>name of the transaction and date</b>, how i make this

    Hi,
    In the TOP_OF_PAGE event display the name of the transaction and date..
    And when you export to excel you will get it..
    Thanks,
    Naren

  • Header of alv to excel

    hi,
    can any one explain me how to pass header from my alv report when i wish to download it to excel.
    but the problem here is the header of my alv report comes form a table in to which more fields can be added in future.now the table contains 10 fields in future fields may grow up to n.
    pls help with good solution i am using gui download to pass data to excel but only body of the report is downloaded.
    thnks
    vamsi

    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

  • 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

  • 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

  • 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

  • Problrn when downloas from ALV to excel

    Hi All.
    I am trying to download data from ALV to excel file, but only last pages are downloaded and not from frist pages?
    Can anyone tell me wht it is happening and what is the solution?
    Thanks.

    Hi PKB,
    My initial analysis of your query is as follows.
    You can test the same by debugging the report after pressing the send to excel report.  See the internal table is gettting deleted anywhere in between.  If yes analyse it is happening and correct it if possible.
    Let me know if any further help is required by providing further details.
    Regards,
    Gowri

  • 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

  • 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

  • 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

  • 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

  • One field is not downloading properly from ALV to EXCEL

    Hi,
    while downloading ALV out put to EXCEL sheet one field(CSTCTR) is not displaying properly it's truncating left and right side digits,
    I have used function REUE_ALV_GRID_DISPLAY
    FORM SUMMARY_REPORT .
      PERFORM BUILD_FIELDCATLOG.
      IF I_FINAL[] IS INITIAL.
        MESSAGE I000 WITH 'NO DATA EXIST'.
        EXIT.
      ENDIF.
      ST_SETTINGS-EDT_CLL_CB = 'X'.
      V_REPID = SY-REPID.
      SORT I_FINAL BY WERKS GEBNR PERNR.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM       = V_REPID
                I_GRID_SETTINGS          = ST_SETTINGS
               I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
               I_CALLBACK_PF_STATUS_SET = 'SET_PF_STATUS'
                IT_SORT                 = IT_SORT[]
                IT_FIELDCAT              = IT_FLDCAT[]
                IT_EVENTS                = IT_EVENTS[]
           TABLES
                T_OUTTAB                 = I_FINAL[]
           EXCEPTIONS
                PROGRAM_ERROR            = 1
                OTHERS                   = 2.
    ENDFORM.           " alv_display  summary_report
    *&      Form  build_fieldcatlog
          text
    FORM BUILD_FIELDCATLOG.
    WA_FLDCAT-FIELDNAME = 'WERKS'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'PA'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '1'.
      WA_FLDCAT-KEY     = 'X'.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'GEBNR'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'LOC'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '2'.
      WA_FLDCAT-KEY     = 'X'.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'PERNR'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'SAP #'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '3'.
      WA_FLDCAT-KEY     = 'X'.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'ADPFN'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'ADP #'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '4'.
      WA_FLDCAT-KEY     = 'X'.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'PERID'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'SSN'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '5'.
      WA_FLDCAT-KEY     = 'X'.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'KOSTL'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'CSTCTR'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '6'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'NACHN'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'LAST NAME'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '7'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'VORNA'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'FORST NAME'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '8'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'HIREDATE'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'HAL DATE'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '9'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'VACDATE'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'VAC DATE'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '10'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'GBDAT'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'BIRTHDT'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '11'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'SENDAT'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'SRDATE'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '12'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'SERADJDAT'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'SVCADJDT'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '13'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'TERMDATE'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'TERMDT'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '14'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'MGTXT'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'TERM REASON'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '15'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'GESCH'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = '***'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '16'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'RACKY'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'RACE'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '17'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'VTEXT'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'VET STAT'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '18'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'EXPAT'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'EXPAT'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '19'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'DISAB'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'DISAB'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '20'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'PTEXT'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'STAT'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '21'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'STELL'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'JOB'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '22'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'STLTX'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'JOB TITLE'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '23'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'PLANS'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'POSITION'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '24'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'PLSTX'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'POSITION T'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '25'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'AAPCT'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'JOBGP'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '26'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'EEOCT'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'EEO'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '27'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'ZBAND'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'BAND'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '28'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'EEOEX'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'FLSA'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '29'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
    *WHEN DIVG
      WA_FLDCAT-FIELDNAME = 'BETRG'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'BW/HR'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '30'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'ANSAL'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'ANNSAL'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '31'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'WOSTD'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'HRS'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '32'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'ZBONPLAN'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'PLAN'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '33'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
      WA_FLDCAT-FIELDNAME = 'ZTARGET'.
      WA_FLDCAT-OUTPUTLEN   = '10'.
      WA_FLDCAT-SELTEXT_M = 'TGT'.
      WA_FLDCAT-TABNAME = 'I_FINAL'.
      WA_FLDCAT-COL_POS = '34'.
      WA_FLDCAT-KEY     = ' '.
      APPEND WA_FLDCAT TO IT_FLDCAT.
      CLEAR   WA_FLDCAT.
    ENDFORM.                    " BUILD_FIELD CATLOG

    Also make sure if the reference field name and reference table name in the field cat .
    There will be some fields where in when dropped to excel will not hold the field properties and may not download properly,In such cases pass the reference fileds to the field cat .
    In the field cat u r using,  pass this and check .
    WA_FLDCAT-FIELDNAME = ' '. "
    WA_FLDCAT-OUTPUTLEN = 'XX'.
    WA_FLDCAT-SELTEXT_M = 'XXXXXXXXXXXXXXXXXXx'.
    WA_FLDCAT-TABNAME = 'I_FINAL'.
    wa_fldcat- -
    >reference field name,   
    wa_fldcat----
    >reference table name
    WA_FLDCAT-COL_POS = '25'.
    WA_FLDCAT-KEY = ' '.
    APPEND WA_FLDCAT TO IT_FLDCAT.
    CLEAR WA_FLDCAT.
    Br,
    Vijay.

  • Download from alv to excel in background

    Hi All,
    I have developed one alv report which has 100 column(more than 1023 character in header).
    When I download in excel it is not comming properly so I go to LIST-EXPORT-SPREADSHEET then
    it comes in MHTML format then I can open it in to excel so its comes perfect.
    Now what my query is--- when I execute in background then there is no option for MHTML format.
    so in this case the report not come properly in excel. Please give the solution.
    Thanks,
    Rakesh

    Hi,
    Try using File Handling Concept ..Open Dataset (the file will be downloaded in application server)  .. and schedule a background job
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3c8c358411d1829f0000e829fbfe/content.htm
    Regards,
    Rajashiva R

  • Display of leading zeroes when downloaded from ALV to excel

    Hi All,
    I have a problem in ALV grid display.
    There is a specific field which has value starting from '001' to '999'. This is a char(3) type of variable.
    The problem is that the display shows the value as '001' which is correct. but when the same file is dwnloaded to excel using standard SAP functionality, the value of the field gets changed to '1' instead of '001'.
    Is there any option by which this can be controlled. Please let me know, its urgent!!
    thanks

    hi Ankur,
    the Excel download is done by Z program? IF yes you have to do:
       SET PROPERTY OF go_cell 'NumberFormat' = '@'.
    this will set the Excel cell to Text type and leading zeros won't be lost.
    ec

  • Reg : export data from ALV to excel file

    Hi All,
    I am using REUSE_ALV_GRID_DISPLAY to display the output. I have total 73 columns getting displayed in output but when i export the data to the excel file using (ctrlshiftF9) I am getting only first 43 columns in the first row and from 44th column on wards the data is populated in the 1st  column of second row.
    Please let me know is there any particular setting by which I can get all the 73 columns in a single row.
    Thanks in advance.
    VIJAY

    Hi vijay,
    You can try setting your line width to 255 in your abap program.
    Otherwise,  you can try an alternative:
    1. Put a customize button on the ALV toolbar.
    2. Go to se41 to create th buttons
    2. do i_callback_program in ALV function. or SET PF_STATUS
    3. Then in sy-ucomm, use 'GUI_DOWNLOAD' to xls.
    Hope this helps you.
    Thanks
    William Wilstroth
    Edited by: william wilstroth on Dec 18, 2007 5:06 PM

Maybe you are looking for

  • Many Delivery Notes / One Invoice

    Hi all, We are a business that sends out many truckloads of product, and need to send a separate delivery note with each truck, but we want to send the client only one invoice for this. At the moment the system produces multiple invoices. What is the

  • My Macbook Pro 13" lost Internet connection last night. Why?

    My Macbook Pro 13" lost Internet connection last night. It's still out today, but my mother's Windows machine still gets it just fine. What happened to my Mac? The folks at Comcast told me it's a problem for Apple to fix. I'm hoping someone here can

  • Can't Import iPhoto Library

    I have had Aperture for a while and decided I would intall it and try to import my iPhoto Library. I just had to move the library/photos (referenced) to another hard drive because of size. I had all kinds of alias errors after the move that I was abl

  • Can I sync my iMac and MBP in word processing?

    Is it possible to sync an iMac and MBP when doing word processing? If so, how can it be done? I know there are programs that can sync iCal bewteen the two such as BusyMac. Is there one that do the same thing with a word processor? Thanks.

  • Custom Tag Problems

    Hello Everyone, I am using iPlanet 4.1 as my web server and am having some problems with using custom tags. I try to access a jsp that uses my custom tags and I get a 500 Internal Server error. Then when I check the web server logs all it has is this