Download to excel from alv display

Hi,
How to download to excel from alv display.I am using object oriented abap for using alv.If i click export->spreadsheet i am getting fatal error and if i export->local file->spreadsheet i am getting only the column names and heading but no contents.Can anyone tell me how to overcome this problem.
Regards,
Sowmya.

Hi Sowmya,
Just put break point near FM reuse_alv_grid_display and check if internal table which is used to display output is popullated or not.
Regards Sachin.

Similar Messages

  • Issue with Data download to excel from ALV

    Hi,
    I am trying to download data to excel from ALV.
    The number of records are 26000.
    When I am trying to download I am getting an error displaying a pop up saying that
    problems came up in the following areas during the load
    TABLE
    The log displayed is not clear.
    I need to know the limitations while downloading to excel... I tried in SDN but of no use. I am using office 2007.
    What is the max downloading limit(MB)
    What must be the Length of line that can be downloaded.
    Regards

    Hi ,
    First check whether your ALV grid OUTPUT   is Consistent or Not   .
    if there are any inconsistency  then you need to rectify that  .
    for Checking COnsistency / Inconsistency  .do following steps
    1) execute ALV report 
    2) Press Shift+Mouse Right Button (Twice)  in blank area of report 
    3) you will get result   whether ALV is good or not .
    regards
    Deepak.

  • Taking download into excel from ALV Grid - header is printing in two lines

    Hi All,
    I have a scenario where I am taking the download from ALV grid to an excel sheet. Now the header of the ALV (column names) is appearing in two lines in the downloaded excel sheet while items (records of the ALV table) are getting displayed in a single line.
    This download is taken from the standard download to local file (spreadsheet) button provided by SAP for ALVs.
    I am using function module "Reuse_alv_grid_display" for the purpose.
    Can somebody provide an idea how I can avoid the header printing in two lines and keep the length as it is.
    Thanks in Advance,
    Chandan

    Hi..
    1. Pass header name in internal table appned first line.
    2. after that pass u r data .
    3. Use  FM. WS_DOWNLOAD 
    Salil ......
    Edited by: salil chavan on Nov 26, 2008 11:07 AM

  • Why is the spreadsheet empty when users download to Excel from ALV grid?

    Users are seeing SAP GUI transaction results display in the ALV Grid when running an SAP Report; however, when they click the Download to Excel icon the spreadsheet is empty.  When they use List...Export...Spreadsheet, the spreadsheet is filled.
    This seems to only be happening with 'Z' transactions.  Standard delivered transactions are OK.
    Using SAP GUI for Windows and Excel 2003.

    Hi All,
    I also have same Problem I my case when i click on 'Microsoft Excel' it does nothing. It does not even open a sheet.
    Please suggest,
    regards,
    Vinit

  • PO No is not coming complete in length while downloading in excel from ALV

    Hi to all
    My problem is
    I have declared
    EBELN LIKE EBAN-EBELN.
    length is 10.
    Now in ALV report it is showing complete PO no but
    when downloading itto excel , last digit is cut, only 9 digits are displayed.
    Why it is so.
    Please guide me...
    Thanks & regards
    Anubhav

    Hi
    Please try to declre the field EBELN as character of length 10 in the internal table for ALV.
    EBELN type char(10)
    <REMOVED BY MODERATOR>
    Thanks
    Edited by: Alvaro Tejada Galindo on Feb 22, 2008 6:00 PM

  • Download to excel from ALV via portal

    HI,
    Could anyone out there help me resolve one issue which I am facing.
    We have developed a ALV report and the same is working fine in GUI screen and also the various ALV features such as Download to Local File, Print Preview and others are working very well.
    But if I deploy the same report on EP. The report is executing just fine but all the ALV features such as download to excel file and all other features are not working as desired.
    I have done some reasearch on this issue and everytime people talk about having the updated Java version and to run this features on IE 7 or below. We have tried all these but still no luck.
    Request you to provide your valuable inputs which can help me resolve this issue.
    Thanks much!
    Regards,
    Sumanth

    Hi,
    I guess this is due to the gui statements like call screen for popup to download which will not work in browser, instead of using FM for ALV or CL_GUI_ALV_GRID class, try using CL_SALV CLasses or create ALV in Web dynpro and integrate it in portal which will work well.
    Hope this helps u.,
    Thanks & Regards,
    Kiran.

  • Download to excel from alv grid

    I developed a alv report and I have one percentage field(say PER) in the grid.When I sum on that field PER then it comes in my formula basis.Suppose If I have 5 line items and all PER field have a value 2 then when I sum in PER column then it come 7 inseted of 10 becoze of my formula basis and it comes perfect.But my query is when I download to excel then it comes real value 10 insted of 7. here my formula basis sum which is 7 for all 5 line items is not comming. Can any body help me how will it come?
    Thanks,
    Rakesh

    Hi
    try this code----
    *&      Form  DOWNLOAD_EXCEL_TEMPLATE
          text
    -->  p1        text
    <--  p2        text
    FORM download_excel_template .
      TYPES: BEGIN OF lt_data,
                field1(20),
                field2(30),
                field3(20),
                field4(20),
                field5(20),
                field6(30),
                field7(15),
                field8(10),
                field9(10),
                field10(20),
                field11(20),
                field12(10),
                field13(20),
                field14(20),
              END OF lt_data.
      DATA: lv_file TYPE rlgrap-filename,
            li_data TYPE STANDARD TABLE OF lt_data,
            wa_data TYPE lt_data,
            lv_pathcheck type c,
            lv_file1 type string.
      wa_data-field1 = ''.
      APPEND wa_data TO li_data.
      REFRESH gi_header.
      wa_header-name = 'Company Code'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Main Asset Number'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Asset Sub Number'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Document Date'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Posting Date'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Asset Value Date'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Item Text'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Reference'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Allocation'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Amount Posted'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Percentage Rate'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Quantity'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Prior-Yr Quantity'.
      APPEND wa_header TO gi_header.
      wa_header-name = 'Curr-Yr Quantity'.
      APPEND wa_header TO gi_header.
      lv_file = gv_file.
      lv_file1 = gv_file.
      CALL METHOD cl_gui_frontend_services=>directory_exist
        EXPORTING
          directory            = lv_file1
        RECEIVING
          result               = lv_pathcheck
        EXCEPTIONS
          cntl_error           = 1
          error_no_gui         = 2
          wrong_parameter      = 3
          not_supported_by_gui = 4
          OTHERS               = 5.
       FIND '.xls' IN lv_file IGNORING CASE.
      IF sy-subrc = 0.
        REPLACE '.XLS' IN lv_file WITH ' ' IGNORING CASE.
      ENDIF.
      FIND '.TXT' IN lv_file IGNORING CASE.
      IF sy-subrc = 0.
        REPLACE '.TXT' IN lv_file WITH ' ' IGNORING CASE.
      ENDIF.
      CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
        EXPORTING
          file_name                 = lv_file
          data_sheet_name           = 'DATA'
        TABLES
          data_tab                  = li_data
          fieldnames                = gi_header
        EXCEPTIONS
          file_not_exist            = 1
          filename_expected         = 2
          communication_error       = 3
          ole_object_method_error   = 4
          ole_object_property_error = 5
          invalid_pivot_fields      = 6
          download_problem          = 7
          OTHERS                    = 8.
      IF sy-subrc <> 0.
        MESSAGE ID gv_msgid TYPE 'E' NUMBER 002.
      ENDIF.
    ENDFORM.                    " DOWNLOAD_EXCEL_TEMPLATE
    regards,
    Prashant

  • Last digit truncates while downloading to Excel from ALV Grid

    Hi All,
    I have been using REUSE_ALV_LIST_DISPLAY and REUSE_ALV_GRID_DISPLAY in my report program.
    While i use REUSE_ALV_GRID_DISPLAY and downloading the data to a local file(Excel) the last digit of the Vendor code is truncated. But in REUSE_ALV_LIST_DISPLAY the datas are downloaded correctly as displayed in the ALV.
    I have copied the code for the reference.
    REPORT  zfirp001                                .
    TYPE-POOLS: slis.
    TABLES: bsak.
    SELECT-OPTIONS:  s_bukrs FOR bsak-bukrs,
                     s_lifnr FOR bsak-lifnr,
                     s_blart FOR bsak-blart,
                     s_augdt FOR bsak-augdt,
                     s_zterm FOR bsak-zterm.
    PARAMETERS:      s_list AS CHECKBOX,
                     s_vari LIKE disvariant-variant.
    DATA: g_ext_num(24) TYPE c.
    DATA: BEGIN OF gt_bsak OCCURS 0,
            bukrs LIKE bsak-bukrs,
            lifnr LIKE bsak-lifnr,
            augdt LIKE bsak-augdt,
            gjahr LIKE bsak-gjahr,
            belnr LIKE bsak-belnr,
            blart LIKE bsak-blart,
            zterm LIKE bsak-zterm,
          END OF gt_bsak.
    DATA: BEGIN OF gt_bseg OCCURS 0,
            bukrs LIKE bseg-bukrs,
            belnr LIKE bseg-belnr,
            gjahr LIKE bseg-gjahr,
            wrbtr LIKE bseg-wrbtr,
            projk LIKE bseg-projk,
            shkzg LIKE bseg-shkzg,
            hkont LIKE bseg-hkont,
          END OF gt_bseg.
    ALV
    DATA: gt_fieldtab TYPE slis_t_fieldcat_alv,
          g_save(1)   TYPE c,
          g_variant   LIKE disvariant.
    DATA: BEGIN OF gt_result OCCURS 0,
            bukrs       LIKE bsak-bukrs,
            lifnr       LIKE bsak-lifnr,
            name1       LIKE lfa1-name1,
            augdt       LIKE bsak-augdt,
            gjahr       LIKE bsak-gjahr,
            belnr       LIKE bsak-belnr,
            blart       LIKE bsak-blart,
            zterm       LIKE bsak-zterm,
            wrbtr       LIKE bseg-wrbtr,
            waers       LIKE bkpf-waers,
            ext_num(24) TYPE c,
            txt20       LIKE skat-txt20,
            usr00       LIKE prps-usr00,
            usr01       LIKE prps-usr01,
            usr02       LIKE prps-usr02,
            usr03       LIKE prps-usr03,
          END OF gt_result.
    CONSTANTS: c_credit(1)       TYPE c VALUE 'H',
               c_x(1)            TYPE c VALUE 'X',
               c_en(2)           TYPE c VALUE 'EN',
               c_mrc(4)          TYPE c VALUE 'CA01'.
    *====================================================
    INITIALIZATION.
      PERFORM initialize_variant.
    AT SELECTION-SCREEN.
      PERFORM pai_of_selection_screen.
    *====================================================
    START-OF-SELECTION.
      REFRESH gt_result.
    find clearing documents
      SELECT        bukrs
                    lifnr
                    augdt
                    gjahr
                    belnr
                    blart
                    zterm
             INTO   TABLE gt_bsak
             FROM   bsak
             WHERE  bukrs  IN s_bukrs
             AND    lifnr  IN s_lifnr
             AND    augdt  IN s_augdt
             AND    blart  IN s_blart
             AND    zterm  IN s_zterm.
      CHECK NOT gt_bsak[] IS INITIAL.
      LOOP AT gt_bsak.
    read WBS items
        SELECT        bukrs
                      belnr
                      gjahr
                      dmbtr
                      projk
                      shkzg
                      hkont
               INTO   TABLE  gt_bseg
               FROM   bseg
               WHERE  bukrs  = gt_bsak-bukrs
               AND    belnr  = gt_bsak-belnr
               AND    gjahr  = gt_bsak-gjahr
               AND    projk  > space.
        gt_result-bukrs = gt_bsak-bukrs.
        gt_result-lifnr = gt_bsak-lifnr.
        gt_result-augdt = gt_bsak-augdt.
        gt_result-belnr = gt_bsak-belnr.
        gt_result-gjahr = gt_bsak-gjahr.
        gt_result-blart = gt_bsak-blart.
        gt_result-zterm = gt_bsak-zterm.
    document currency
        SELECT SINGLE waers
               INTO   gt_result-waers
               FROM   bkpf
               WHERE  bukrs  = gt_bsak-bukrs
               AND    belnr  = gt_bsak-belnr
               AND    gjahr  = gt_bsak-gjahr.
    vendor name
        SELECT SINGLE name1
               INTO   gt_result-name1
               FROM   lfa1
               WHERE  lifnr  = gt_result-lifnr.
    for each accounting document
        LOOP AT gt_bseg.
    convert to external WBS
          CALL FUNCTION 'PSPNUM_INTERN_TO_EXTERN_CONV'
            EXPORTING
              edit_imp  = c_x
              int_num   = gt_bseg-projk
            IMPORTING
              ext_num   = gt_result-ext_num
            EXCEPTIONS
              not_found = 1
              OTHERS    = 2.
    debit or credit
          IF gt_bseg-shkzg = c_credit.
            gt_result-wrbtr = gt_bseg-wrbtr.
          ELSE.
            gt_result-wrbtr = gt_bseg-wrbtr * -1.
          ENDIF.
    GL short Text
          SELECT SINGLE txt20
                 INTO   gt_result-txt20
                 FROM   skat
                 WHERE  spras  = c_en
                 AND    ktopl  = 'CA01'
                 AND    saknr  = gt_bseg-hkont.
    user fields
          SELECT SINGLE usr00
                        usr01
                        usr02
                        usr03
                 INTO  (gt_result-usr00,
                        gt_result-usr01,
                        gt_result-usr02,
                        gt_result-usr03)
                 FROM   prps
                 WHERE  pspnr  = gt_bseg-projk.
    append to result table
          APPEND gt_result.
        ENDLOOP.
      ENDLOOP.
    *====================================================
    END-OF-SELECTION.
      PERFORM initialize_fieldcat USING gt_fieldtab[].
      g_variant-report = sy-repid.
      g_save           = 'A'.
      IF s_list = 'X'.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            it_fieldcat = gt_fieldtab
            i_default   = 'A'
            i_save      = g_save
            is_variant  = g_variant
          TABLES
            t_outtab    = gt_result.
      ELSE.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            it_fieldcat = gt_fieldtab
            i_default   = 'A'
            i_save      = g_save
            is_variant  = g_variant
          TABLES
            t_outtab    = gt_result.
      ENDIF.
    *&      Form  initialize_variant
    FORM initialize_variant.
      g_save = 'A'.
      CLEAR g_variant.
      g_variant-report = sy-repid.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
        EXPORTING
          i_save     = g_save
        CHANGING
          cs_variant = g_variant
        EXCEPTIONS
          not_found  = 2.
      IF sy-subrc = 0.
        s_vari = g_variant-variant.
      ENDIF.
    ENDFORM.                               " INITIALIZE_VARIANT
    *&      Form  pai_of_selection_screen
    FORM pai_of_selection_screen.
      IF NOT s_vari IS INITIAL.
        MOVE s_vari TO g_variant-variant.
        CALL FUNCTION 'REUSE_ALV_VARIANT_EXISTENCE'
          EXPORTING
            i_save     = g_save
          CHANGING
            cs_variant = g_variant.
      ELSE.
        PERFORM initialize_variant.
      ENDIF.
    ENDFORM.                    " PAI_OF_SELECTION_SCREEN
    *&      Form  initialize_fieldcat
    FORM initialize_fieldcat USING p_fieldtab TYPE slis_t_fieldcat_alv.
      DATA: l_fieldcat TYPE slis_fieldcat_alv.
      CLEAR l_fieldcat.
      l_fieldcat-tabname    = 'GT_RESULT'.
      l_fieldcat-fieldname  = 'BUKRS'.
      l_fieldcat-seltext_L  = 'Company'.
      l_fieldcat-outputlen  = '8'.
      APPEND l_fieldcat TO p_fieldtab.
      l_fieldcat-tabname    = 'GT_RESULT'.
      l_fieldcat-fieldname  = 'LIFNR'.
      l_fieldcat-seltext_L  = 'Vendor'.
      l_fieldcat-outputlen  = '10'.
      APPEND l_fieldcat TO p_fieldtab.
      l_fieldcat-tabname    = 'GT_RESULT'.
      l_fieldcat-fieldname  = 'NAME1'.
      l_fieldcat-seltext_L  = 'Name'.
      l_fieldcat-outputlen  = '35'.
      APPEND l_fieldcat TO p_fieldtab.
      l_fieldcat-tabname    = 'GT_RESULT'.
      l_fieldcat-fieldname  = 'AUGDT'.
      l_fieldcat-seltext_L  = 'Cleared'.
      l_fieldcat-outputlen  = '10'.
      APPEND l_fieldcat TO p_fieldtab.
      l_fieldcat-tabname    = 'GT_RESULT'.
      l_fieldcat-fieldname  = 'GJAHR'.
      l_fieldcat-seltext_L  = 'Year'.
      l_fieldcat-outputlen  = '5'.
      APPEND l_fieldcat TO p_fieldtab.
      l_fieldcat-tabname    = 'GT_RESULT'.
      l_fieldcat-fieldname  = 'BELNR'.
      l_fieldcat-seltext_L  = 'Document'.
      l_fieldcat-outputlen  = '10'.
      APPEND l_fieldcat TO p_fieldtab.
      l_fieldcat-tabname    = 'GT_RESULT'.
      l_fieldcat-fieldname  = 'BLART'.
      l_fieldcat-seltext_L  = 'Type'.
      l_fieldcat-outputlen  = '4'.
      APPEND l_fieldcat TO p_fieldtab.
      l_fieldcat-tabname    = 'GT_RESULT'.
      l_fieldcat-fieldname  = 'ZTERM'.
      l_fieldcat-seltext_L  = 'Pay Terms'.
      l_fieldcat-outputlen  = '4'.
      APPEND l_fieldcat TO p_fieldtab.
      l_fieldcat-tabname    = 'GT_RESULT'.
      l_fieldcat-fieldname  = 'WRBTR'.
      l_fieldcat-seltext_L  = 'Amount'.
      l_fieldcat-outputlen  = '13'.
      APPEND l_fieldcat TO p_fieldtab.
      l_fieldcat-tabname    = 'GT_RESULT'.
      l_fieldcat-fieldname  = 'WAERS'.
      l_fieldcat-seltext_L  = 'CURR'.
      l_fieldcat-outputlen  = '5'.
      APPEND l_fieldcat TO p_fieldtab.
      l_fieldcat-tabname    = 'GT_RESULT'.
      l_fieldcat-fieldname  = 'EXT_NUM'.
      l_fieldcat-seltext_L  = 'WBS'.
      l_fieldcat-outputlen  = '24'.
      APPEND l_fieldcat TO p_fieldtab.
      l_fieldcat-tabname    = 'GT_RESULT'.
      l_fieldcat-fieldname  = 'TXT20'.
      l_fieldcat-seltext_L  = 'Short Text'.
      l_fieldcat-outputlen  = '20'.
      APPEND l_fieldcat TO p_fieldtab.
      l_fieldcat-tabname    = 'GT_RESULT'.
      l_fieldcat-fieldname  = 'USR00'.
      l_fieldcat-seltext_L  = 'H/O File Ref'.
      l_fieldcat-outputlen  = '20'.
      APPEND l_fieldcat TO p_fieldtab.
      l_fieldcat-tabname    = 'GT_RESULT'.
      l_fieldcat-fieldname  = 'USR01'.
      l_fieldcat-seltext_L  = 'Local File Ref'.
      l_fieldcat-outputlen  = '20'.
      APPEND l_fieldcat TO p_fieldtab.
      l_fieldcat-tabname    = 'GT_RESULT'.
      l_fieldcat-fieldname  = 'USR02'.
      l_fieldcat-seltext_L  = 'INFORM Agree ID'.
      l_fieldcat-outputlen  = '10'.
      APPEND l_fieldcat TO p_fieldtab.
      l_fieldcat-tabname    = 'GT_RESULT'.
      l_fieldcat-fieldname  = 'USR03'.
      l_fieldcat-seltext_L  = 'INFM Prim Ag ID'.
      l_fieldcat-outputlen  = '10'.
      APPEND l_fieldcat TO p_fieldtab.
    ENDFORM.                    " INITIALIZE_FIELDCAT
    Could the experts do help to overcome the probs.
    Thanks in Advance.
    Regards,
    Anbalagan.V

    Hi Anbalagan,
    i've tested your program - but it works fine (Rel. 4.6C,SAPKB46C30)
    download is ok and direct transfer (excel inplace) is ok.
    but i've a question to the selection of waers in your program -
    why do you select waers from bkpf and not from bsak ?
    i think sel. of bkpf is'nt necessary !
    regards Andreas

  • Short Dump when downloading to EXCEL from ALV

    Hi,
    I have an ALV grid display program. The data in the grid is displayed correctly. But when trying to download the data to excel it gives a short dump.
    Assignment error: Overwriting a protected field.
    What happened?
    Error in ABAP application program.
    The current ABAP program "SAPLKKBL" had to be terminated because one of the
    statements could not be executed.
    This is probably due to an error in the ABAP program.
    Some times it allows to download the data, but sometimes it gives short dump.
    Thanks,
    Deepthi

    This is my part of the code:
      i_fieldcat-key     = gc_x.
      i_fieldcat-no_zero = gc_x.
      i_fieldcat-fix_column  = 'X'.
      i_fieldcat-hotspot = gc_x.
      perform bild_fieldcat using
        '' 'AUFNR' 'GT_REPORT ' ' '  'CAUFV'  ' '  'C' '12' ' '.
      perform bild_fieldcat using
        '' 'DISGR' 'GT_REPORT ' ' '  'MARC' ' '  'C' '4' ' '.
      perform bild_fieldcat using
        '' 'AUART' 'GT_REPORT ' ' '  'CAUFV' ' '  'C' '04' ' '.
      perform bild_fieldcat using
        '' 'DISPO' 'GT_REPORT ' ' '  'CAUFV' ' ' 'C' '06' ' '.
      i_fieldcat-no_zero = gc_x.
      perform bild_fieldcat using
        '' 'MATNR' 'GT_REPORT ' ' '  'MARA' ' '  'C' '18' ' '.
      i_fieldcat-no_zero = gc_x.
      perform bild_fieldcat using
        '' 'CHARG' 'GT_REPORT ' ' '  'MDFA' ' ' 'C' '14' ' ' .
    *begin insert RCHALASA
      i_fieldcat-no_zero = gc_x.
      i_fieldcat-fix_column  = 'X'.
      perform bild_fieldcat using
        '' 'FTRMI' 'GT_REPORT ' ' '  'CAUFV' ' ' 'D' '08' ' '.
    *end insert
      i_fieldcat-no_zero = gc_x.
      i_fieldcat-fix_column  = 'X'.
      perform bild_fieldcat using
        '' 'GLTRP' 'GT_REPORT ' ' '  'CAUFV'  ' '  'D' '10' ' '.
      i_fieldcat-no_zero = gc_x.
      perform bild_fieldcat using
        '' 'GLTRS' 'GT_REPORT' ' '  'CAUFV' ' ' 'D' '10' ' '.
      perform bild_fieldcat using
        '' 'GSTRP' 'GT_REPORT' ' '  'CAUFV' ' '  'D' '10' ' '.
      perform bild_fieldcat using
        '' 'AGE' 'GT_REPORT' ' '  ' ' 'Age'  'C' '08' ' '.
      i_fieldcat-no_zero = gc_x.
    i_fieldcat-do_sum  = gc_x.
      i_fieldcat-fix_column  = 'X'.
      perform assign_alv_qty_format.
      perform bild_fieldcat using
        '' 'GAMNG' 'GT_REPORT' ' '  ' '  'Order Qty'  'QUAN' '09' ' '.
      perform bild_fieldcat using
        '' 'STK_PROD_FLAG' 'GT_REPORT' ' '   ' '  'Stk/Prod'  'C' '06' ' '.
      i_fieldcat-no_zero = gc_x.
    i_fieldcat-do_sum  = gc_x.
      i_fieldcat-fix_column  = 'X'.
      perform assign_alv_qty_format.
      perform bild_fieldcat using
        '' 'IGMNG' 'GT_REPORT' ' '  ' ' 'Order Yield Qty' 'QUAN' '11' ' '.
      i_fieldcat-no_zero = gc_x.
    i_fieldcat-do_sum  = gc_x.
      i_fieldcat-fix_column  = 'X'.
      perform assign_alv_qty_format.
      perform bild_fieldcat using
        '' 'IASMG' 'GT_REPORT' ' ' ' ' 'Order Scrap Qty'  'QUAN' '11' ' '.
    **begin insert RCHALASA
      perform bild_fieldcat using
         '' 'YIELD_PER' 'GT_REPORT' ' ' ' ' 'Yield'  'C' '05' ' '.
    **end insert
    DATA: col_pos like sy-colno.
    col_pos = '17'.
      loop at gt_oper.
        gv_tabix = sy-tabix.
        i_fieldcat-no_zero = gc_x.
        i_fieldcat-do_sum  = gc_x.
        i_fieldcat-fix_column  = 'X'.
       col_pos = col_pos + 1.
        perform assign_alv_qty_format.
        gv_yield6(03) = gt_oper-vornr1(03).
    *begin insert RCHALASA
        move gt_oper-ltxa1 to gv_text.
      translate gv_text to upper case.
    gv_text = gv_yield.
    *end insert
        gv_tabixn = gv_tabix.
        gv_yield+6(03) = gv_tabixn.
        gv_fieldname = gv_yield.
        translate gv_fieldname to upper case.
        perform bild_fieldcat using
         '' gv_fieldname 'GT_REPORT' ' ' ' ' gv_text  'QUAN' '04' ' '.
       perform assign_alv_qty_format.
      gv_scrap6(03) = gt_oper-vornr1(03).
      select single
             grdtx
             from trugt
             into gv_text1
             where
             grund = gt_oper-vornr
             and werks in s_werks.
       gv_text = gv_scrap.
       i_fieldcat-no_zero = gc_x.
       gv_tabixn = gv_tabix.
      gv_scrap+6(03) = gv_tabixn.
       gv_fieldname = gv_scrap.
       translate gv_fieldname to upper case.
       perform bild_fieldcat using
         gv_fieldname 'GT_REPORT' ' ' gv_text1 'X' 'QUAN' '08' ' '.
       clear gv_text1.
      endloop.  " GT_OPER
      DATA: count type c.
      DESCRIBE table gt_grund lines count.
      loop at gt_grund into gl_grund.
        gv_tabix = sy-tabix.
        i_fieldcat-no_zero = gc_x.
        i_fieldcat-do_sum  = gc_x.
        i_fieldcat-fix_column  = 'X'.
        perform assign_alv_qty_format.
        if gl_grund-grund is initial.
          gl_grund = 'NONE'.
          gv_text = gl_grund.
        else.
           gv_text = gl_grund-grdtx.
        endif.
        gv_tabixn = gv_tabix.
        gv_scrap_code+11(03) = gv_tabixn.
        gv_fieldname = gv_scrap_code.
        translate gv_fieldname to upper case.
       col_pos = col_pos + 1.
        perform bild_fieldcat using
          '' gv_fieldname 'GT_REPORT' 'XMNGA' 'AFRU'  gv_text  'QUAN' '12' ' ' .
      endloop.  " GT_OPER
      gb_layout-zebra = 'X'.
      gb_print-no_print_listinfos = 'X'.
      gb_variant-variant = p_varia.
      perform create_events using gt_events[].
      call function 'SAPGUI_PROGRESS_INDICATOR'
        EXPORTING
          text = 'Reading SAP Records.......'(600).
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program       = gv_repid
                i_callback_top_of_page   = 'TOP_OF_PAGE'
               i_callback_pf_status_set = 'SET_STATUS'
                i_callback_user_command  = 'CALL_UP_SAP_TRANS'
                it_fieldcat              = i_fieldcat[]
                is_layout                = gb_layout
                i_grid_title             = gb_title
                i_default                = 'X'
                i_save                   = 'X'
                is_variant               = gb_variant
                is_print                 = gb_print
                it_events                = gt_events[]
           tables
                t_outtab                 = gt_report
           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.
    ***********ALV SUBROUTINE**************
    TYPE-POOLS: slis.
    DATA: gv_repid            LIKE sy-repid.
    DATA: i_fieldcat          TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    DATA: gb_layout           TYPE slis_layout_alv.
    DATA: gb_selfield         TYPE slis_selfield.
    DATA: gb_print            TYPE slis_print_alv.
    DATA: i_sort              TYPE  slis_t_sortinfo_alv WITH HEADER LINE.
    DATA: gv_keyinfo          TYPE SLIS_KEYINFO_ALV.
    DATA: gb_variant          LIKE disvariant,
          gb_def_variant      LIKE disvariant.
    DATA: gb_title(70).
    DATA: gt_events           TYPE slis_t_event,
          gt_sort             TYPE SLIS_T_SORTINFO_ALV,
          gt_list_top_of_page TYPE slis_t_listheader,
          g_status_set        TYPE slis_formname VALUE 'PF_STATUS_SET',
          g_user_command      TYPE slis_formname VALUE 'USER_COMMAND',
          g_top_of_page       TYPE slis_formname VALUE 'TOP_OF_PAGE',
          g_end_of_page       TYPE slis_formname VALUE 'END_OF_PAGE',
          g_top_of_list       TYPE slis_formname VALUE 'TOP_OF_LIST',
          g_end_of_list       TYPE slis_formname VALUE 'END_OF_LIST'.
    DATA: it_event_exit TYPE slis_t_event_exit WITH HEADER LINE.
    *--- Rotinas ---
    FORM alv_init.
      CLEAR: gb_variant.
      gv_repid = sy-repid.
      gb_variant-report = gv_repid.
      CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
           EXPORTING
                i_save     = 'A'
           CHANGING
                cs_variant = gb_variant
           EXCEPTIONS
                not_found  = 2.
      IF sy-subrc = 0.
        p_varia = gb_variant-variant.
      ENDIF.
    ENDFORM.                    " ALV_INIT
    FORM alv_f4.
      gb_variant-report = gv_repid.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
           EXPORTING
                is_variant = gb_variant
                i_save     = 'A'
           IMPORTING
                es_variant = gb_variant
           EXCEPTIONS
                not_found  = 2.
      IF sy-subrc = 2.
        MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        p_varia = gb_variant-variant.
      ENDIF.
    ENDFORM.                                                    " ALV_F4
    FORM bild_fieldcat USING x_pos x_field x_tab x_reffld x_ref x_text x_type x_tam x_sym.
      i_fieldcat-col_pos       = x_pos.
      i_fieldcat-fieldname     = x_field.
      i_fieldcat-tabname       = x_tab.
      i_fieldcat-ref_fieldname = x_reffld.
      i_fieldcat-ref_tabname   = x_ref.
      i_fieldcat-seltext_l     = x_text.
      i_fieldcat-seltext_m     = x_text.
      i_fieldcat-seltext_s     = x_text.
      i_fieldcat-ddictxt  = 'M'   .
      i_fieldcat-inttype       = x_type.
      i_fieldcat-outputlen     = x_tam.
      i_fieldcat-symbol        = x_sym.
      APPEND i_fieldcat.
      CLEAR  i_fieldcat.
    ENDFORM.                    " BILD_FIELDCAT
    FORM create_events USING rt_events TYPE slis_t_event.
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
                i_list_type = 0
           IMPORTING
                et_events   = rt_events.
      READ TABLE rt_events WITH KEY name = slis_ev_top_of_page
                               INTO ls_event.
      IF sy-subrc = 0.
        MOVE g_top_of_page TO ls_event-form.
        APPEND ls_event TO rt_events.
      ENDIF.
    ENDFORM.                    "

  • Download to Excel from ALV

    Hi,
       I ran the program 'BALVEX02' and i got the output i clicked on ALV standard application tool bar button 'Spreadsheet' (Ctrl_shift+F7) and unfortunately i selected HTML format radio button and selected check box that 'Always use the same format'. I need to change that format to excel. How can i get that pop-up box again. Looks like simple but could not see the alternative.
    Thanks

    Moderator message - Please do not add a meaningless comment when you mark a post as solved. It only brings old posts to the top of the forum list and pushes current ones down.
    Rob

  • Facing a Problem while downloading the data from ALV Grid to Excel Sheet

    Hi Friends,
    Iam facing a problem while downloading the data from ALV Grid to excel sheet. This is working fine in Development server , when comes to Quality and Production servers I have this trouble.
       I have nearly 11 fields in ALV Grid and out of which one is PO number of length 10 , all the ten numbers are visible in the excel sheet if we download it from development server but when we download it from Quality or Production it is showing only 9 numbers.
    Can any one help me out in this case.

    hi...
    if this problems happens dont display the same internal as u finally got.
    just create new internal table without calling any standard data elements and domains... but the new internal table s similar like ur final internal table and move all the values to new int table.
    for eg.
    ur final internal int table for disp,
         data : begin of itab occur 0,
                        matnr like mara-matnr,
                   end of itab.
    create new like this,
               data : begin of itab occur 0,
                        matnr(12) type N,
                   end of itab.

  • Regarding downloading data into excel from alv output

    hi experts,
    i have developed a customized report(ALV) in which the employee number and all details are coming but when i press
    download to excel button and get downloaded it to the excel sheet the employee number is only not coming but all details are coming in the excel sheet.please help me to short out this problem.
    Also what i found that when i press print preview button then employee number here is also not coming but rest
      of the details are coming.

    Hi Ravi,
               For downloading the data from ALV to Excel use the following FM's
    SAP_CONVERT_TO_XLS_FORMAT
    GUI_DOWNLOAD.
    In the function GUI_DOWNLOAD use the filetype as "DBF" due to which all the data gets downloaded perfectly.
    CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                        = fname
          FILETYPE                        = 'DBF'
        APPEND                          = ' '
        WRITE_FIELD_SEPARATOR           = ' '
        HEADER                          = '00'
        TRUNC_TRAILING_BLANKS           = ' '
        WRITE_LF                        = 'X'
        COL_SELECT                      = ' '
        COL_SELECT_MASK                 = ' '
        DAT_MODE                        = ' '
        CONFIRM_OVERWRITE               = ' '
        NO_AUTH_CHECK                   = ' '
        CODEPAGE                        = ' '
        IGNORE_CERR                     = ABAP_TRUE
        REPLACEMENT                     = '#'
        WRITE_BOM                       = ' '
        TRUNC_TRAILING_BLANKS_EOL       = 'X'
        WK1_N_FORMAT                    = ' '
        WK1_N_SIZE                      = ' '
        WK1_T_FORMAT                    = ' '
        WK1_T_SIZE                      = ' '
        WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
      IMPORTING
        FILELENGTH                      =
        tables
          data_tab                        =  itab
        FIELDNAMES                      =
      EXCEPTIONS
        FILE_WRITE_ERROR                = 1
        NO_BATCH                        = 2
        GUI_REFUSE_FILETRANSFER         = 3
        INVALID_TYPE                    = 4
        NO_AUTHORITY                    = 5
        UNKNOWN_ERROR                   = 6
        HEADER_NOT_ALLOWED              = 7
        SEPARATOR_NOT_ALLOWED           = 8
        FILESIZE_NOT_ALLOWED            = 9
        HEADER_TOO_LONG                 = 10
        DP_ERROR_CREATE                 = 11
        DP_ERROR_SEND                   = 12
        DP_ERROR_WRITE                  = 13
        UNKNOWN_DP_ERROR                = 14
        ACCESS_DENIED                   = 15
        DP_OUT_OF_MEMORY                = 16
        DISK_FULL                       = 17
        DP_TIMEOUT                      = 18
        FILE_NOT_FOUND                  = 19
        DATAPROVIDER_EXCEPTION          = 20
        CONTROL_FLUSH_ERROR             = 21
        OTHERS                          = 22
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Pls reward if useful.
    Thanks,
    Sirisha.

  • Limit the number of record to download to excel from a report

    I am just wondering if there is a way to limit the number of rows that I want to download to excel from a report in apex, right now when I click download to excel it downloads all records. If I am displaying 15 records on report page I want the ability to download only those records.
    Any help with that would be appreciated.
    Kind Regards,
    Sofia.

    Sofia,
    The same report query runs for downloading the data into excel, I don't think you can limit the number of records in download.
    You can achieve it using custom code, like on click of download excel redirect to another page and then restrict the data as per your need, or you can use the custom procedure to download the limited data.
    Denes' utility to download into excel.
    http://htmldb.oracle.com/pls/otn/f?p=31517:108:1476564836494581:::RP,::
    Regards,
    Manish

  • Create file excel from alv

    Hi,
    I have need to generate a file excel from alv oo.
    How to do it?
    Is there a method?
    Many Thanks!!!

    Hi
    Go through link given below :
    alv to excel download
    With Regards
    Nikunj Shah

  • In download to excel from bsp hw to increase excel column width to wrap txt

    in download to excel from bsp how to increase excel column width to wrap text
    in each column.
    My client does not want to manually click each cell aftet downloading to excel to see full text in each column

    Hi,
    You can achieve this by formatting your output using HTML table tag.
    Try the following code.
      DATA: lv_output  TYPE string.
      concatenate
      '<table border="1">'
      '<tr style="font-weight: bold; text-align:center; "><td>Name</td><td width="150">Description</td></tr>' cl_abap_char_utilities=>cr_lf
      '<tr><td>First Name</td><td>Some Description goes here..... ....... ...... </td></tr>' cl_abap_char_utilities=>cr_lf
      '<tr><td>2nd Name</td><td>XYZ.......</td></tr>' cl_abap_char_utilities=>cr_lf
      '</table>'
      into lv_output.
      response->set_cdata( data = lv_output ).
    Regards
    Geogy
    PS. Reward the useful answers.

Maybe you are looking for

  • Few questions about partitioning and formatting in Windows 8

    Hello, I'm very shortly after a Windows 8 reinstall and I want to make use of this moment to finally understand partitioning and formatting in Windows 8. Before using Windows 8, I was an XP user for 5 years and I actually never bothered myself with f

  • PDF Download & Adobe Flash issues

    FIRST:  I have a client who sends reports via PDF style.  She has been sending them forever and we both have updated versions. I can open the majority of them and print.  In the last week or so when i do a save as and have to retrieve it, I get an er

  • Brand new 27" iMac with Snow Leopard has constant hard disk activity

    I just purchased a new 27" iMac which was an upgrade for my 24" with Leopard. I have used my older machine for a good year and not noticed any hard drive activity when idle. Now on the new machine with Snow Leopard I constantly get hard disk activty

  • "Save as..." window - file name bug

    http://forums.adobe.com/message/3030230 I have the same problem. I'm using Windows XP SP3 Professional (x86). Audition version 3.0, build 7283.0. My copy is registered. Some additional notes: File format doesn't matter; I've tried WAV, MP3 and FLAC.

  • Using spry to make divs insisible but they still make 'white space'

    Ive used this tutorial to make buttons that make text appear and disappear with javascript (I dont want the page to reload); http://uk.youtube.com/watch?v=PuOxSeo7qaY My problem is that if the 'Div 2' button is pressed and the 'Div 1' button is not,