Question about output in Excel file

Hi all experts
I am trying to export a report to excel sheet. Got one problem, in the report there are codes of companies,  like "09", "08", but when exported by using WS_EXCEL FBS, i got the result "9", "8".
That is> the Zero at the beginning is lost.
How can i solve this problem easily?
question2, how can i make the alignment better. (now some are left and some are right aligned)
thank you !
here is my coding
CALL FUNCTION 'WS_EXCEL'
EXPORTING
FILENAME = file1
SYNCHRON = ' '
TABLES
data = tab_comp
EXCEPTIONS
UNKNOWN_ERROR = 1
OTHERS = 2
file1 = 'c:\tmp\b.xls'
Richard

Hi,
Conventionally it is not possible.
If u can compromise to some extent its is possible. Check below code.
U may have to give one check box in selection screen/Push button in output list.
Based on the selection(In case of check box)/Click(In case of push button) u can download the data.
U have loop through ur itab and modify that value by concatenating the special character '
But it will also be downloaded to excel
If u don't understand what i am saying just copy paste below code and see whether it will be fine.
TYPES:BEGIN OF t_tab,
        empno(10) TYPE c,
      END OF t_tab.
DATA: i_tab TYPE TABLE OF t_tab,
      wa_tab TYPE t_tab.
CLEAR wa_tab.
wa_tab-empno = '0075694'.
APPEND wa_tab TO i_tab.
CONCATENATE '''' wa_tab-empno INTO wa_tab-empno.
MODIFY i_tab FROM wa_tab INDEX 1.
CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
*   BIN_FILESIZE                  =
    filename                      = 'E:/test.xls'
*   FILETYPE                      = 'ASC'
*   APPEND                        = ' '
   WRITE_FIELD_SEPARATOR         = '#'
*   HEADER                        = '00'
*   TRUNC_TRAILING_BLANKS         = ' '
*   WRITE_LF                      = 'X'
*   COL_SELECT                    = ' '
*   COL_SELECT_MASK               = ' '
*   DAT_MODE                      = ' '
* IMPORTING
*   FILELENGTH                    =
  tables
    data_tab                      = i_tab
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.
*Here output in excel is '0075694
Thanks,
Vinod.

Similar Messages

  • How to run the report and show the output in excel file

    salam
    how to run the report and show the output in excel file,
    how to run the report and print the o/p via printer
    how to run the report and send the o/p via mail
    thank u all

    Hi,
    There are Parameters DESTTYPE, DESFORMAT and DESNAME. You can set these parameters to get as you want.
    1) Output in Excel File
         ADD_PARAMETER(PL_ID, 'DESTYPE', TEXT_PARAMETER, 'FILE');
         ADD_PARAMETER(PL_ID, 'DESFORMAT', TEXT_PARAMETER, 'DELIMITED');
         ADD_PARAMETER(PL_ID, 'DESNAME', TEXT_PARAMETER, '<file_name>.XLS');2) output to printer
         ADD_PARAMETER(PL_ID, 'DESTYPE', TEXT_PARAMETER, 'PRINTER');
         ADD_PARAMETER(PL_ID, 'DESNAME', TEXT_PARAMETER, '<printer_name>');3) Email - Have to configure SMTP and all. ( i didn't checked it)
         ADD_PARAMETER(PL_ID, 'DESTYPE', TEXT_PARAMETER, 'MAIL');
         ADD_PARAMETER(PL_ID, 'DESNAME', TEXT_PARAMETER, '<email_id>');Regards,
    Manu.
    If this answer is helpful or correct, please mark it. Thanks.

  • ALV Output to Excel file

    Hi All,
    I am downloading the ALV output to Excel file.I am making use of  LIST--->EXPORT--->SPREADSHEET option.
    My list is having Header, Footer, sub totals and totals.When i transfer the list i am facing following problems
    1.Even i am getting the empty columns betweeen my output.
    2.In the Place of sub totals i am getting astericks
    3.On the top of the records downloaded,"DYNAMIC LIST DISPLAY" is found.I want to avoid this text on the top
    Thanks,
    Ravee...

    Hello Vinod,
    1.I am getting the empty columns betweeen my output.
    I am having 16 columns in the ALV output,but i got 19 columns in my excel file.
    2.In the Place of sub totals i am getting astericks.
    Generally there is no possibility to download the sub totals.i am using LIST->EXPORT->SPREADSHEET.
                     I am having the sub totals in my output.
    *You would have noticed the' * ' for sub total and ' ** ' for grand totals values.*These sub total & total values are not downloaded but these asterisks are carried to excel file.
    3.On the top of the records downloaded,"DYNAMIC LIST DISPLAY" is found.I want to avoid this text on the top.
    I am using the application tool bar icon only.Still i am getting the same.
    Thanks,
    Ravee...

  • How to download a smartform output as excel file WITH EXACT LAYOUT.

    Hi,
         I have searched the forum but could not found any satisfactory answer. I have a smartform with a table, some texts and a logo. I have to write a code which will save the smartform output as excel file in the system keeping the layout of the smartform output EXACT.
    i.e., the excel file will contain the output with EXACTLY THE SAME layout as would have been for a pdf file (if the smartform output is converted to a pdf file) and the client can then edit the fields of the table in the excel file.  How can I achieve this? Please give a suggestion.. Thanks in advance.

    Hi Anirban,
    Your Requirement is to download a smartform to  microsoft  Excel .
    Well unfortunately we can only download data into excel which is in a tabular format i.e stored in internal tables we have function modules to do the same even u can do that using OLE2.
    If u try to download a smartform to Excel only format supported will be ASCII, if u will continue with that the smartforms text's will get downloaded to excel but whole data would be downloaded in a single Cell.
    Code to do the same is -
    >>>>
    CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
      EXPORTING
      i_language = v_language
      i_application = 'SAPDEFAULT'
      IMPORTING
      e_devtype = v_e_devtype.
       CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          FORMNAME                 = w_form
    *   VARIANT                  = ' '
    *   DIRECT_CALL              = ' '
       IMPORTING
         FM_NAME                  =  w_fmname
       EXCEPTIONS
         NO_FORM                  = 1
         NO_FUNCTION_MODULE       = 2
         OTHERS                   = 3
      IF sy-subrc <> 0.
        MESSAGE E002(zcpm) WITH 'Smartform call fails'.
      ENDIF.
    wa_outopt-tdprinter = v_e_devtype.
    wa_ctrlop-no_dialog = 'X'.
    wa_ctrlop-getotf    = 'X'.
      CALL FUNCTION w_fmname "'/1BCDWB/SF00000025'
        EXPORTING
    *   ARCHIVE_INDEX              =
    *   ARCHIVE_INDEX_TAB          =
    *   ARCHIVE_PARAMETERS         =
        CONTROL_PARAMETERS         = WA_CTRLOP
    *   MAIL_APPL_OBJ              =
    *   MAIL_RECIPIENT             =
    *   MAIL_SENDER                =
        OUTPUT_OPTIONS             = WA_OUTOPT
    *    USER_SETTINGS              = ' '
        IMPORTING
    *   DOCUMENT_OUTPUT_INFO       =
        JOB_OUTPUT_INFO            = T_OTFDATA
    *   JOB_OUTPUT_OPTIONS         =
    *    document_output_info       = st_document_output_info
    *    job_output_info            = st_job_output_info
    *    job_output_options         = st_job_output_options
        TABLES
          T_FINAL                    = T_FINAL
          T_ZSDT_WAGONS              = T_ZSDT_WAGONS_1
          T_QTY                      = T_QTY
          T_QTY1                     = T_QTY1
          T_CON1                     = T_CON1
          T_CON2                     = T_CON2
          "T_ZTMM_OUTWB_TXN           = T_ZTMM_OUTWB_TXN
    EXCEPTIONS
       FORMATTING_ERROR           = 1
       INTERNAL_ERROR             = 2
       SEND_ERROR                 = 3
       USER_CANCELED              = 4
       OTHERS                     = 5
      IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    T_OTF[] = T_OTFDATA-OTFDATA[].
    CALL FUNCTION 'CONVERT_OTF'
    EXPORTING
              format = 'ASCII'
              max_linewidth = 132
    * ARCHIVE_INDEX = ' '
    IMPORTING
              bin_filesize = w_bin_filesize
    TABLES
              otf   = t_otf
              lines = t_pdf_tab
    EXCEPTIONS
              err_max_linewidth = 1
              err_format = 2
           err_conv_not_possible = 3
    OTHERS = 4
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    if tabix_m = 1.
    *CALL METHOD cl_gui_frontend_services=>file_save_dialog
    *CHANGING
    *filename = w_FILE_NAME
    *path     = w_FILE_PATH
    *fullpath = w_FULL_PATH
    ** USER_ACTION =
    ** FILE_ENCODING =
    *EXCEPTIONS
    *CNTL_ERROR = 1
    *ERROR_NO_GUI = 2
    *NOT_SUPPORTED_BY_GUI = 3
    *others = 4
    *IF sy-subrc <> 0.
    *MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    CALL function 'TMP_GUI_BROWSE_FOR_FOLDER'
    EXPORTING
    WINDOW_TITLE = 'Select A File Folder'
    INITIAL_FOLDER = 'C:\'
    IMPORTING
    SELECTED_FOLDER = W_PATH.
    endif.
    CONDENSE W_PATH.
    concatenate W_PATH '\' wa_final-vbeln '.XLS' into w_FULL_PATH.
    ****************************************************************************Saving the PDF file on to Application server************************
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
       BIN_FILESIZE                     = w_bin_filesize
       FILENAME                         = w_FULL_PATH
       FILETYPE                         = 'BIN'
    *   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                      = ' '
    IMPORTING
       FILELENGTH                      = w_filesize
      TABLES
        DATA_TAB                        = t_pdf_tab
    *   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
    As u said ,u want to download a smartform to Excel it could be done but only if u r using a internal table and exactly printing line by line values in the smartform, But if u are performing calculation in between, using multiple internal table Work areas, structures, etc i.e if whole smartform is developed with many distributed windows , unfortunately it wont be possible to download a smartform to excel in such cases, because the whole output comes from multiple internal tables, calculations, etc all the data is not printed in a tabular manner so in such a case it would be just impossible to download the smartform  to excel.
    But we definitely have a workaround which could be done to download the data into excel.
    you can develop a ALV report with a header and footer u can define the header and footer of the alv according to the smartform and the middle portion would contain the tabular kind of data which u must be using as Smartform table to print the same.
    So if u have a similar kind of smartform with some header data, tabular data, and some footer data, then u can use ALV to do the same thing , advantage with ALV would be that u can easily download the same into excel.
    Other alternative is that u can Convert and download the smartform to PDF  and copy the same to an Excel wooksheet.
    These are all the possibilities with which u can do the same.
    Regards,
    Akash Rana

  • Q: XML Publisher build template on Word then Output to Excel file

    Hi All
    When create template on MS-Word then output to Excel file
    When Data Format include percentage then output to Excel The Excel just only show two decimal
    Ex: 9.6549% Excel show ->9.65%
    * Except 9.6549% on Excel *
    Thanks
    Johnson

    Hi
    What version of XML/BI Publisher you have?
    Thanks
    Ravi

  • I have a question about using adobe CS files in CS6 edition

    I am a graphic artist . I have a question about using adobe CS files in CS6 edition. when I am gonna open thse adobe CS created files in CS6 Edition i get a color variation than i made with the CS version.Please give me an idea about this issue as soon as possible.If you need i can upload my problem as a screenshot to clearity

    donrulz,
    Are your Edit>Color Settings the same?
    Are you using spot colours, such as Pantone (there have been some changes in CMYK values with new colour books)?

  • HOW TO DOWNLOAD SAP OUTPUT TO EXCEL FILE

    Hi SAP Gurus,
        I would like to ask if you have any Function Module or codes on how to download SAP Output into Excel file. Thanks! Hope you could help me.

    You can transfer the contents of internal table to excel using this code..
    data: begin of itab occurs 0,
          vbeln like vbak-vbeln,
          posnr like vbap-posnr,
          end of itab.
    select vbeln
           posnr
           from vbap
           up to 20 rows
           into table itab.
    * EXCEL sheet using OLE automation.
    INCLUDE OLE2INCL.
    * handles for OLE objects
    DATA: H_EXCEL TYPE OLE2_OBJECT,        " Excel object
          H_WORK  TYPE OLE2_OBJECT,
          H_SHEET TYPE OLE2_OBJECT,
          H_CELL  TYPE OLE2_OBJECT,
          V_COL   LIKE SY-TABIX.     " column number of the cell
    DATA:
      V_STEP(30),
      V_FILE LIKE RLGRAP-FILENAME.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Creating Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * start Excel
      V_STEP = 'Starting Excel'.
      CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_EXCEL  'Visible' = 1.
    *  CALL METHOD OF H_EXCEL 'OPEN' EXPORTING  #1 = 'C:DMC_REC.XLS'.
    *  PERFORM ERR_HDL.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Adding Data to Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * Get the list of workbooks
      V_STEP = 'Preaparing Excel'.
      CALL METHOD OF H_EXCEL 'WORKBOOKS' = H_WORK.
      PERFORM ERR_HDL.
    ** Add new workbook (create a file)
      CALL METHOD OF H_WORK 'ADD'.
      PERFORM ERR_HDL.
    * Get the created worksheet
    ************************Sheet Number
      CALL METHOD OF H_EXCEL 'WORKSHEETS' = H_SHEET EXPORTING #1 = 3.
    ************************Sheet Number
      PERFORM ERR_HDL.
    * Activate (select) the first sheet
      CALL METHOD OF H_SHEET 'ACTIVATE'.
      PERFORM ERR_HDL.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Adding Data to Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * output column headings to active Excel sheet
      V_STEP = 'Adding data to Excel'.
      LOOP AT ITAB.
        V_COL = SY-TABIX.
        PERFORM FILL_CELL USING 1 V_COL ITAB-vbeln.
        PERFORM FILL_CELL USING 2 V_COL ITAB-posnr.
      ENDLOOP.
      V_STEP = 'Releasing Excel'.
      FREE OBJECT H_EXCEL.
      PERFORM ERR_HDL.
      H_EXCEL-HANDLE = -1.
    *&      Form  ERR_HDL
    *       text
    *  -->  p1        text
    FORM ERR_HDL.
      IF SY-SUBRC <> 0.
        WRITE: / 'Error in processing Excel File:', V_STEP.
        STOP.
      ENDIF.
    ENDFORM.                    " ERR_HDL
    *&      Form  FILL_CELL
    *       text
    *      -->P_1      text
    *      -->P_1      text
    *      -->P_1      text
    FORM FILL_CELL USING  ROW COL VAL.
      CALL METHOD OF H_EXCEL 'Cells' = H_CELL
                     EXPORTING #1 = ROW #2 = COL.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_CELL 'Value' = VAL .
      PERFORM ERR_HDL.
    ENDFORM.                    " FILL_CELL

  • A simple question of output to EXCEL

    Hi, all
    I am using WS_EXCEL to output a interntable to excel file.( filename will be input on dynpro). the file will be created.
    the Problem is, everytime i run the following codes,
    1. the file content is not well formated is poor, words in the column are some aligned at right of the cell , some are at left. how can I defined the alignment?
    2. everytime i create the file, the excel document is opened, can that be avoided ( run in background and file get created?)
    3. everytime i create the file, the old file will be covered, how can I use other sheets of the same file to save the table content?
    thanks a lot!!!
    Fan
    CALL FUNCTION 'WS_EXCEL'
    EXPORTING
       FILENAME      = cfile
      SYNCHRON            = ' '
      TABLES
        data                = tab_ssu
    EXCEPTIONS
       UNKNOWN_ERROR       = 1
       OTHERS              = 2
    cfile = 'c:\tmp\b.xls'

    Hi
    For the question related to alignment and different sheet you need to use OLE .
    Now for ole ,it runs in Foreground ,this will open up the sheet for display.
    Now i can suggest one thing but i am not sure if it is a good way of doing it..You can generate different sheets in background and store it on application server  and while displaying them you can read them one by one and display it on different sheets of same excel.
    please see the reference code for ole....
    **ake refrence fom this programm.
    **& Report ZNEGI9 *
    REPORT ZNEGI9 NO STANDARD PAGE HEADING.
    INCLUDE ole2incl .
    DATA: gs_excel TYPE ole2_object ,
    gs_wbooklist TYPE ole2_object ,
    gs_application TYPE ole2_object ,
    gs_wbook TYPE ole2_object ,
    gs_activesheet TYPE ole2_object ,
    gs_sheets TYPE ole2_object ,
    gs_newsheet TYPE ole2_object ,
    gs_cell1 TYPE ole2_object ,
    gs_cell2 TYPE ole2_object ,
    gs_cells TYPE ole2_object ,
    gs_range TYPE ole2_object ,
    gs_font TYPE ole2_object ,
    gs_interior TYPE ole2_object ,
    gs_columns TYPE ole2_object ,
    gs_charts TYPE ole2_object ,
    gs_chart TYPE ole2_object ,
    gs_charttitle TYPE ole2_object ,
    gs_charttitlechar TYPE ole2_object ,
    gs_chartobjects TYPE ole2_object .
    DATA gv_sheet_name(20) TYPE c .
    DATA gv_outer_index LIKE sy-index .
    DATA gv_intex(2) TYPE c .
    DATA gv_line_cntr TYPE i . "line counter
    DATA gv_linno TYPE i . "line number
    DATA gv_colno TYPE i . "column number
    DATA gv_value TYPE i . "data
    PARAMETERS: p_sheets TYPE i .
    START-OF-SELECTION .
    DO p_sheets TIMES .
    *--Forming sheet name
    gv_intex = sy-index .
    gv_outer_index = sy-index .
    CONCATENATE 'Excel Sheet #' gv_intex INTO gv_sheet_name .
    *--For the first loop, Excel is initiated and one new sheet is added
    IF sy-index = 1 .
    CREATE OBJECT gs_excel 'EXCEL.APPLICATION' .
    SET PROPERTY OF gs_excel 'Visible' = 1 .
    GET PROPERTY OF gs_excel 'Workbooks' = gs_wbooklist .
    GET PROPERTY OF gs_wbooklist 'Application' = gs_application .
    SET PROPERTY OF gs_application 'SheetsInNewWorkbook' = 1 .
    CALL METHOD OF gs_wbooklist 'Add' = gs_wbook .
    GET PROPERTY OF gs_application 'ActiveSheet' = gs_activesheet .
    SET PROPERTY OF gs_activesheet 'Name' = gv_sheet_name .
    *--For the rest of loops, other sheets are added
    ELSE .
    GET PROPERTY OF gs_wbook 'Sheets' = gs_sheets .
    CALL METHOD OF gs_sheets 'Add' = gs_newsheet .
    SET PROPERTY OF gs_newsheet 'Name' = gv_sheet_name .
    ENDIF .
    gv_line_cntr = 1 . "line counter
    *--Title
    *--Selecting cell area to be merged.
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = 1
    #2 = 1.
    CALL METHOD OF gs_excel 'Cells' = gs_cell2
    EXPORTING
    #1 = 1
    #2 = 4.
    CALL METHOD OF gs_excel 'Range' = gs_cells
    EXPORTING
    #1 = gs_cell1
    #2 = gs_cell2.
    CALL METHOD OF gs_cells 'Select' .
    *--Merging
    CALL METHOD OF gs_cells 'Merge' .
    *--Setting title data
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = gv_line_cntr
    #2 = 1.
    SET PROPERTY OF gs_cell1 'Value' = 'KISHAN' .
    *--Formatting the title
    GET PROPERTY OF gs_cell1 'Font' = gs_font .
    SET PROPERTY OF gs_font 'Underline' = 2 .
    SET PROPERTY OF gs_font 'Bold' = 1 .
    SET PROPERTY OF gs_cell1 'HorizontalAlignment' = -4108 .
    GET PROPERTY OF gs_cell1 'Interior' = gs_interior .
    SET PROPERTY OF gs_interior 'ColorIndex' = 15 .
    SET PROPERTY OF gs_interior 'Pattern' = -4124 .
    SET PROPERTY OF gs_interior 'PatternColorIndex' = -4105 .
    gv_line_cntr = gv_line_cntr + 1 .
    *--Writing some additional data for the title
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = gv_line_cntr
    #2 = 1.
    SET PROPERTY OF gs_cell1 'Value' = 'Sheet No' .
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = gv_line_cntr
    #2 = 5.
    SET PROPERTY OF gs_cell1 'Value' = ':' .
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = gv_line_cntr
    #2 = 6.
    SET PROPERTY OF gs_cell1 'Value' = gv_intex .
    *--Formatting the area of additional data 1
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = 1
    #2 = 1.
    CALL METHOD OF gs_excel 'Cells' = gs_cell2
    EXPORTING
    #1 = gv_line_cntr
    #2 = 5.
    CALL METHOD OF gs_excel 'Range' = gs_cells
    EXPORTING
    #1 = gs_cell1
    #2 = gs_cell2.
    CALL METHOD OF gs_cells 'Select' .
    GET PROPERTY OF gs_cells 'Font' = gs_font .
    SET PROPERTY OF gs_font 'Bold' = 1 .
    *--Formatting the area of additional data 2
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = 1
    #2 = 5.
    CALL METHOD OF gs_excel 'Cells' = gs_cell2
    EXPORTING
    #1 = gv_line_cntr
    #2 = 5.
    CALL METHOD OF gs_excel 'Range' = gs_cells
    EXPORTING
    #1 = gs_cell1
    #2 = gs_cell2.
    CALL METHOD OF gs_cells 'Select' .
    GET PROPERTY OF gs_cells 'Columns' = gs_columns .
    CALL METHOD OF gs_columns 'AutoFit' .
    *--Bordering title data area
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = 1
    #2 = 1.
    CALL METHOD OF gs_excel 'Cells' = gs_cell2
    EXPORTING
    #1 = gv_line_cntr
    #2 = 6.
    CALL METHOD OF gs_excel 'Range' = gs_cells
    EXPORTING
    #1 = gs_cell1
    #2 = gs_cell2.
    CALL METHOD OF gs_cells 'Select' .
    CALL METHOD OF gs_cells 'BorderAround'
    EXPORTING
    #1 = 1 "continuous line
    #2 = 4. "thick
    *--Putting axis labels
    gv_colno = 2 .
    gv_line_cntr = gv_line_cntr + 5 .
    gv_linno = gv_line_cntr - 1 .
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = gv_linno
    #2 = 1.
    SET PROPERTY OF gs_cell1 'Value' = 'X' .
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = gv_line_cntr
    #2 = 1.
    SET PROPERTY OF gs_cell1 'Value' = 'Y' .
    *--Generating some data
    DO 3 TIMES .
    gv_value = gv_outer_index * sy-index * 10 .
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = gv_linno
    #2 = gv_colno.
    SET PROPERTY OF gs_cell1 'Value' = sy-index .
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = gv_line_cntr
    #2 = gv_colno.
    SET PROPERTY OF gs_cell1 'Value' = gv_value .
    gv_colno = gv_colno + 1 .
    ENDDO .
    *--Source data area
    gv_colno = gv_colno - 1 .
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING #1 = gv_linno
    #2 = 1.
    CALL METHOD OF gs_excel 'Cells' = gs_cell2
    EXPORTING #1 = gv_line_cntr
    #2 = gv_colno.
    CALL METHOD OF gs_excel 'Range' = gs_cells
    EXPORTING #1 = gs_cell1
    #2 = gs_cell2.
    CALL METHOD OF gs_cells 'Select' .
    GET PROPERTY OF gs_application 'Charts' = gs_charts .
    CALL METHOD OF gs_charts 'Add' = gs_chart .
    CALL METHOD OF gs_chart 'Activate' .
    SET PROPERTY OF gs_chart 'ChartType' = '51' . "Vertical bar graph
    CALL METHOD OF gs_chart 'SetSourceData'
    EXPORTING #1 = gs_cells
    #2 = 1.
    SET PROPERTY OF gs_chart 'HasTitle' = 1 .
    GET PROPERTY OF gs_chart 'ChartTitle' = gs_charttitle .
    GET PROPERTY OF gs_charttitle 'Characters' = gs_charttitlechar .
    SET PROPERTY OF gs_charttitlechar 'Text' = 'Sample Graph' .
    *--Locate the chart onto the current worksheet
    *--Activate current sheet
    CALL METHOD OF gs_excel 'WorkSheets' = gs_activesheet
    EXPORTING #1 = gv_sheet_name.
    CALL METHOD OF gs_activesheet 'Activate' .
    CALL METHOD OF gs_chart 'Location'
    EXPORTING #1 = 2
    #2 = gv_sheet_name.
    *--Reposition the chart on the worksheet (cut&paste)
    CALL METHOD OF gs_activesheet 'ChartObjects' = gs_chartobjects .
    CALL METHOD OF gs_chartobjects 'Select' .
    CALL METHOD OF gs_chartobjects 'Cut' .
    *--Select new area
    gv_line_cntr = gv_line_cntr + 2 .
    CALL METHOD OF gs_excel 'Cells' = gs_cell1
    EXPORTING
    #1 = gv_line_cntr
    #2 = 1.
    CALL METHOD OF gs_excel 'Cells' = gs_cell2
    EXPORTING
    #1 = gv_line_cntr
    #2 = 1.
    CALL METHOD OF gs_excel 'Range' = gs_cells
    EXPORTING
    #1 = gs_cell1
    #2 = gs_cell2.
    CALL METHOD OF gs_cells 'Select' .
    CALL METHOD OF gs_activesheet 'Paste' .
    enddo.
    *--Deallocating memory
    FREE: gs_excel, gs_wbooklist, gs_application, gs_wbook,
    gs_activesheet,gs_sheets, gs_newsheet, gs_cell1,
    gs_cell2, gs_cells, gs_range, gs_font, gs_interior,
    gs_columns, gs_charts, gs_chart, gs_charttitle,
    gs_charttitlechar, gs_chartobjects .
    Edited by: sushilnath shukla on Jul 9, 2008 7:21 PM

  • ALV report output to excel file, zip it and send to email

    my requirement is to run a report then the result will be sent to email. Attachment is an excel file that is zipped since file size is about 25MB
    I've search several forums and found a sap template in sending email with excel file attachment, it is BCS_EXAMPLE_7
    but it should be zipped, what i found is this CL_ABAP_ZIP, but with my understanding, the file needs to be in PDF format to be able to zip
    has anyone had the same requirement before?
    Would be thankful to your input guys, thanks!

    any ideas guys?

  • Problem while downloading the alv output to excel file.

    Hii,
    While downloading the alv output to an excel file i am facing a problem. Either the output comes as 1.23456E+11 or the values get cut .
    Cant put in txt file  as the users require to calculate directy and i have even tried to increase the output length .But both doesnt help.
    So what are the other ways to do so.
    Edited by: mansi_v27 on Mar 24, 2010 12:35 PM

    Hi,
    Welcome to SCN!!!.
    Please go through the forum rules. This has been discussed many times. You can search in the forum for this.
    Infact there is no problem. Just expand that excel cell. You can see the full value. This is standard excel property.
    Thanks,
    Vinod.

  • Regarding ALV output  to Excel file download

    Hi all,
    i had a requirement when downloading the ALV output to the Excel file it should ask for the password.if the user enters the password then this pass word shuld be assigned to the  Excel file that was downloaded.
    Can i know how this can be implemented

    Hi,
    Using EXCEL_OLE_STANDARD_DAT you can specify the PASSWORD & PASSWORD OPTION.
    Regards,
    Sharat

  • Question about using a shared file

    Please feel free to jerk my chain to the right fire hydrant, if I'm in the wrong spot for this question?
    Supposing I want to "share" an excel file located on my server with a work group, and I want to "Admin" cells (add a number, in order to perform a calculation within the spreadsheet) from a remote location via a hand held device with an internet connection, such as a routine inventory of stock. Is this feasable? Could I do this with an iPhone, or some other hand held device?

    Possible? maybe, but it's a lot of work.
    For one, the iPhone can open Excel documents, but it can't edit them. Some Windows Mobile-based devices may be able to but IMHO this is the wrong approach.
    Excel is great for single-user applications. It falls down when you want multiple people to maintain the data. For example - what happens when someone in the office is using the file and your mobile device (whatever that may be) opens the file to make changes? If it even lets you you're almost certainly going to corrupt the file since the office user won't notice the changes you make remotely.
    So for any kind of dynamic data a database-based approach would be better. Some databases include web-based front-ends (so anyone with a web browser can view/edit the data), others have support from multiple script languages such as Perl, PHP, Java, etc. that let you develop your own web front-end.
    For the users that are familiar with Excel, even Excel can pull data from a database to populate the worksheet.

  • Save ALV report output as excel file in background

    Hi all,
    As the no. of records is huge and the running time is long, I'd like to modify my program to be able to run in background mode with excel as output..
    Is there any method to generate the result list in ALV format and save it as an excel file while running the program in background mode?
    And any limitation?
    Thanks!

    Try to create ALV output to spool in background then try to use any of the below mentioned fm
    SAP_CONVERT_TO_XLS_FORMAT
    MS_EXCEL_OLE_STANDARD_DAT
    RSPO_DOWNLOAD_SPOOLJOB
    RH_START_EXCEL_WITH_DATA
    or
    create CSV using OPEN DATASET & TRANSFER

  • Convert report output into excel file

    hiii,
    Can we convert output of report into excel file format?
    Plz tell me the.
    Thanks in advance

    Hello,
    http://download-uk.oracle.com/docs/cd/B14099_17/bi.1012/b13895/orbr_paptoexcel.htm
    29 Building a Report for Spreadsheet Output
    Regards

  • Regarding ME2L - Download output to Excel File

    Hi Friends,
    In ME2L, I have requirement to download the Purchasing Documents Per Vendor Report Output to a Excel File.
    Could be helpful is there any UserExit or Enhancement point to modified or Can let me know how to do this.
    Regards,
    sg.

    Hi,
    Go to me2l tcode.....then change the "Scope of List" into "ALV".....and execute it.....now on the tool bar...click on "LOCAL FILE"....now select the radio button "Spreadsheet".....and perform your work..
    Arunima

Maybe you are looking for