Download to Excel using METHODS

I want to change the Worksheet name which in default being created as Sheet1/ Sheet2/ Sheet3 on creation of Excel file while downloading using Objects.
How should I change the name of Sheet1/ Sheet2/ Sheet3 to my requirement. Attached the coding part. Please help me out in finding the place where I should rename it using which statement.
FORM excel_download.
  gv_step = 'Starting Excel'.
  CREATE OBJECT gw_excel 'EXCEL.APPLICATION'.
  PERFORM xls_error_hdl.
  SET PROPERTY OF gw_excel 'VISIBLE' = 0.
  GET PROPERTY OF gw_excel 'WORKBOOKS' = gw_wbooks.
  CALL METHOD OF gw_wbooks 'Add'.
*Create Excel Sheet
  CALL METHOD OF gw_excel 'Worksheets' = gw_worksheet
    EXPORTING
      #1 = 1.
  CALL METHOD OF gw_wbooks 'Activate'.
  SET PROPERTY OF gw_wbooks 'Name' = 'Sheet1'.
  CALL METHOD OF gw_wbooks 'OPEN' = gw_wbooks
    EXPORTING
      #1 = gv_fname.
  CALL METHOD OF gw_wbooks 'Activate' .
*Download to Worksheet 1.
  GET PROPERTY OF gw_excel 'Worksheets' = gw_worksheet
  exporting #1 = 'Sheet1'.      "S4M1MR
exporting #1 = 'Appd_Sites'.   "S4M1MR
  PERFORM xls_error_hdl.
  CALL METHOD OF gw_worksheet 'Activate' .
  gv_step = 'Adding data to Excel'.
  gv_row  = 0.
  LOOP AT gi_yps_down_tab1 INTO gw_yps_grid2.
    CLEAR gw_yps_common-anln1.
    gv_row = gv_row + 1.
    gv_col = 2.
    DO 4 TIMES.
      ASSIGN COMPONENT sy-index OF STRUCTURE gw_yps_grid2 TO <comp>.
      PERFORM fill_cell USING gv_row gv_col  <comp>.
      gv_col = gv_col + 1.
    ENDDO.
  ENDLOOP.
*Download to Worksheet 2.
  GET PROPERTY OF gw_excel 'Worksheets' = gw_worksheet
  exporting #1 = 'Sheet2'.
exporting #1 = 'Appd Sites'.   "S4M1MR
  PERFORM xls_error_hdl.
  CALL METHOD OF gw_worksheet 'Activate' .
  gv_step = 'Adding data to Excel'.
  gv_row  = 0.
LOOP AT gi_yps_down_tab2 INTO gw_yps_common.
  LOOP AT gi_yps_down_tab2 INTO gw_exclusion.
    PERFORM conversion.
  ENDLOOP.
*Download to Worksheet 3.
  GET PROPERTY OF gw_excel 'Worksheets' = gw_worksheet
  exporting #1 = 'Sheet3'.
  PERFORM xls_error_hdl.
  CALL METHOD OF gw_worksheet 'Activate' .
  gv_step = 'Adding data to Excel'.
  gv_row  = 0.
LOOP AT gi_yps_down_tab3 INTO gw_yps_common.
  LOOP AT gi_yps_down_tab3 INTO gw_exclusion.
    PERFORM conversion.
  ENDLOOP.
*Download to Worksheet 4.
  CALL METHOD OF gw_excel 'Sheets' = gw_worksheet.
Add new workbook (create a file)
  CALL METHOD OF gw_worksheet 'Add'.
  FREE OBJECT gw_worksheet.
  GET PROPERTY OF gw_excel 'Worksheets' = gw_worksheet
  exporting #1 = 'Sheet4'.
  PERFORM xls_error_hdl.
  CALL METHOD OF gw_worksheet 'Activate' .
  gv_step = 'Adding data to Excel'.
  gv_row  = 0.
LOOP AT gi_yps_down_tab4 INTO gw_yps_common.
  LOOP AT gi_yps_down_tab4 INTO gw_exclusion.
    PERFORM conversion.
  ENDLOOP.
To Save the Book after downloading.
  PERFORM save_excel.
ENDFORM.                    " EXCEL_DOWNLOAD
Thanks in advance

hi,
chk a sample pgm.
*&  Include           YHCON9051INCL                                    *
*   SUBROUTINES                                                       *
*&      Form  F_CHECK_LOCAL_FILE_EXIST
*       CHECK WETHER LOCAL FILE EXIST
*      -->P_FILE LOCAL FILE NAME
FORM f_check_local_file_exist  USING    p_file.
  DATA: loc_filename TYPE string,
        loc_flag     TYPE abap_bool.
  loc_filename = p_file.
  IF loc_filename Eq ' '.
    MESSAGE e053(8i) .
  ENDIF.
  CALL METHOD cl_gui_frontend_services=>file_exist
    EXPORTING
      file                 = loc_filename
    RECEIVING
      result               = loc_flag
    EXCEPTIONS
      cntl_error           = 1
      error_no_gui         = 2
      wrong_parameter      = 3
      not_supported_by_gui = 4
      OTHERS               = 5.
  IF sy-subrc NE wl_yes.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  IF loc_flag NE wl_true.
    MESSAGE e000(8i) WITH text-020 p_file.
  ENDIF.
ENDFORM.                    " F_CHECK_LOCAL_FILE_EXIST
*&      Form  F_UPLOAD_DATA_FROM_LOCAL_FILE
*       GET DATA FROM EXCEL FILE AND CONVERT TO SAP FORMAT
*      -->P_FILE LOCAL FILE NAME
FORM f_upload_data_from_local_file  USING    p_file.
  DATA: loc_filename TYPE rlgrap-filename,
        int_raw      TYPE truxs_t_text_data.
  loc_filename = p_file.
  CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
    EXPORTING
      i_field_seperator    = 'X'
      i_line_header        = 'X'
      i_tab_raw_data       = int_raw
      i_filename           = loc_filename
    TABLES
      i_tab_converted_data = int_content_lfile
    EXCEPTIONS
      conversion_failed    = 1
      OTHERS               = 2.
  IF sy-subrc NE wl_yes.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
         WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
  CLEAR : int_record , int_content_lfile ,int_record[].
  LOOP AT int_content_lfile.
* Moving the records to the Internal table for process
    int_record-adm_area = int_content_lfile-adm_area .
    int_record-dsrd_loc = int_content_lfile-dsrd_loc.
    int_record-fl_ind   = int_content_lfile-fl_ind.
    int_record-loc_loc  = int_content_lfile-loc_loc.
    int_record-loc_desc = int_content_lfile-loc_desc .
    APPEND int_record.
    CLEAR  int_record.
  ENDLOOP.
ENDFORM.                    " F_UPLOAD_DATA_FROM_LOCAL_FILE
*&      Form  GET_FILE_OPEN_DIALOG
*      F4 TO FETCH THE FILE
FORM get_file_open_dialog .
  DATA: lint_filetable TYPE filetable,
        ls_filetable   TYPE file_table,
        li_count TYPE i.
  CALL METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
       window_title            = 'Please select the file'
       default_extension       = '*.XLS'
*      DEFAULT_FILENAME        =
*      FILE_FILTER             =
*      INITIAL_DIRECTORY       =
       multiselection          = ''
*      WITH_ENCODING           =
     CHANGING
       file_table              = lint_filetable
       rc                      = li_count
*      USER_ACTION             =
*      FILE_ENCODING           =
     EXCEPTIONS
       file_open_dialog_failed = 1
       cntl_error              = 2
       error_no_gui            = 3
       not_supported_by_gui    = 4
       OTHERS                  = 5.
  IF sy-subrc <> 0.
  ELSE.
    READ TABLE lint_filetable INDEX 1 INTO ls_filetable.
    IF sy-subrc EQ wl_yes.
      p_lcl = ls_filetable-filename.
    ENDIF.
  ENDIF.
ENDFORM.                    " GET_FILE_OPEN_DIALOG
*&      Form  F_UPLOAD_DATA
*       text
*  -->  p1        text
*  <--  p2        text
FORM f_upload_data .
* To move the data to Internal table fields.
  PERFORM data_transfer.
ENDFORM.                    " F_UPLOAD_DATA
*&      Form  F_UPDATE_TABLE
*       ZTABLE UPDATION
FORM f_update_table .
  DATA:   wl_sess          TYPE c,
          loc_wf_loc_desc  TYPE  zhofs_loc_desc.
  REFRESH : int_caltrscc, int_caltrerr .
  LOOP AT int_record.
** Moving the data as desired for the Z -table updation
*  PERFORM MOVE_DATA.
    MOVE :
       int_record-adm_area        TO   loc_wf_loc_desc-adm_area  ,
       int_record-dsrd_loc        TO   loc_wf_loc_desc-dsrd_loc ,
       int_record-fl_ind          TO   loc_wf_loc_desc-fl_ind    ,
       int_record-loc_loc         TO   loc_wf_loc_desc-loc_loc   ,
       int_record-loc_desc        TO   loc_wf_loc_desc-loc_desc .
* Inserting the data to the Table ZHOFS_LOT_TABLE
    INSERT zhofs_loc_desc FROM loc_wf_loc_desc .
    IF sy-subrc EQ wl_yes.
*     Entry Inserted Correctly
      wf_suc = wf_suc + 1.
      int_caltrscc-adm_area   =  int_record-adm_area .
      int_caltrscc-dsrd_loc   =  int_record-dsrd_loc.
      int_caltrscc-fl_ind     =  int_record-fl_ind.
      int_caltrscc-loc_loc    =  int_record-loc_loc.
      int_caltrscc-reason  =  text-007.
      APPEND int_caltrscc.
      CLEAR  int_caltrscc.
    ELSE.
*     Entry Not Inserted
      wf_err = wf_err + 1.
      int_caltrerr-adm_area   =  int_record-adm_area .
      int_caltrerr-dsrd_loc   =  int_record-dsrd_loc.
      int_caltrerr-fl_ind     =  int_record-fl_ind.
      int_caltrerr-loc_loc    =  int_record-loc_loc.
      int_caltrerr-reason  =  text-006.
      APPEND int_caltrerr.
      CLEAR  int_caltrerr.
    ENDIF.
    CLEAR :  loc_wf_loc_desc-loc_desc,int_record .
  ENDLOOP.
ENDFORM.                    " F_UPDATE_TABLE
*&      Form  DATA_TRANSFER
*       text
*  -->  p1        text
*  <--  p2        text
FORM data_transfer .
  DATA : loc_int_loc_desc TYPE TABLE OF zhofs_loc_desc WITH HEADER LINE.
  CLEAR: int_record.
  LOOP AT int_record.
    wf_rec =  wf_rec + 1.
*  To Check Whether an already any records exists
    SELECT *
    FROM zhofs_loc_desc
    INTO TABLE loc_int_loc_desc
    WHERE
      adm_area = int_record-adm_area AND
      dsrd_loc  = int_record-dsrd_loc AND
      loc_loc = int_record-loc_loc.
    IF sy-subrc EQ wl_yes.
*     The entry already exist in the Table
      int_error-adm_area   =  int_record-adm_area.
      int_error-dsrd_loc   =  int_record-dsrd_loc.
      int_error-fl_ind      = int_record-fl_ind .
      int_error-loc_loc  = int_record-loc_loc.
      int_error-message =  text-005.
      APPEND int_error.
      CLEAR : int_error.
      wf_err_rec = wf_err_rec + 1.
      CONTINUE.
    ELSE.
      wf_cor_rec = wf_cor_rec + 1 .
    ENDIF.
    CLEAR: int_record.
  ENDLOOP.
  CLEAR: int_record .
  LOOP AT int_error.
    READ TABLE int_record
    WITH KEY
         adm_area = int_error-adm_area
         dsrd_loc = int_error-dsrd_loc
         loc_loc  = int_error-loc_loc .
    IF sy-subrc EQ wl_yes.
*     Delete the duplicate entries
      DELETE int_record
      WHERE
       adm_area = int_error-adm_area AND
       dsrd_loc    = int_error-dsrd_loc AND
       fl_ind = int_error-fl_ind AND
       loc_loc = int_error-loc_loc .
    ENDIF.
    CLEAR int_error.
  ENDLOOP.
ENDFORM.                    " DATA_TRANSFER
*&      Form  f_check_data
*       Check DATA
FORM f_check_data .
*ERROR FULL DATA
  IF wf_err_rec GT 0.
    WRITE:/060(1)   sy-vline, text-000 COLOR 6,sy-vline.
    LOOP AT int_error.
      FORMAT RESET.
      FORMAT COLOR  6 .
      WRITE:/001(1)   sy-vline,
             002(3)   int_error-adm_area ,
             005(1)   sy-vline  CENTERED ,
             006(4)   int_error-dsrd_loc ,
             010(1)   sy-vline  CENTERED ,
             011(1)    int_error-fl_ind  ,
             012(1)   sy-vline  CENTERED,
             013(4)   int_error-loc_loc  ,
             017(1)   sy-vline  CENTERED ,
             018(25)  int_error-message  ,
             043(1)   sy-vline  CENTERED .
      FORMAT COLOR OFF .
    ENDLOOP.
    WRITE:/001(25)  text-002,wf_err_rec.
    WRITE:/001(25)  text-003,wf_rec .
  ENDIF.
*SUCCESSFULL DATA
  IF wf_cor_rec GT 0.
    WRITE:/060(1)   sy-vline, text-001 COLOR 1 ,sy-vline.
    LOOP AT int_record.
      FORMAT RESET.
      FORMAT COLOR 1 ON .
      WRITE:/001(1)   sy-vline,
             002(3)   int_record-adm_area ,
             005(1)   sy-vline  CENTERED ,
             006(4)   int_record-dsrd_loc ,
             010(1)   sy-vline  CENTERED ,
             011(1)   int_record-fl_ind  ,
             012(1)   sy-vline  CENTERED,
             013(4)   int_record-loc_loc  ,
             017(1)   sy-vline  CENTERED ,
             018(25)  'PROPER ENTRY' ,
            043(1)   sy-vline  CENTERED .
      FORMAT COLOR OFF .
    ENDLOOP.
    WRITE:/001(25)  text-002,wf_cor_rec .
    WRITE:/001(25)  text-003,wf_rec .
  ENDIF.
ENDFORM.                    " f_check_data
*&      Form  f_check_db_data
*       text
*  -->  p1        text
*  <--  p2        text
FORM f_check_db_data .
*ERROR FULL DATA - WHILE INSERTING TO TABLE
  IF wf_err GT 0.
    WRITE:/060(1)   sy-vline,text-004 COLOR 6,sy-vline.
    LOOP AT  int_caltrerr.
      FORMAT RESET.
      FORMAT COLOR  6 .
      WRITE:/001(1)   sy-vline,
             002(3)    int_caltrerr-adm_area ,
             005(1)   sy-vline  CENTERED ,
             006(4)    int_caltrerr-dsrd_loc ,
             010(1)   sy-vline  CENTERED ,
             011(1)    int_caltrerr-fl_ind  ,
             012(1)   sy-vline  CENTERED,
             013(4)    int_caltrerr-loc_loc  ,
             017(1)   sy-vline  CENTERED ,
             018(25)   int_caltrerr-reason  ,
             043(1)   sy-vline  CENTERED .
      FORMAT COLOR OFF .
    ENDLOOP.
    WRITE:/001(25)  text-002,wf_err.
    WRITE:/001(25)  text-003,wf_rec .
  ENDIF.
*    ERROR BY DUPLICATION
  IF wf_err_rec GT 0.
    WRITE:/060(1)   sy-vline,text-000 COLOR 6,sy-vline.
    LOOP AT int_error.
      FORMAT RESET.
      FORMAT COLOR  6 .
      WRITE:/001(1)   sy-vline,
             002(3)   int_error-adm_area ,
             005(1)   sy-vline  CENTERED ,
             006(4)   int_error-dsrd_loc ,
             010(1)   sy-vline  CENTERED ,
             011(1)    int_error-fl_ind  ,
             012(1)   sy-vline  CENTERED,
             013(4)   int_error-loc_loc  ,
             017(1)   sy-vline  CENTERED ,
             018(25)  int_error-message  ,
             043(1)   sy-vline  CENTERED .
      FORMAT COLOR OFF .
    ENDLOOP.
    WRITE:/001(25)  text-002,wf_err_rec.
    WRITE:/001(25)  text-003,wf_rec .
  ENDIF.
*SUCCESSFULL DATA
  IF wf_suc GT 0.
    WRITE:/060(1)   sy-vline,text-001 COLOR 1 ,sy-vline.
    LOOP AT int_caltrscc.
      FORMAT RESET.
      FORMAT COLOR 1 ON .
      WRITE:/001(1)   sy-vline,
             002(3)   int_caltrscc-adm_area ,
             005(1)   sy-vline  CENTERED ,
             006(4)  int_caltrscc-dsrd_loc ,
             010(1)   sy-vline  CENTERED ,
             011(1)   int_caltrscc-fl_ind  ,
             012(1)   sy-vline  CENTERED,
             013(4)   int_caltrscc-loc_loc  ,
             017(1)   sy-vline  CENTERED ,
             018(25)  int_caltrscc-reason ,
            043(1)   sy-vline  CENTERED .
      FORMAT COLOR OFF .
    ENDLOOP.
    WRITE:/001(25)  text-002,wf_cor_rec .
    WRITE:/001(25)  text-003,wf_rec .
  ENDIF.
ENDFORM.                    " f_check_db_data
rgds
Anver
if hlped pls mark points

Similar Messages

  • Download to excel using GUI_DOWNLOAD : Date format

    Hi Gurus,
    I am downloading the data from an internal table to excel file using FM gui_download. The date field in my internal table is in the format MM-DD-YYYY (stored as Char 10 field). But when it downloads to excel, the date format changes to MM/DD/YYYY. I want to keep original format of MM-DD-YYYY in excel.
    Please help, sure points for helpful answers.
    should i use FM gui_download only, or is there some Other useful FM.
    Regards,
    Abhishek

    Hi,
    Check the code below:
    v_date = sy-datum.
    IF v_date CA '/'.
      REPLACE '/' WITH '-' INTO v_date.
    ENDIF.
    Regards
    Kannaiah

  • ALV downloaded to EXCEL -using standard button-how to modify the EXCEL ???

    hey guys,
      i have developed an ALV (with dynamic itnernal table,with HTML top of page,using FMs)
    Now ,i ahd problems with downlaod to excel(which i partly overcame by using &XXL fcode button instead of other 'donwload to excel button' )..
    now the data is downloading to excel fne..
    but i need to customise the EXCEL with HEADING (with bold letters in colour).. and also adding a line in ALV COLOUMN HEADINGS part of EXCEL...

    Hi,
    Kindly go through the below link to download a file in Excel format from ALV,
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/alv%252bgrid%252bdisplay%252bwith%252bcheckbox%252bto%252bprocess%252bselected%252brecords%252bat%252bruntime
    Note:  In the function module ->GUI_DOWNLOAD
    You have to give Field Separator as 'X'.
    Hope it helps You.
    Regards
    Mansi

  • Download to Excel using pkg by Denes

    I've had success using the package that Denes created for non-Interactive Reports, but now I have issue downloading to Excel when I create a SQL Report, with the option to Enable Search = Yes. When I download the report, it only appears to show columns that aren't searchable, or at least those columns that don't have a value for the column attribute for "Highlight Words." The report was created through a wizard, so APEX automatically created the items and processes to enable searching for values within the report. When I remove the item specified for Highlight Words (e.g. &P60_REPORT_SEARCH), the column then shows up in the downloaded file. I did not find any logic in the Export_Excel_Pkg where it might exclude such columns. Any ideas?

    The issue appears to be resolved. In the EXCEL_REPORT_PKG.PRINT_REPORT_HEADER proc there is a cursor with a condition specifiying: include_in_export = 'Yes'. Strangely, even though in APEX I can see that the column attribute Include in Export = Yes, the values for these report columns in the APEX_APPLICATION_PAGE_RPT_COLS view for the INCLUDE_IN_EXPORT column was NULL. I had to again click on "Apply Changes" and it set the column value in the table to 'Yes' where before it was NULL.

  • Download to Excel using on Classical ALV List..

    Hi Experts,
    I want to Display data in ALV using REUSE_ALV_GRID_DISPLAY.
    I already did it.
    But on the ALV screen I have to disable all Push Buttons, and enable only one push button to Down Load to Excel Sheet.
    Can any give clear solution for this?
    Regards,
    Kumar
    Edited by: ABAP on Jun 1, 2010 1:26 PM

    Hi.
    I found class cl_salv_table (there are other ones). They handle ALV display in a much easier way that the REUSE function modules. It is worth trying. After I started using them I do not want to see REUSE* again. Here a code sample. The three last lines are actually the ones doing all the work for you.
    *& Report  MYALV
    REPORT  myalv.
    PARAMETERS: tab TYPE dd02t-tabname VALUE CHECK.
    DATA: gr_itab TYPE REF TO data,
          go_alv TYPE REF TO cl_salv_table.
    FIELD-SYMBOLS <go_itab> TYPE ANY TABLE.
    START-OF-SELECTION.
      CREATE DATA gr_itab TYPE TABLE OF (tab).
      ASSIGN gr_itab->* TO <go_itab>.
      SELECT * UP TO 100 ROWS FROM (tab) INTO TABLE <go_itab>.
      cl_salv_table=>factory( IMPORTING r_salv_table = go_alv
                              CHANGING  t_table      = <go_itab> ).
      go_alv->display( ).

  • Download to excel from portal

    Hi all,
    I am calling an ABAP program in an iView in the portal. The program has an function to download to Excel using function module XXL_SIMPLE_API. In the portal this results in a 'CNTL_ERROR' exception in program CL_GUI_FRONTEND_SERVICES. I have tried several function modules (SAP_CONVERT_TO_XLS_FORMAT, WS_EXCEL) but none of these can be used from the portal.
    Is there any function module or class that I can use to download data to excel from the portal??
    Thanks!
    Patrick

    I'm not specialist in that area but not surprised that it doesn't work, as these functions use OLE, and this is forbidden via internet navigator (security reasons I guess).
    Either download a simple CSV file (download any internal table using CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD method),
    or if you really want to make special things, look at ActiveX and ACF sap notes, and also demo web dynpro ios_test_helloworld_ms (office integration), but I don't have more info.

  • How can I disenable the EXCEL field format when use ALV download to excel ?

    Dear friends,
         I have a problem with the ALV download to EXCEL. One field Value in ALV is like u2018-abcdeu2026u2019.the character u201C-u201Cis the first   position  in field value.when I download  the value to EXCEL,the field value u2018-abcdeu2026u2019 changed u2018=-abcdeu2026u2019 in EXCEL.how can I remove u2018=u2019 in EXCEL when I down to excel used ALV.
    I add a space in u2018  -abcdeu2026u2019,So this value can be download to Excel .
    Have you any solve method?
    User does not use excel logo button to download.
    User use Local fileu2026 button to download
    Thanks
    Sun

    add a single quote to the beginning of the field.
    like:  '-abcde
    in excel it will be shown as : -abcde

  • How to Download displayed output to Excel Using Bsp Application

    Hi Experts,
    please give me some idea because I am New In BSP.
    How to Download displayed output to Excel Using Bsp Application.
    If any sample code please do send me.
    In my condition I am getting data in  2-3 table view formats on one page and i want download that in Excel.
    please help me.
    Regards & Thanks,
    Yogesh

    Hi,
    This is more a question for the BSP forum.
    Anyway, as such it's realy easy since you can use HTML in order to import to Excel. All you need to do is add
    runtime->server->response->set_header_field( name = 'Contnet-Type'
    value = 'application/vnd.ms-excel' ).
    runtime->server->response->delete_header_field( name = 'Cache-Control' ).
    runtime->server->response->delete_header_field( name = 'Expires' ).
    runtime->server->response->delete_header_field( name = 'Pragma' ).
    Also check threads like
    Download BSP data into Excel
    export bsp-table to excel
    Export BSP Table to Excel
    Eddy
    PS. Reward useful answers and earn points yourself

  • Using download button in ALV to download to excel

    Hi,
    Please provide me the solution on using download button in Hierarchial List ALV to download to excel.I need to download the Header and Item details in a single line (in one line)in the Excel sheet.
    Please suggest the solution and sample code ASAP.
    Thanks and Regards,
    Latha.

    Hi Rames,
    my mail id : [email protected]
    Thanks and Regards,
    Vidyullatha.

  • Downloading ALV Grid (using objects) output to Excel

    Hi all,
    I'm using objects for ALV Grid. I have few other fields (few are above and few are below the custom control) on screen other than custom control. I want to download the entire screen to excel (including other fields). But using Export option I'm able to download only ALV Grid. I did tried with Excel in place option which is not pulling data from ALV Grid control.
    Please suggest me the solution.
    Regards
    Jaker.

    hi
    use this code in ALV format
    TABLES USR03.
    DATA: BEGIN OF ISAPDAT OCCURS 0,
              BNAME LIKE USR03-BNAME,
              NAME1 LIKE USR03-NAME1,
              NAME2 LIKE USR03-NAME2,
          END OF ISAPDAT.
    PARAMETERS P_FNAME LIKE RLGRAP-FILENAME
                        DEFAULT 'd:\sapdata.xls' OBLIGATORY.
    SELECT * FROM USR03 INTO CORRESPONDING FIELDS OF TABLE ISAPDAT.
    SORT ISAPDAT.
    CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
         EXPORTING
              I_FILENAME        = P_FNAME
         TABLES
              I_TAB_SAP_DATA    = ISAPDAT
         EXCEPTIONS
              CONVERSION_FAILED = 1
              OTHERS            = 2.
    IF SY-SUBRC EQ 0.
      WRITE:/ 'Download to Excel complete'.
    ELSE.
      WRITE:/ 'Error with download'.
    ENDIF.
    Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 2:34 PM

  • How do I get at the downloaded daa to use it under excell?

    How do I get at downloaded data to use it in Excell?

    Settings>General>Reset>Reset Location Warnings.

  • How to download report into excel using button?

    Hello Friends,
    I am creating one simple classical report.
    Now, I put one "Download" button on the report output screen.
    I want to do is....
    When I press this download button, One pop-up should be called and should ask for where to download on local PC.and downloaded file should be in excel.
    How to do this?
    Regards,
    RH

    hi..
    First explain that, we hav a standard functionality in ALV to download into EXCEL to your FUNCTIONAL CONSULTANT or to your CTM. It is our duty to explain the technical functionality and make use of it wisely. There's nothing wrong in expressing your thoughts regarding requirement. And dont blindly accept requirements and try to interact with FC about it. To me, using a button to download to excel in ALV report is not wise.
    regards,
    Padma

  • Some problem of download BSP data into excel using  cl_bsp_utility= download

    Hello Experts,
    I have read the blog of thomas.jung for download bsp data into excel, and it's working correct, and after some try and error, now I can download the excel with multi sheets.It's all cool except one thing.....when I add a button on the standard screen of the supplier qualification of the slc to download the excel file, after the popinp up screen, the standard screen can't do any operation at all......there are no any error message and the downloaded file is all correct .
    Does any one know what can I do?

    any ideas?
    By the way, after some research, maybe the issue was caused by the setup of the button, but I don't know how to fix it...0rz
    the standard code for buttton is
    lv_id = mv_id && '>display'.
    lo_edit_display_button = cl_thtmlb_button=>factory( id       = lv_id
                                                       text     = lv_button_text
                                                   tooltip  = lv_button_text
                                                   enabled  = 'TRUE'
                                                  onclick  = lv_button_action ).
    WHILE io_page_context->element_process( element = lo_edit_display_button ) = if_bsp_element=>co_element_continue.
    ENDWHILE.
    so I copy it and modify like this:
    lv_id = mv_id && '>download'.
        lo_download_excel_button = cl_thtmlb_button=>factory( id       = lv_id
                                                            text     = w_text
                                                        tooltip  = w_text
                                                        enabled  = 'TRUE'
        onclick  = /srmsm/if_ql_ext_ui_c=>ZC_ACTION_DOWNLOAD_EXCEL
    WHILE io_page_context->element_process( element = lo_download_excel_button ) = if_bsp_element=>co_element_continue.
    ENDWHILE.

  • Warning while downloading an Excel file from WD ABAP

    Hi folks,
    In one of requirements, Client wants to download all the data that is appearing on the screen ( WD ABAP Application ) to an Excel with a layout in different manner.
    We achieved this with Simple Transformations.
    Now the question is while downloading the excel file, the framework/other  is throwing an Warning like
    " The file you are trying to open, 'info.xls', is in a different format than specified by the extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now? "
    Note: All the users of my client are using MS Office 2002 / 2003.
    I am using the following code........!
    *------ Call Transformation for Excel OUTPUT
      CALL TRANSFORMATION ZEXCEL_OUTPUT
          SOURCE
                 t_dates     = t_dates
                 t_info        = t_info
          RESULT XML l_xml_string.
    REPLACE ALL OCCURRENCES OF '<?xml version="1.0" encoding="utf-16"?>'  l_xml_string WITH '<?xml version="1.0"?><?mso-application progid="Excel.Sheet"?>'.
    **-- Call Function Module for converting string data to XSTRING
      CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
        EXPORTING
          text           = l_xml_string
          mimetype = 'application/xml'
        IMPORTING
          buffer      = l_xml_xstring
        EXCEPTIONS
          failed   = 1
          OTHERS   = 2.
      CALL METHOD cl_wd_runtime_services=>attach_file_to_response
        EXPORTING
          i_filename       = 'info.xml'
          i_content        = l_xml_xstring
          i_mime_type   = 'application/vnd.ms-excel'.
    With this code I am generating a file of type XML SPREADSHEET 2003. While opening this file I am getting the above message which the user unwanted......
    Can any one help me on this -
    > How to avoid this warning?
    Thanks and Regards,
    Aneel Danda
    Edited by: danda aneel on Jul 13, 2010 1:43 PM

    Firstly, Thanks for Your quick Response, Thomas.
    Even though what ever may be the file name I am passing either info.xml or Info.xls , In error info.xls is coming.
    Kindly provide me an alternative on this  XML doesn't seem like it would match the 'application/vnd.ms-excel'.
    what is the supported format.?
    Similarly, It is not considering the UTF-8 / UTF-16 for xml.........same result is appearing in the output.
    Edited by: danda aneel on Jul 14, 2010 7:52 AM

  • Upload and download of  excel file in the application server in background

    Hi all,
    i want to download the excel file from application server into internal table and after processing i have to upload to excel file in the application server in the background mode..
    i mean i'll schedule the program in background.
    im using FM ALSM_EXCEL_TO_INTERNAL_TABLE its working fine in fore ground but not in back ground.
    what method i have to follow ?

    Hi Ankit,
    I think this is not possible to open a Excel-File from the application server because the Excel format before Office 2007 where a binary format (Suffix: .xls). The newer Office file format (Suffix: xlsx) is a zipped XML Format. To read the binary Excel-Format you need an OLE Connection between SAP GUI and Office. But at the application server in background you doesn't have this OLE Connection.
    In my opinion you have two possibilities:
    1. Convert all files in the CSV format. This file format can be read with open dataset.
    2. Upload the files from the presentation server in forground. There are some funktion modules in the standard which can read the xls format. But they have some limits regarding the length of cells content.
    My recommendation is solution no. 1. If you know an VBA expert, he can write an Excel-macro which converts all Excel Files in the CSV-Fomat.
    Regards
    Dirk

Maybe you are looking for