Downloading different internal table data in a single excel with diff tabs.

Hi gurs,
I have 4 internal tables  with me i can able to display in 4 different excel sheets using   CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
But my requirement is i want to download 4 internal table in single excel sheets with different tabs. please send the code if u have.
Thanks and regards.

Hi,
If you want to display the content of 4 internal table in different sheets of same workbook then go through below code,
DATA : EXCEL         TYPE OLE2_OBJECT,
       WORKBOOKS     TYPE OLE2_OBJECT,
       WORKBOOK      TYPE OLE2_OBJECT,
       CELLS         TYPE OLE2_OBJECT,
       SHEET         TYPE OLE2_OBJECT,
       FONT          TYPE OLE2_OBJECT,
       H_COM1        TYPE OLE2_OBJECT,
       F             TYPE RLGRAP-FILENAME,
       FILEP         TYPE DRAW-FILEP,
       G_FILE_DEST   TYPE STRING,
       G_FILE_TEMP   TYPE STRING,
       G_SYSUBRC     TYPE SY-SUBRC,
       G_FILE_SRC    TYPE DRAW-FILEP.
START THE EXCEL APPLICATION
  CREATE OBJECT excel 'EXCEL.APPLICATION'.
  CALL METHOD OF excel 'WORKBOOKS' = workbooks.
  SET PROPERTY OF excel  'VISIBLE' = 0.
  CALL METHOD OF workbooks 'OPEN' EXPORTING
            #1 = filep.
For Sheet1
  CALL METHOD OF excel 'Worksheets' = sheet
   EXPORTING #1 = 1.
  CALL METHOD OF sheet 'Activate'.
  FREE  OBJECT sheet.
  CALL METHOD OF excel 'CELLS' = cells
      EXPORTING #1 = 1
                #2 = 15.
  SET PROPERTY OF cells 'VALUE' = <value>
CALL METHOD OF cells 'FONT' = font.
SET PROPERTY OF font 'SIZE' = '20'.
  FREE OBJECT cells.
For Sheet2
  CALL METHOD OF excel 'Worksheets' = sheet
   EXPORTING #1 = 2.
  CALL METHOD OF sheet 'Activate'.
  FREE  OBJECT sheet.
  CALL METHOD OF excel 'CELLS' = cells
      EXPORTING #1 = 1
                #2 = 6.
  SET PROPERTY OF cells 'VALUE' = 'XYZ'.
  CALL METHOD OF cells 'FONT' = font.
  SET PROPERTY OF font 'SIZE' = '20'.
  GET PROPERTY OF excel 'ACTIVESHEET' = sheet.
  CALL METHOD OF sheet 'SAVEAS' EXPORTING
                  #1 = <destination file path where you want to store>
                  #2 = 1.
  CALL METHOD OF workbooks 'CLOSE'.
  CALL METHOD OF excel 'QUIT'.
  FREE OBJECT excel.
Thanks!
Brunda
'Reward if useful'.

Similar Messages

  • Download internal table data in excel format

    Hi ,
      i have a requirement where i need to download the internal table data in excel format .. I tried using the FM SAP_CONVERT_TO_XLS_FORMAT  but this downloads to excel sheet  same as .txt file foemat without columns ...   i need to have the data in excel sheet with column heading and separated by each coulmn which should be similar as a general sheet with column names and the respective data in the columns . Appreciate any inputs .
    Thanks,
    Latha.

    Hi,
    you can this in Debugging mode,
    say,once you got entire data into ITAB
    salect the TABLE option and provide the table name
    now on the top most you can see excel icon,you click
    on that,now system will prompts you for to the file to be saved.
    Regards,
    Vijaya.

  • How to move large number of internal table data to excel by program

    Hi,
    Iam working on a classical report wherein my requirement is:
    Have around 25 internal tables which I am displaying using a selection screen.I need to transfer this all internal tables data to Excel file by executing.
    Now, let me know how can I transfer all those to excel by execution.
    P.S.: GUI_DOWNLOAD or any other excel download related FMs are used to transfer for single/fewer internal tables.
    But here I need to download 25 internal tables data through program.
    How can I meet the requirement..?
    Kindly advice.
    Thanks,
    Shiv.

    Hi,
    Refer to the following code:
    *& Report  ZDOWNLOAD_PROGRAM
    report  zdownload_program.
    parameter : p_path type rlgrap-filename default 'C:\Pdata.xls'.
    data : gt_output   type standard table of trdirt,
           wa_output   type trdirt,
           p_filen     type string.
    at selection-screen on value-request for p_path.
      clear p_path.
      call function 'F4_FILENAME'
        importing
          file_name = p_path.
    start-of-selection.
      select * from trdirt
               into table gt_output
               where name like 'Z%'
                  or name like 'Y%'.
    end-of-selection.
      move : p_path to p_filen.
      call function 'GUI_DOWNLOAD'
        exporting
      BIN_FILESIZE                    =
          filename                        = p_filen
       filetype                        = 'ASC'
      APPEND                          = ' '
       write_field_separator           =
    cl_abap_char_utilities=>horizontal_tab
      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                        = gt_output
      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.
    Regards
    Rajesh Kumar

  • Exporting Multiple Internal table data to Single Excel file.

    Hello Expert,
      I want to export more than one internal table data from Web Dynpro Application to single Excel file but in such a way that
    each table's data to be get exported to different tabs in (Multiple sheets)  that single excel file.
    So help me in this matter.
    Thank You.
    Varun
    Moderator message: wrong forum, please post again in "Web Dynpro ABAP".
    Edited by: Thomas Zloch on Oct 29, 2010 1:39 PM

    Each table having different sheet in same CSV file .
    A CSV file is a flat file and don't have "Sheets"; you would have to Export to an Excel file, which supports several Sheets in one file.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Call function 'Download' using different internal tables

    Hi everyone!
    i declare 10 different internal tables, with the same structure but different data.
    i need to create 10 different files (one from each internal table)
    i dont want to call 10 times the function download.
    is there someway to put a variable name(that refeer to my internal table)
    something like this.
    PERFORM Create_file USING mytable.
    PERFORM Create_file USING mytable2.
    PERFORM Create_file USING mytable3.
    PERFORM Create_file USING etc....
    FORM create_file USING table.
      DATA: file(128),
            zcancel(1).
      archivo = 'c:\loans.dat'.
      CALL FUNCTION 'DOWNLOAD'
           EXPORTING
                bin_filesize        = ' '
                codepage            = ' '
                filemask_all        = ' '
                filemask_mask       = ' '
                filemask_text       = ' '
                filename            = file
                filetype            = 'dat'
                filetype_no_change  = ' '
                filetype_no_show    = ' '
                item                = ' '
                mode                = ' '
                wk1_n_format        = ' '
                wk1_n_size          = ' '
                wk1_t_format        = ' '
                wk1_t_size          = ' '
           IMPORTING
                cancel              = zcancel
           TABLES
                data_tab            =  <b>TABLE</b>
           EXCEPTIONS
                invalid_filesize    = 01
                invalid_table_width = 02
                invalid_type        = 03
                no_batch            = 04
                unknown_error       = 05.
    ENDFORM.

    Hi,
    Check this example..
    It download t_mara1 & t_mara2..Modify the code according to your requirement..
    DATA: t_mara1  LIKE mara OCCURS 0 WITH HEADER LINE.
    DATA: t_mara2 LIKE mara OCCURS 0 WITH HEADER LINE.
    DATA: v_filename LIKE rlgrap-filename.
    DATA: v_char5(5).
    FIELD-SYMBOLS: <fs> TYPE table.
    DATA: v_variable(30).
    DO 2 TIMES.
      CLEAR: v_filename.
      v_char5 = sy-index.
      SHIFT v_char5 LEFT DELETING LEADING space.
      CONDENSE v_char5.
      CONCATENATE 'C:\TEST' v_char5 '.TXT' INTO v_filename.
      CONCATENATE 'T_MARA' v_char5 '[]' INTO v_variable.
      ASSIGN (v_variable) TO <fs>.
      CALL FUNCTION 'DOWNLOAD'
           EXPORTING
                filename                = v_filename
                filetype                = 'DAT'
           TABLES
                data_tab                = <fs>
           EXCEPTIONS
                invalid_filesize        = 1
                invalid_table_width     = 2
                invalid_type            = 3
                no_batch                = 4
                unknown_error           = 5
                gui_refuse_filetransfer = 6
                customer_error          = 7
                OTHERS                  = 8.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDDO.
    Thanks,
    Naren

  • DATA UPLOAD into 5 Different Internal Tables !!!

    Hi ABAPers,
    I have data in 5 different TABS of an Excel Sheet.
    I have to UPLOAD this data in these different TABS to 5 different Internal tables.
    Can any one give me a solution to this ???

    take data from all internal tabels into final internal table.....and proceed in below way......
    fill ur inetnal table and call call the below form DOWNLOAD_TO_EXCEL, This Form is displaying an internal table it_outtab
    Move data from it_outtab to it_excel
    it_excel will contain all the charecter fields
    DATA : BEGIN OF IT_EXCEL OCCURS 0,
    FLD1(32),
    FLD2(32),
    FLD3(32),
    FLD4(32),
    FLD5(32),
    FLD6(32),
    FLD7(32),
    FLD8(32),
    FLD9(32),
    FLD10(32),
    FLD11(32),
    FLD12(32),
    FLD13(32),
    FLD14(32),
    FLD15(32),
    FLD16(32),
    FLD17(32),
    FLD18(32),
    FLD19(32),
    FLD20(32),
    FLD21(32),
    END OF IT_EXCEL.
    FORM DOWNLOAD_TO_EXCEL.
    PERFORM GET_FILE_NAME .
    CLEAR IT_EXCEL.
    REFRESH IT_EXCEL.
    IF NOT FNAME IS INITIAL .
    PERFORM POPULATE_HEADER_DETAIL.
    LOOP AT IT_OUTTAB.
    IT_EXCEL-FLD1 = IT_OUTTAB-BANFN.
    IT_EXCEL-FLD2 = IT_OUTTAB-BNFPO.
    IT_EXCEL-FLD3 = IT_OUTTAB-EBELN.
    IT_EXCEL-FLD4 = IT_OUTTAB-EBELP.
    IT_EXCEL-FLD5 = IT_OUTTAB-STYLE.
    IT_EXCEL-FLD6 = IT_OUTTAB-SKU.
    IT_EXCEL-FLD7 = IT_OUTTAB-LP_COLOR.
    IT_EXCEL-FLD8 = IT_OUTTAB-MAKTX.
    IT_EXCEL-FLD9 = IT_OUTTAB-CURR_PRICE.
    IF NOT IT_OUTTAB-VALID_FROM IS INITIAL.
    CONCATENATE IT_OUTTAB-VALID_FROM+4(2) '/'
    IT_OUTTAB-VALID_FROM+6(2) '/'
    IT_OUTTAB-VALID_FROM(4) INTO IT_EXCEL-FLD10.
    ENDIF.
    IF NOT IT_OUTTAB-VALID_TO IS INITIAL.
    CONCATENATE IT_OUTTAB-VALID_TO+4(2) '/'
    IT_OUTTAB-VALID_TO+6(2) '/'
    IT_OUTTAB-VALID_TO(4) INTO IT_EXCEL-FLD11.
    ENDIF.
    IT_EXCEL-FLD12 = IT_OUTTAB-FUT_PRICE.
    IT_EXCEL-FLD13 = IT_OUTTAB-FAC_PRICE.
    IF NOT IT_OUTTAB-FAC_VALID_FROM IS INITIAL.
    CONCATENATE IT_OUTTAB-FAC_VALID_FROM+4(2) '/'
    IT_OUTTAB-FAC_VALID_FROM+6(2) '/'
    IT_OUTTAB-FAC_VALID_FROM(4) INTO IT_EXCEL-FLD14.
    ENDIF.
    IF NOT IT_OUTTAB-FAC_VALID_TO IS INITIAL.
    CONCATENATE IT_OUTTAB-FAC_VALID_TO+4(2) '/'
    IT_OUTTAB-FAC_VALID_TO+6(2) '/'
    IT_OUTTAB-FAC_VALID_TO(4) INTO IT_EXCEL-FLD15.
    ENDIF.
    IT_EXCEL-FLD16 = IT_OUTTAB-JPN_PRICE.
    IT_EXCEL-FLD17 = IT_OUTTAB-EAN11_1.
    IT_EXCEL-FLD18 = IT_OUTTAB-EAN11_2.
    IT_EXCEL-FLD19 = IT_OUTTAB-HANG_TAG_STAT.
    IT_EXCEL-FLD20 = IT_OUTTAB-LABEL_STAT.
    IT_EXCEL-FLD21 = IT_OUTTAB-CJI_STAT.
    APPEND IT_EXCEL.
    CLEAR IT_EXCEL.
    ENDLOOP.
    CALL FUNCTION 'RH_START_EXCEL_WITH_DATA'
    EXPORTING
    CHECK_VERSION = ' '
    DATA_NAME = FNAME
    DATA_PATH_FLAG = ''
    DATA_TYPE = 'DAT'
    DATA_BIN_FILE_SIZE =
    MACRO_NAME = ' '
    MACRO_PATH_FLAG = 'E'
    FORCE_START = ' '
    WAIT = ''
    IMPORTING
    WINID =
    TABLES
    DATA_TAB = IT_EXCEL
    EXCEPTIONS
    NO_BATCH = 1
    EXCEL_NOT_INSTALLED = 2
    WRONG_VERSION = 3
    INTERNAL_ERROR = 4
    INVALID_TYPE = 5
    CANCELLED = 6
    DOWNLOAD_ERROR = 7
    OTHERS = 8
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDIF .
    ENDFORM. " DOWNLOAD_TO_EXCEL
    FORM GET_FILE_NAME.
    DATA: TMP_FILENAME LIKE RLGRAP-FILENAME,
    GLOBAL_FILEMASK_ALL(80),
    GLOBAL_FILEMASK_MASK(20), GLOBAL_FILEMASK_TEXT(20),
    GLOBAL_DOWNLOAD_PATH LIKE RLGRAP-FILENAME,
    DEF_PATH LIKE RLGRAP-FILENAME,
    FIELDLN TYPE I,
    MODE TYPE C,
    TMP_MASK LIKE GLOBAL_FILEMASK_ALL.
    FIELD-SYMBOLS: .
    IF GLOBAL_FILEMASK_MASK IS INITIAL.
    TMP_MASK = ',.,..'.
    ELSE.
    TMP_MASK = ','.
    WRITE GLOBAL_FILEMASK_TEXT TO TMP_MASK+1.
    WRITE ',' TO TMP_MASK+21.
    WRITE GLOBAL_FILEMASK_MASK TO TMP_MASK+22.
    WRITE '.' TO TMP_MASK+42.
    CONDENSE TMP_MASK NO-GAPS.
    ENDIF.
    IF NOT GLOBAL_FILEMASK_ALL IS INITIAL.
    TMP_MASK = GLOBAL_FILEMASK_ALL.
    ENDIF.
    FIELDLN = STRLEN( DEF_PATH ) - 1.
    ASSIGN DEF_PATH+FIELDLN(1) TO .
    ENDIF.
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
    DEF_FILENAME = FNAME "rlgrap-filename
    DEF_PATH = DEF_PATH
    MASK = TMP_MASK
    MODE = MODE
    TITLE = ' '
    IMPORTING
    FILENAME = FNAME
    RC =
    EXCEPTIONS
    INV_WINSYS = 01
    NO_BATCH = 02
    SELECTION_CANCEL = 03
    SELECTION_ERROR = 04.
    IF SY-SUBRC = 0.
    FNAME = TMP_FILENAME.
    ELSE.
    ENDIF.
    ENDFORM. " GET_FILE_NAME
    FORM POPULATE_HEADER_DETAIL.
    IT_EXCEL-FLD8 = 'S U D H E E R'.
    APPEND IT_EXCEL.
    CLEAR IT_EXCEL.
    IT_EXCEL-FLD1 = 'Price Validation Report'.
    IT_EXCEL-FLD14 = 'Page'.
    APPEND IT_EXCEL.
    CLEAR IT_EXCEL.
    IT_EXCEL-FLD1 = 'Vendor Number/Name'.
    IT_EXCEL-FLD3 = 'Plan Month'.
    IT_EXCEL-FLD4 = 'Effective In-store-Date'.
    APPEND IT_EXCEL.
    CLEAR IT_EXCEL.
    IT_EXCEL-FLD1 = VENDOR_NAME.
    IT_EXCEL-FLD3 = P_BEDNR.
    IT_EXCEL-FLD4 = P_EFF_DT.
    APPEND IT_EXCEL.
    CLEAR IT_EXCEL.
    sudheer start
    APPEND IT_EXCEL.
    IT_EXCEL-FLD1 = 'PR'.
    IT_EXCEL-FLD2 = 'Line'.
    IT_EXCEL-FLD3 = 'PO'.
    IT_EXCEL-FLD4 = 'PO Line'.
    IT_EXCEL-FLD5 = 'Style'.
    IT_EXCEL-FLD6 = 'SKU'.
    IT_EXCEL-FLD7 = 'Long Color'.
    IT_EXCEL-FLD8 = 'Material Description'.
    IT_EXCEL-FLD9 = 'Current Price'.
    IT_EXCEL-FLD10 = 'validity'.
    IT_EXCEL-FLD11 = 'Period'.
    IT_EXCEL-FLD12 = 'Future Price'.
    IT_EXCEL-FLD13 = 'Factory Price'.
    IT_EXCEL-FLD14 = 'Validity'.
    IT_EXCEL-FLD15 = 'Period'.
    IT_EXCEL-FLD16 = 'Japan Price'.
    IT_EXCEL-FLD17 = 'First UPC'.
    IT_EXCEL-FLD18 = 'Factory UPC'.
    IT_EXCEL-FLD19 = 'Hang Tag Status'.
    IT_EXCEL-FLD20 = 'Label Status'.
    IT_EXCEL-FLD21 = 'CJI Label Status'.
    *sudheer end
    APPEND IT_EXCEL.
    CLEAR IT_EXCEL.
    ENDFORM. " POPULATE_HEADER_DETAIL
    Check these links for sample code :
    http://www.sapdevelopment.co.uk/ms/ms_excel.htm
    please check this example:
    FORM download.
    DATA: lh_file1 TYPE rlgrap-filename,
    lh_file2 TYPE rlgrap-filename,
    lh_file3 TYPE rlgrap-filename,
    lh_datda(1).
    CLEAR: lh_file1, lh_file2, lh_file3.
    Download neue Daten
    CONCATENATE xh_pfad 'Datafile materialmaster new ' sy-datum(4)
    sy-datum4(2) sy-datum6(2) sy-uzeit '.xls' INTO lh_file1.
    working area
    DATA: index TYPE i,
    lh_col TYPE i.
    FIELD-SYMBOLS: .
    SORT xt_bmm00 BY matnr.
    SORT xt_bmmh1 BY matnr.
    SORT xt_bmmh4 BY matnr.
    SORT xt_bmmh7 BY matnr.
    IF NOT xt_bmm00[] IS INITIAL.
    MOVE 'X' TO lh_datda.
    DO 4 TIMES.
    CASE sy-index.
    WHEN 1.
    CREATE OBJECT lh_excel 'EXCEL.APPLICATION' .
    SET PROPERTY OF lh_excel 'Visible' = 1 .
    GET PROPERTY OF lh_excel 'Workbooks' = lh_workbooks .
    GET PROPERTY OF lh_workbooks 'Application' = lh_application .
    SET PROPERTY OF lh_application 'SheetsInNewWorkbook' = 1 .
    CALL METHOD OF lh_workbooks 'Add' = lh_workbook .
    CALL METHOD OF lh_workbook 'Sheets' = lh_sheets .
    CALL METHOD OF lh_sheets 'Item' = lh_sheet
    EXPORTING #1 = sy-index .
    SET PROPERTY OF lh_sheet 'NAME' = 'BMMH7'.
    Überschrift erstellen
    CLEAR xt_ftab.
    REFRESH xt_ftab.
    CALL FUNCTION 'GET_FIELDTAB'
    EXPORTING
    langu = sy-langu
    tabname = '/SIE/TS_MM01S005'
    withtext = ' '
    only = 'T'
    TABLES
    fieldtab = xt_ftab
    EXCEPTIONS
    OTHERS = 1.
    CLEAR lh_col.
    LOOP AT xt_ftab.
    ADD 1 TO lh_col.
    PERFORM fill_cell
    USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
    ENDLOOP.
    LOOP AT xt_bmmh7.
    index = sy-tabix + 1.
    DO 4 TIMES.
    ASSIGN COMPONENT sy-index OF STRUCTURE xt_bmmh7 TO  lh_excel lh_cells.
    ENDIF.
    ENDDO.
    ENDLOOP.
    WHEN 2.
    GET PROPERTY OF lh_workbook 'Sheets' = lh_sheets .
    CALL METHOD OF lh_sheets 'Add' = lh_newsheet .
    SET PROPERTY OF lh_newsheet 'Name' = 'BMMH4'.
    CALL METHOD OF lh_excel 'WorkSheets' = lh_activesheet
    EXPORTING #1 = 'BMMH4'.
    CALL METHOD OF lh_activesheet 'Activate' .
    Überschrift erstellen
    CLEAR xt_ftab.
    REFRESH xt_ftab.
    CALL FUNCTION 'GET_FIELDTAB'
    EXPORTING
    langu = sy-langu
    tabname = '/SIE/TS_MM01S004'
    withtext = ' '
    only = 'T'
    TABLES
    fieldtab = xt_ftab
    EXCEPTIONS
    OTHERS = 1.
    CLEAR lh_col.
    LOOP AT xt_ftab.
    ADD 1 TO lh_col.
    PERFORM fill_cell
    USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
    ENDLOOP.
    LOOP AT xt_bmmh4.
    index = sy-tabix + 1.
    DO 4 TIMES.
    ASSIGN COMPONENT sy-index OF STRUCTURE xt_bmmh4 TO  lh_excel lh_cells.
    ENDIF.
    ENDDO.
    ENDLOOP.
    WHEN 3.
    GET PROPERTY OF lh_workbook 'Sheets' = lh_sheets .
    CALL METHOD OF lh_sheets 'Add' = lh_newsheet .
    SET PROPERTY OF lh_newsheet 'Name' = 'BMMH1'.
    CALL METHOD OF lh_excel 'WorkSheets' = lh_activesheet
    EXPORTING #1 = 'BMMH1'.
    CALL METHOD OF lh_activesheet 'Activate' .
    Überschrift erstellen
    CLEAR xt_ftab.
    REFRESH xt_ftab.
    CALL FUNCTION 'GET_FIELDTAB'
    EXPORTING
    langu = sy-langu
    tabname = '/SIE/TS_MM01S003'
    withtext = ' '
    only = 'T'
    TABLES
    fieldtab = xt_ftab
    EXCEPTIONS
    OTHERS = 1.
    CLEAR lh_col.
    LOOP AT xt_ftab.
    Die folgende Abfrage ist notwendig, weil der Namensraum ZZ...
    in der Struktur nicht erlaubt ist, aber im Excel-Sheet als
    Überschrift gebraucht wird.
    IF xt_ftab-fieldname = 'SPIRIDON'.
    MOVE 'ZZSSN' TO xt_ftab-fieldname.
    ENDIF.
    ADD 1 TO lh_col.
    PERFORM fill_cell
    USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
    ENDLOOP.
    LOOP AT xt_bmmh1.
    index = sy-tabix + 1.
    DO 72 TIMES.
    ASSIGN COMPONENT sy-index OF STRUCTURE xt_bmmh1 TO  lh_excel lh_cells.
    ENDIF.
    ENDDO.
    ENDLOOP.
    WHEN 4.
    GET PROPERTY OF lh_workbook 'Sheets' = lh_sheets .
    CALL METHOD OF lh_sheets 'Add' = lh_newsheet .
    SET PROPERTY OF lh_newsheet 'Name' = 'BMM00'.
    CALL METHOD OF lh_excel 'WorkSheets' = lh_activesheet
    EXPORTING #1 = 'BMM00'.
    CALL METHOD OF lh_activesheet 'Activate' .
    Überschrift erstellen
    CLEAR xt_ftab.
    REFRESH xt_ftab.
    CALL FUNCTION 'GET_FIELDTAB'
    EXPORTING
    langu = sy-langu
    tabname = '/SIE/TS_MM01S002'
    withtext = ' '
    only = 'T'
    TABLES
    fieldtab = xt_ftab
    EXCEPTIONS
    OTHERS = 1.
    CLEAR lh_col.
    LOOP AT xt_ftab.
    ADD 1 TO lh_col.
    PERFORM fill_cell
    USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
    ENDLOOP.
    LOOP AT xt_bmm00.
    index = sy-tabix + 1.
    DO 21 TIMES.
    ASSIGN COMPONENT sy-index OF STRUCTURE xt_bmm00 TO  lh_excel lh_cells.
    ENDIF.
    ENDDO.
    ENDLOOP.
    ENDCASE.
    ENDDO.
    CALL METHOD OF lh_workbook 'SAVEAS'
    EXPORTING #1 = lh_file1.
    CALL METHOD OF lh_excel 'QUIT'.
    FREE OBJECT: lh_cells, lh_sheet, lh_sheets, lh_application,
    lh_workbook, lh_workbooks, lh_excel,
    lh_chart, lh_activesheet.
    ENDIF.
    Download geänderter Materialstammdaten
    CONCATENATE xh_pfad 'Datafile materialmaster change ' sy-datum(4)
    sy-datum4(2) sy-datum6(2) sy-uzeit '.xls' INTO lh_file2.
    IF NOT xt_emmh1[] IS INITIAL.
    MOVE 'X' TO lh_datda.
    DO 2 TIMES.
    CALL METHOD OF lh_sheets 'Item' = lh_sheet
    EXPORTING #1 = sy-index .
    CASE sy-index.
    WHEN 1.
    CREATE OBJECT lh_excel 'EXCEL.APPLICATION' .
    SET PROPERTY OF lh_excel 'Visible' = 1 .
    GET PROPERTY OF lh_excel 'Workbooks' = lh_workbooks .
    GET PROPERTY OF lh_workbooks 'Application' = lh_application .
    SET PROPERTY OF lh_application 'SheetsInNewWorkbook' = 1 .
    CALL METHOD OF lh_workbooks 'Add' = lh_workbook .
    CALL METHOD OF lh_workbook 'Sheets' = lh_sheets .
    CALL METHOD OF lh_sheets 'Item' = lh_sheet
    EXPORTING #1 = sy-index .
    SET PROPERTY OF lh_sheet 'NAME' = 'BMMH7'.
    Überschrift erstellen
    CLEAR xt_ftab.
    REFRESH xt_ftab.
    CALL FUNCTION 'GET_FIELDTAB'
    EXPORTING
    langu = sy-langu
    tabname = '/SIE/TS_MM01S005'
    withtext = ' '
    only = 'T'
    TABLES
    fieldtab = xt_ftab
    EXCEPTIONS
    OTHERS = 1.
    CLEAR lh_col.
    LOOP AT xt_ftab.
    ADD 1 TO lh_col.
    PERFORM fill_cell
    USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
    ENDLOOP.
    LOOP AT xt_emmh7.
    index = sy-tabix + 1.
    DO 4 TIMES.
    ASSIGN COMPONENT sy-index OF STRUCTURE xt_emmh7 TO  lh_excel lh_cells.
    ENDIF.
    ENDDO.
    ENDLOOP.
    WHEN 2.
    GET PROPERTY OF lh_workbook 'Sheets' = lh_sheets .
    CALL METHOD OF lh_sheets 'Add' = lh_newsheet .
    SET PROPERTY OF lh_newsheet 'Name' = 'BMMH1'.
    CALL METHOD OF lh_excel 'WorkSheets' = lh_activesheet
    EXPORTING #1 = 'BMMH1'.
    CALL METHOD OF lh_activesheet 'Activate' .
    Überschrift erstellen
    CLEAR xt_ftab.
    REFRESH xt_ftab.
    CALL FUNCTION 'GET_FIELDTAB'
    EXPORTING
    langu = sy-langu
    tabname = '/SIE/TS_MM01S003'
    withtext = ' '
    only = 'T'
    TABLES
    fieldtab = xt_ftab
    EXCEPTIONS
    OTHERS = 1.
    CLEAR lh_col.
    LOOP AT xt_ftab.
    Die folgende Abfrage ist notwendig, weil der Namensraum ZZ...
    in der Struktur nicht erlaubt ist, aber im Excel-Sheet als
    Überschrift gebraucht wird.
    IF xt_ftab-fieldname = 'SPIRIDON'.
    MOVE 'ZZSSN' TO xt_ftab-fieldname.
    ENDIF.
    ADD 1 TO lh_col.
    PERFORM fill_cell
    USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
    ENDLOOP.
    LOOP AT xt_emmh1.
    index = sy-tabix + 1.
    DO 72 TIMES.
    ASSIGN COMPONENT sy-index OF STRUCTURE xt_emmh1 TO  lh_excel lh_cells.
    ENDIF.
    ENDDO.
    ENDLOOP.
    ENDCASE.
    ENDDO.
    CALL METHOD OF lh_workbook 'SAVEAS'
    EXPORTING #1 = lh_file2.
    CALL METHOD OF lh_excel 'QUIT'.
    FREE OBJECT: lh_cells, lh_sheet, lh_sheets, lh_application,
    lh_workbook, lh_workbooks, lh_excel,
    lh_chart, lh_activesheet.
    ENDIF.
    Download geänderter Texte
    CONCATENATE xh_pfad 'Datafile materialmaster change PO ' sy-datum(4)
    sy-datum4(2) sy-datum6(2) sy-uzeit '.xls' INTO lh_file3.
    IF NOT xt_tmmh7[] IS INITIAL.
    CLEAR: lh_cells, lh_sheet, lh_sheets, lh_application,
    lh_workbook, lh_workbooks, lh_excel,
    lh_chart, lh_activesheet.
    MOVE 'X' TO lh_datda.
    CREATE OBJECT lh_excel 'EXCEL.APPLICATION' .
    SET PROPERTY OF lh_excel 'Visible' = 1 .
    GET PROPERTY OF lh_excel 'Workbooks' = lh_workbooks .
    GET PROPERTY OF lh_workbooks 'Application' = lh_application .
    SET PROPERTY OF lh_application 'SheetsInNewWorkbook' = 1 .
    CALL METHOD OF lh_workbooks 'Add' = lh_workbook .
    CALL METHOD OF lh_workbook 'Sheets' = lh_sheets .
    CALL METHOD OF lh_sheets 'Item' = lh_sheet
    EXPORTING #1 = 1 .
    SET PROPERTY OF lh_sheet 'NAME' = 'BMMH7'.
    Überschrift erstellen
    CLEAR xt_ftab.
    REFRESH xt_ftab.
    CALL FUNCTION 'GET_FIELDTAB'
    EXPORTING
    langu = sy-langu
    tabname = '/SIE/TS_MM01S005'
    withtext = ' '
    only = 'T'
    TABLES
    fieldtab = xt_ftab
    EXCEPTIONS
    OTHERS = 1.
    CLEAR lh_col.
    LOOP AT xt_ftab.
    ADD 1 TO lh_col.
    PERFORM fill_cell
    USING 1 lh_col xt_ftab-fieldname lh_excel lh_cells.
    ENDLOOP.
    LOOP AT xt_tmmh7.
    index = sy-tabix + 1.
    DO 4 TIMES.
    ASSIGN COMPONENT sy-index OF STRUCTURE xt_tmmh7 TO  lh_excel lh_cells.
    ENDIF.
    ENDDO.
    ENDLOOP.
    CALL METHOD OF lh_workbook 'SAVEAS'
    EXPORTING #1 = lh_file3.
    CALL METHOD OF lh_excel 'QUIT'.
    FREE OBJECT: lh_cells, lh_sheet, lh_sheets, lh_application,
    lh_workbook, lh_workbooks, lh_excel,
    lh_chart, lh_activesheet.
    ENDIF.
    IF lh_datda NE 'X'.
    MESSAGE i016.
    ENDIF.
    ENDFORM. " download
    FORM fill_cell USING p_i
    value
    p_customer_cell1
    h_excel
    h_cells.
    CALL METHOD OF h_excel 'Cells' = h_cells EXPORTING #1 = p_i #2 = value.
    SET PROPERTY OF lh_cells 'Numberformat' = '@'.
    SET PROPERTY OF h_cells 'Value' = p_customer_cell1.
    ENDFORM. " fill_cell

  • How to download internal table data to .xlsx file ?

    Hello All,
    I am using SAP ECC 6.0. I need to download internal table data to .xlsx file.
    I tried GUI_DOWNLOAD, all the data are getting transferred to the .xlsx file, but while opening I am getting the below error.
    Excel cannot open the file "download.xlsx" because file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file.
    Though Microsoft office 2007 is installed in my system.
    Please help <removed by moderator>.
    Edited by: Thomas Zloch on Oct 24, 2011 10:55 AM

    Hi,
    Please find the below code to download data into excel file.
      DATA: ld_filename TYPE string,
            ld_path TYPE string,
            ld_fullpath TYPE string,
            ld_result TYPE i.
    Display save dialog window
      CALL METHOD cl_gui_frontend_services=>file_save_dialog
        EXPORTING
         window_title      = ' '
          DEFAULT_EXTENSION = 'XLS'
          default_file_name = 'accountsdata'
          INITIAL_DIRECTORY = 'c:\temp\'
        CHANGING
          filename          = ld_filename
          path              = ld_path
          fullpath          = ld_fullpath
          user_action       = ld_result.
    Check user did not cancel request
      CHECK ld_result EQ '0'.
      CALL FUNCTION 'GUI_DOWNLOAD'
       EXPORTING
            filename         = ld_fullpath
            filetype         = 'ASC'
          APPEND           = 'X'
            write_field_separator = 'X'
          CONFIRM_OVERWRITE = 'X'
       TABLES
            data_tab         = it_datatab[]     "need to declare and populate
       EXCEPTIONS
            file_open_error  = 1
            file_write_error = 2
            OTHERS           = 3.
    Thanks and Regards
    Chitra

  • How to insert  data from different internal  table  into a data base table

    hi all,
             I want to insert a particular field in an internal table to a field in a data base table.Note that the fields in the internal table and database table are not of the same name since i need to insert data from different internal tables.can some one tell me how to do this?
    in short i want to do something like the foll:
    INSERT  INTO ZMIS_CODES-CODE VALUE '1'.
    *INSERT INTO ZMIS_CODES-COL1 VALUE DATA_MTD-AUFNR .(zmis_codes is the db table and data_mtd is the int.table)

    REPORT  ZINSERT.
    tables kna1.
    data: itab LIKE KNA1.
    data lv_kUNAG LIKE KNA1-KUNNR.
    lv_kuNAG =  '0000010223'.
    ITAB-kuNNR = lv_kuNAG.
    ITAB-name1 = 'XYZ'.
    INSERT INTO KNA1 VALUES ITAB.
    IF SY-SUBRC = 0.
    WRITE:/ 'SUCCESS'.
    ELSE.
    WRITE:/ 'FAILED'.
    ENDIF.
    Here lv_kunag is ref to kna1 kunnr passed in different name
    In internal table .
    Try and let me know if this logic dint work.

  • Download internal table data to Excel in background

    Hi all ,
      Can anyone tell that how i can download internal table data
    into Excel sheet  in Backgroud Mode .
    I used both fun mod  ws and gui download but these are not working in background mod .
    Please help  issue is urgent .
    Answer is rewarded  by point .
    With Regards ,
    Nilesh Jain

    hi,
    you have to use  function module 'SAP_CONVERT_TO_XLS_FORMAT'.
    DATA:
    ITAB1 TYPE TRUXS_T_TEXT_DATA.
    CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
    EXPORTING
      I_FIELD_SEPERATOR          = ';'
      I_LINE_HEADER              =
       i_filename                 = filename
      I_APPL_KEEP                = ' '
    tables
       i_tab_sap_data             = itab
    CHANGING
      I_TAB_CONVERTED_DATA       = itab1
    EXCEPTIONS
      CONVERSION_FAILED          = 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.
    try this one.
    reward points if useful,
    thanks & regards,
    rajee.

  • Download internal table data into excel sheet with column heading and data

    Hi,
      I am having one internal table with column headings and other table with data.
    i want to download the data with these tables into an excel sheet.
    It should ask the user for file name to save it on their own name. They should give the file name in runtime and it should be downloaded into an excel sheet.
    Can anyone tell what is the right function module for downloading these two internal table data with column heading and data.
    what we have to do for storing the file name in runtime.
    Can anyone help me on this.
    Thanks,
    Rose.

    Hi Camila,
        Try this
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        FILENAME                        = PATH2
       FILETYPE                        = 'XLS'
      TABLES
        DATA_TAB                        = IT_DATA
       FIELDNAMES                      = IT_HEADINGS
    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

  • Passing data to different internal tables with different columns from a comma delimited file

    Hi,
    I have a program wherein we upload a comma delimited file and based on the region( we have drop down in the selection screen to pick the region).  Based on the region, the data from the file is passed to internal table. For region A, we have 10 columns and for region B we have 9 columns.
    There is a split statement (split at comma) used to break the data into different columns.
    I need to add hard error messages if the no. of columns in the uploaded file are incorrect. For example, if the uploaded file is of type region A, then the uploaded file should be split into 10 columns. If the file contains lesser or more columns thenan error message should be added. Similar is the case with region B.
    I do not want to remove the existing split statement(existing code). Is there a way I can exactly pass the data into the internal table accurately? I have gone through some posts where in they have made use of the method cl_alv_table_create=>create_dynamic_table by passing the field catalog. But I cannot use this as I have two different internal tables to be populated based on the region. Appreciate help on this.
    Thanks,
    Pavan

    Hi Abhishek,
    I have no issues with the rows. I have a file with format like a1,b1,c1,d1,e1, the file should be uploaded and split at comma. So far its fine. After this, if the file is related to region A say Asia, then it should have 5 fields( as an example). So, all the 5 values a1,b1..e1 will be passed to 5 fields of itab1.
    I also have region B( say Europe)  whose file will have only 4 fields. So, file is of the form a2,b2,c2,d2. Again data is split at comma and passed to itab2.
    If some one loads file related to Asia and the file has only 4 fields  then the data would be incorrect. Similar is the case when someone tries to load Europe file with 5 fields related data. To avoid this, I want to validate the data uploaded. For this, I want to count the no. of fields (seperated by comma). If no. of fields is 5 then the file is related to Asia or if no. of fields is 4 then it is Europe file.
    Well, the no. of commas is nothing but no. of fields - 1. If the file is of the form a1,b1..e1 then I can say like if no. of commas = 4 then it is File Asia.But I am not sure how to write a code for this.Please advise.
    Thanks,
    Pavan

  • How to download internal table data into xml file?

    Hi,
    Experts,
    I have downloaded internal table data into XLS format using GUI_DOWNLOAD Function module, But i didn't Know how to download internal table data into XML format please post some ideas/inputs on this issue.
    Thank you,
    Shabeer ahmed.

    check this
    data : gd_repid type sy-repid.
    GD_REPID = SY-REPID.
    DATA : L_DOM TYPE REF TO IF_IXML_ELEMENT,
           M_DOCUMENT TYPE REF TO IF_IXML_DOCUMENT,
           G_IXML TYPE REF TO IF_IXML,
           W_STRING TYPE XSTRING,
           W_SIZE TYPE I,
           W_RESULT TYPE I,
           W_LINE TYPE STRING,
           IT_XML TYPE DCXMLLINES,
           S_XML LIKE LINE OF IT_XML,
           W_RC LIKE SY-SUBRC.
    DATA: XML TYPE DCXMLLINES.
    DATA: RC TYPE SY-SUBRC,
          BEGIN OF XML_TAB OCCURS 0,
          D LIKE LINE OF XML,
          END OF XML_TAB.
    data : l_element           type ref to if_ixml_element,
           xml_ns_prefix_sf     type string,
           xml_ns_uri_sf        type string.
    CLASS CL_IXML DEFINITION LOAD.
    G_IXML = CL_IXML=>CREATE( ).
    CHECK NOT G_IXML IS INITIAL.
    M_DOCUMENT = G_IXML->CREATE_DOCUMENT( ).
    CHECK NOT M_DOCUMENT IS INITIAL.
    CALL FUNCTION 'SDIXML_DATA_TO_DOM'
    EXPORTING
       NAME = 'REPAIRDATA'
       DATAOBJECT = IT_FINAL_LAST1[]
    IMPORTING
       DATA_AS_DOM = L_DOM
    CHANGING
       DOCUMENT = M_DOCUMENT
    EXCEPTIONS
       ILLEGAL_NAME = 1
       OTHERS = 2.
    CHECK NOT L_DOM IS INITIAL.
    W_RC = M_DOCUMENT->APPEND_CHILD( NEW_CHILD = L_DOM ).
    *Start of code for Header
    * namespace
    t_mnr = sy-datum+4(2).
    CALL FUNCTION 'IDWT_READ_MONTH_TEXT'
      EXPORTING
        LANGU         = 'E'
        MONTH         = t_mnr
    IMPORTING
       T247          = wa_t247
    concatenate sy-datum+6(2)
                wa_t247-ktx
                sy-datum(4) into t_var1.
    concatenate sy-uzeit(2)
                sy-uzeit+2(2)
                sy-uzeit+4(2) into t_var2.
    clear : xml_ns_prefix_sf,
            xml_ns_uri_sf.
    l_element  = m_document->get_root_element( ).
    xml_ns_prefix_sf = 'TIMESTAMP'.
    concatenate t_var1 t_var2 into xml_ns_uri_sf separated by space.
    clear : t_var1,
            t_var2,
            t_mnr,
            wa_t247.
    l_element->set_attribute( name  = xml_ns_prefix_sf
                              namespace = ' '
                              value = xml_ns_uri_sf ).
    clear : xml_ns_prefix_sf,
            xml_ns_uri_sf.
    xml_ns_prefix_sf  = 'FILECREATOR'.
    xml_ns_uri_sf    =   'SAP'.
    l_element->set_attribute( name  = xml_ns_prefix_sf
                              namespace = ' '
                              value = xml_ns_uri_sf ).
    clear : xml_ns_prefix_sf,
            xml_ns_uri_sf.
    xml_ns_prefix_sf  = 'CLAIMGROUP'.
    xml_ns_uri_sf    = '1'.
    l_element->set_attribute( name  = xml_ns_prefix_sf
                              namespace = ' '
                              value = xml_ns_uri_sf ).
    clear : xml_ns_prefix_sf,
            xml_ns_uri_sf.
    xml_ns_prefix_sf  = 'CLAIMTYPES'.
    xml_ns_uri_sf    = 'W'.
    l_element->set_attribute( name  = xml_ns_prefix_sf
                              namespace = ' '
                              value = xml_ns_uri_sf ).
    *End of Code for Header
    CALL FUNCTION 'SDIXML_DOM_TO_XML'
    EXPORTING
      DOCUMENT = M_DOCUMENT
    IMPORTING
      XML_AS_STRING = W_STRING
      SIZE = W_SIZE
    TABLES
      XML_AS_TABLE = IT_XML
    EXCEPTIONS
      NO_DOCUMENT = 1
      OTHERS = 2.
    LOOP AT IT_XML INTO XML_TAB-D.
    APPEND XML_TAB.
    ENDLOOP.
    *Start of Code for File name
    concatenate p_file
                '\R'
                '000_119481'
                sy-datum+6(2) sy-datum+4(2) sy-datum+2(2)
                sy-uzeit(2)   sy-uzeit+2(2) sy-uzeit(2) '.xml' into p_file.
    *End of Code for File name
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      BIN_FILESIZE = W_SIZE
      FILENAME = p_file
      FILETYPE = 'BIN'
    TABLES
      DATA_TAB = XML_TAB
    EXCEPTIONS
      OTHERS = 10.
    IF SY-SUBRC  = 0.
                  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

  • 2 different  tables   in the main window with same internal table data

    Hi All,
    can we have 2 diffterent  tables with same internal table data into its work area in the main window.Is it possible or we will get any run time error.?
    is it like having 2 nested loop with same internal table ?
    ex : loop at itab1 into wa_itab.
           loop at itab1 into wa_itab.
    endloop.
    endloop.
    can we use like this?

    Hi,
    there will not be any error ...but what is the use of it...
    do you need to have a controlled way of display ...of the data...
    If so then you create another workarea in the global definitions of the same type and then use it...
    Regards,
    Ram

  • Internal table data 1E2 automatically convert to scientific format

    Dear all,
    I have been searched for solution moths from the forums and tried all possible methods, but still no way to solve my above problem.  I found a way to solve it partially for us, but may be very helpful for others who meet similly case like mine, so I posted here.
    my problem is when I export my internal table data to Excel, the Cell data with 1E2 auto becomes 1.00E02, and 1E8 becomes 1.00E08, we need it to be 1E2 and 1E8 in excel.
    you can recreate my problem by
    1,  input 1E2 into your Microsoft Excel, then Enter, it will auto change into scientific format. which is we do not want.
    2, use any of your SAP system open any table as long as there is a Char (>3) field in that table. add some
    data entry in that field in the form "any amount (<15) of numeric 1 to 9"E"any one or two numeric 1 to 9". such as, 123E2, 1234E12 etc. then save this table's data to local file spread sheet, or use any FM to download it to a Excel file, when you open this
    file by Excel, the cell with above form will display as scientific. but
    if you put three or more numeric after the "E", such as 123E123 it will
    display correctly.
    what I have done:
    I searched in SCN for similar thread:
        Export to Excel 2007 - item number problem
        Exceding the limit of numbers in Excel at target side
        Excel download cell format problem
        Formating as Text in excel through SAP
        Converting of amount field into excel file through GUI DOWNLOAD
        Data downloaded to excel gets converted to exponential format.
        Problem with Excel download   and scientific number
        Re: Issue in displaying numbers in Excel?
        CSV Flat File Data Problem (Number converting to Scientific Notation)
    Tested accordingly, But none of these works in our case. because our
    ultimate receiver of email attachment will be external third party, we cannot ask
    them to change anything in their Excel.
    Search Microsoft help about Excel, http://support.microsoft.com/kb/214233,
    and it says this "Automatic Number Formatting" is a normal behaviour of excel.
    no way to turn it off, the "work-around" way that Microsoft provides is not suitable for our
    case.
    We test CL_iXML recently arrording to weblog http://wiki.sdn.sap.com/wiki/display/Snippets/FormattedExcelasEmailAttachment
    it successful controled the format. so this could be a solution for others whose internal table size is small. but our 2MB internal table bocome 6MB when converted to xml file attachment, which cannot be received by our end user's mail box. too big.
    So please advise your ideas.
    Many thanks in advance!
    Peter Ding
    Thank you very much for your time!

    Hi,
    You can achieve this by describing the spreadsheet in XML with the help of the DOM classes.
    The later releases of Excel can read and save spreadsheets as XML, providing your release supports this you can achieve it.
    Check out the following Wiki
    [Excel - XML|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/exporting%2bdata%2bto%2bexcel%2b-%2bxml%2bto%2bthe%2brescue]
    Regards,
    Darren

  • Internal Table Data to XML

    Hi
    I have a requirement of writing internal table data to XML. Any idea where i should start.
    I have pretty good experience with ABAP and basic knowledge in XML.
    There are good blogs which talk about transformations and other stuff but they are not able to give me clear path to my solution.
    Could somebody give me a basic example or some reference material where i can move the data in internal table (assume Sales order details of a day) to XML.
    Thanks

    Refer the program -
    In this implementation we will only focus on the creation of the XML file and the transfer to the user. You can not create a XML document directly. You have to use a so called ixml factory first. 
    TYPE-POOLS: ixml.
    DATA: l_ixml TYPE REF TO if_ixml.
    l_ixml = cl_ixml=>create( ).
    This iXML factory can create an empty XML document object named l_document.
    DATA:  l_document TYPE REF TO if_ixml_document.
            l_document = l_ixml->create_document( ).
    At this point you can add the nodes (elements, attributes) into the document. First you have to declare the root element node.
    DATA: l_element_root TYPE REF TO if_ixml_element.
    This node we have to give a name and add it (create_simple_node) to the document object l_document, which will be the parent of this node.
    l_element_root  = l_document->create_simple_element(
                name = 'flights'
              parent = l_document ).
    Next we can add child nodes to there parent node using the same method of the document object.
    DATA: l_element_airline TYPE REF TO if_ixml_element,
    l_element_airline  = l_document->create_simple_element(
                   name = 'airline'
                 parent = l_element_root  ).
    An attribute can be add easily using the method set_attribute of the element node.
    l_rc = l_element_airline->set_attribute( name = 'code' value = 'LH401' ).
    Now we have finished the document object. Regretfully it can not be displayed in any form due to the fact that it is a binary object. 
    The next step is to convert the created document to a flat file. To achieve this we have to create a stream factory, which will help us to create an output stream.
    DATA: l_streamfactory   TYPE REF TO if_ixml_stream_factory.
    l_streamfactory = l_ixml->create_stream_factory( ).
    In this case, we will convert the document into an output stream which is based on an internal table of type x.
    TYPES: BEGIN OF xml_line,
              data(256) TYPE x,
            END OF xml_line.
    DATA:  l_xml_table       TYPE TABLE OF xml_line,
            l_xml_size        TYPE i,
            l_rc              TYPE i,
            l_ostream         TYPE REF TO if_ixml_ostream.
    l_ostream = l_streamfactory->create_ostream_itable( table = l_xml_table ).
    When we have created the output stream we can do the rendering from the document into the stream. The XML data will be stored in the internal table automatically.
    DATA: l_renderer        TYPE REF TO if_ixml_renderer.
    l_renderer = l_ixml->create_renderer( ostream  = l_ostream
                            & nbsp;              document = l_document ).
    l_rc = l_renderer->render( ).
    In the last step we upload the file to the sapgui
    l_xml_size = l_ostream->get_num_written_raw( ).
    CALL METHOD cl_gui_frontend_services=>gui_download
       EXPORTING
         bin_filesize = l_xml_size
         filename     = 'c:\temp\flights.xml'
         filetype     = 'BIN'
       CHANGING
         data_tab     = l_xml_table
       EXCEPTIONS
         OTHERS       = 24.
    This finished the first step-of-three. As mentioned before the next log will focus on the conversion from xml files (back) to abap tables.
    REPORT  z_xit_xml_dom_create.
      TYPE-POOLS: ixml.
      TYPES: BEGIN OF xml_line,
              data(256) TYPE x,
             END OF xml_line.
      DATA: l_ixml            TYPE REF TO if_ixml,
            l_streamfactory   TYPE REF TO if_ixml_stream_factory,
            l_ostream         TYPE REF TO if_ixml_ostream,
            l_renderer        TYPE REF TO if_ixml_renderer,
            l_document        TYPE REF TO if_ixml_document.
      DATA: l_element_flights TYPE REF TO if_ixml_element,
            l_element_airline TYPE REF TO if_ixml_element,
            l_element_flight  TYPE REF TO if_ixml_element,
            l_element_from    TYPE REF TO if_ixml_element,
            l_element_to      TYPE REF TO if_ixml_element,
            l_element_dummy   TYPE REF TO if_ixml_element,
            l_value           TYPE string.
      DATA: l_xml_table       TYPE TABLE OF xml_line,
            l_xml_size        TYPE i,
            l_rc              TYPE i.
      DATA: lt_spfli          TYPE TABLE OF spfli.
      DATA: l_spfli           TYPE spfli.
      START-OF-SELECTION.
      Fill the internal table
        SELECT * FROM spfli INTO TABLE lt_spfli.
      Sort internal table
        SORT lt_spfli BY carrid.
      Start filling xml dom object from internal table
        LOOP AT lt_spfli INTO l_spfli.
          AT FIRST.
          Creating a ixml factory
            l_ixml = cl_ixml=>create( ).
          Creating the dom object model
            l_document = l_ixml->create_document( ).
          Fill root node with value flights
            l_element_flights  = l_document->create_simple_element(
                        name = 'flights'
                        parent = l_document ).
          ENDAT.
          AT NEW carrid.
          Create element 'airline' as child of 'flights'
            l_element_airline  = l_document->create_simple_element(
                        name = 'airline'
                        parent = l_element_flights  ).
          Create attribute 'code' of node 'airline'
            l_value = l_spfli-carrid.
            l_rc = l_element_airline->set_attribute( name = 'code' value = l_value ).
          Create attribute 'name' of node 'airline'
            SELECT SINGLE carrname FROM scarr INTO l_value WHERE carrid EQ l_spfli-carrid.
            l_rc = l_element_airline->set_attribute( name = 'name' value = l_value ).
          ENDAT.
          AT NEW connid.
          Create element 'flight' as child of 'airline'
            l_element_flight  = l_document->create_simple_element(
                        name = 'flight'
                        parent = l_element_airline  ).
          Create attribute 'number' of node 'flight'
            l_value = l_spfli-connid.
            l_rc = l_element_flight->set_attribute( name = 'number' value = l_value ).
          ENDAT.
        Create element 'from' as child of 'flight'
          CONCATENATE l_spfli-cityfrom ',' l_spfli-countryfr INTO l_value.
          l_element_from  = l_document->create_simple_element(
                      name = 'from'
                      value = l_value
                      parent = l_element_flight  ).
        Create attribute 'airport' of node 'from'
          l_value = l_spfli-airpfrom.
          l_rc = l_element_from->set_attribute( name = 'airport' value = l_value ).
        Create element 'to' as child of 'flight'
          CONCATENATE l_spfli-cityto ',' l_spfli-countryto INTO l_value.
          l_element_to  = l_document->create_simple_element(
                      name = 'to'
                      value = l_value
                      parent = l_element_flight  ).
        Create attribute 'airport' of node 'from'
          l_value = l_spfli-airpto.
          l_rc = l_element_to->set_attribute( name = 'airport' value = l_value ).
        Create element 'departure' as child of 'flight'
          l_value = l_spfli-deptime.
          l_element_dummy  = l_document->create_simple_element(
                      name = 'departure'
                      value = l_value
                      parent = l_element_flight ).
        Create element 'arrival' as child of 'flight'
          l_value = l_spfli-arrtime.
          l_element_dummy  = l_document->create_simple_element(
                      name = 'arrival'
                      value = l_value
                      parent = l_element_flight ).
        Create element 'type' as child of 'flight'
          CASE l_spfli-fltype.
            WHEN 'X'.
              l_value = 'Charter'.
            WHEN OTHERS.
              l_value = 'Scheduled'.
          ENDCASE.
          l_element_dummy  = l_document->create_simple_element(
                      name = 'type'
                      value = l_value
                      parent = l_element_flight ).
        ENDLOOP.
        IF sy-subrc NE 0.
          MESSAGE 'No data into db table ''spfli'', please run program ''SAPBC_DATA_GENERATOR'' with transaction ''SA38''' TYPE 'E'.
        ENDIF.
      Creating a stream factory
        l_streamfactory = l_ixml->create_stream_factory( ).
      Connect internal XML table to stream factory
        l_ostream = l_streamfactory->create_ostream_itable( table = l_xml_table ).
      Rendering the document
        l_renderer = l_ixml->create_renderer( ostream  = l_ostream
                                              document = l_document ).
        l_rc = l_renderer->render( ).
      Saving the XML document
        l_xml_size = l_ostream->get_num_written_raw( ).
        CALL METHOD cl_gui_frontend_services=>gui_download
          EXPORTING
            bin_filesize = l_xml_size
            filename     = 'c:\temp\flights.xml'
            filetype     = 'BIN'
          CHANGING
            data_tab     = l_xml_table
          EXCEPTIONS
            OTHERS       = 24.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                     WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    <?xml version="1.0"?>
    <flights>
         <airline code="AA" name="American Airlines">
              <flight number="0017">
                   <from airport="JFK">NEW YORK,US</from>
                   <to airport="SFO">SAN FRANCISCO,US</to>
                   <departure>110000</departure>
                   <arrival>140100</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0064">
                   <from airport="SFO">SAN FRANCISCO,US</from>
                   <to airport="JFK">NEW YORK,US</to>
                   <departure>090000</departure>
                   <arrival>172100</arrival>
                   <type>Scheduled</type>
              </flight>
         </airline>
         <airline code="AZ" name="Alitalia">
              <flight number="0555">
                   <from airport="FCO">ROME,IT</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>190000</departure>
                   <arrival>210500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0788">
                   <from airport="FCO">ROME,IT</from>
                   <to airport="TYO">TOKYO,JP</to>
                   <departure>120000</departure>
                   <arrival>085500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0789">
                   <from airport="TYO">TOKYO,JP</from>
                   <to airport="FCO">ROME,IT</to>
                   <departure>114500</departure>
                   <arrival>192500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0790">
                   <from airport="FCO">ROME,IT</from>
                   <to airport="KIX">OSAKA,JP</to>
                   <departure>103500</departure>
                   <arrival>081000</arrival>
                   <type>Charter</type>
              </flight>
         </airline>
         <airline code="DL" name="Delta Airlines">
              <flight number="1984">
                   <from airport="SFO">SAN FRANCISCO,US</from>
                   <to airport="JFK">NEW YORK,US</to>
                   <departure>100000</departure>
                   <arrival>182500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="1699">
                   <from airport="JFK">NEW YORK,US</from>
                   <to airport="SFO">SAN FRANCISCO,US</to>
                   <departure>171500</departure>
                   <arrival>203700</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0106">
                   <from airport="JFK">NEW YORK,US</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>193500</departure>
                   <arrival>093000</arrival>
                   <type>Scheduled</type>
              </flight>
         </airline>
         <airline code="JL" name="Japan Airlines">
              <flight number="0407">
                   <from airport="NRT">TOKYO,JP</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>133000</departure>
                   <arrival>173500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0408">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="NRT">TOKYO,JP</to>
                   <departure>202500</departure>
                   <arrival>154000</arrival>
                   <type>Charter</type>
              </flight>
         </airline>
         <airline code="LH" name="Lufthansa">
              <flight number="2407">
                   <from airport="TXL">BERLIN,DE</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>071000</departure>
                   <arrival>081500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="2402">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="SXF">BERLIN,DE</to>
                   <departure>103000</departure>
                   <arrival>113500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0402">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="JFK">NEW YORK,US</to>
                   <departure>133000</departure>
                   <arrival>150500</arrival>
                   <type>Charter</type>
              </flight>
              <flight number="0401">
                   <from airport="JFK">NEW YORK,US</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>183000</departure>
                   <arrival>074500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0400">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="JFK">NEW YORK,US</to>
                   <departure>101000</departure>
                   <arrival>113400</arrival>
                   <type>Scheduled</type>
              </flight>
         </airline>
         <airline code="QF" name="Qantas Airways">
              <flight number="0005">
                   <from airport="SIN">SINGAPORE,SG</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>225000</departure>
                   <arrival>053500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0006">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="SIN">SINGAPORE,SG</to>
                   <departure>205500</departure>
                   <arrival>150500</arrival>
                   <type>Scheduled</type>
              </flight>
         </airline>
         <airline code="SQ" name="Singapore Airlines">
              <flight number="0988">
                   <from airport="SIN">SINGAPORE,SG</from>
                   <to airport="TYO">TOKYO,JP</to>
                   <departure>163500</departure>
                   <arrival>001500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0158">
                   <from airport="SIN">SINGAPORE,SG</from>
                   <to airport="JKT">JAKARTA,ID</to>
                   <departure>152500</departure>
                   <arrival>160000</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0015">
                   <from airport="SFO">SAN FRANCISCO,US</from>
                   <to airport="SIN">SINGAPORE,SG</to>
                   <departure>160000</departure>
                   <arrival>024500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="0002">
                   <from airport="SIN">SINGAPORE,SG</from>
                   <to airport="SFO">SAN FRANCISCO,US</to>
                   <departure>170000</departure>
                   <arrival>192500</arrival>
                   <type>Scheduled</type>
              </flight>
         </airline>
         <airline code="UA" name="United Airlines">
              <flight number="0941">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="SFO">SAN FRANCISCO,US</to>
                   <departure>143000</departure>
                   <arrival>170600</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="3504">
                   <from airport="SFO">SAN FRANCISCO,US</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>150000</departure>
                   <arrival>103000</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="3516">
                   <from airport="JFK">NEW YORK,US</from>
                   <to airport="FRA">FRANKFURT,DE</to>
                   <departure>162000</departure>
                   <arrival>054500</arrival>
                   <type>Scheduled</type>
              </flight>
              <flight number="3517">
                   <from airport="FRA">FRANKFURT,DE</from>
                   <to airport="JFK">NEW YORK,US</to>
                   <departure>104000</departure>
                   <arrival>125500</arrival>
                   <type>Scheduled</type>
              </flight>
         </airline>
    </flights>
    Regards,
    Amit
    Reward all helpful replies.

Maybe you are looking for

  • Can I separate out for analysis multiple responses to one question?

    I created my first survey without realizing that by creating a question that allows the respondent to choose multiple responses, I might have a problem parsing out the responses for analysis.  I have been downloading (exporting) the responses into an

  • Deploy Applet

    I followed the deployment instructions in book 'Oracle JDeveloper'.--However, I am using JBuilder deployment wizard. 1. extract borland.jbcl.control.image and borland.jbcl.control.view.image to my project 2. to include all dependency classes 3. I als

  • BPEL process to receive CSV file in SOAP attachmnet

    Hi , I have a requirement where i need to develop a BPEL process that receives a CSV file in a SOAP attachment. The BPEL process ahould take the CSV file from the attachment and store it in a local Directory. Thanks in advance.

  • Err :  java.lang.reflect.InvocationTargetException:

    Hi all - I get the following error when I start my weblogic 5.1. Could anyone give any suggestion on that. Thanks. Saiyed. The WebLogic Server did not start up properly. Exception raised: java.lang.reflect.InvocationTargetException java.lang.reflect.

  • Error 53 on iPhone 6

    Hi Guys,  I´m having an error 53 when tried to upgrade my iPhone 6 but is stucked in recovery mode. I´ve tried in 2 different computers (Mac and Windows).  I also tried every step in the errors apple support article and its still stucked. I don't kno