<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: to send data to excel in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/to-send-data-to-excel/m-p/2540345#M577190</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Anand,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        Either in Report or in MPP u'l be having thedata to be transported to XL in the Internal Table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT ztest1 .
 
 
 
 
 
* this report demonstrates how to send some ABAP data to an
 
* EXCEL sheet using OLE automation.
 
include ole2incl.
 
* handles for OLE objects
 
data: h_excel type ole2_object,        " Excel object
 
      h_mapl type ole2_object,         " list of workbooks
 
      h_map type ole2_object,          " workbook
 
      h_zl type ole2_object,           " cell
 
      h_f type ole2_object,            " font
 
      h_c type ole2_object.            " color
 
 
 
DATA: FILENAME LIKE RLGRAP-FILENAME.
 
 
 
tables: spfli.
 
data  h type i.
 
* table of flights
 
data: it_spfli like spfli occurs 10 with header line.
 
 
 
*&amp;amp;---------------------------------------------------------------------*
 
 
 
*&amp;amp;   Event START-OF-SELECTION
 
*&amp;amp;---------------------------------------------------------------------*
 
 
 
start-of-selection.
 
* read flights
 
  select * from spfli into table it_spfli.
 
* display header
 
  uline (61).
 
  write: /     sy-vline no-gap,
 
          (3)  'Flg'(001) color col_heading no-gap, sy-vline no-gap,
 
          (4)  'Nr'(002) color col_heading no-gap, sy-vline no-gap,
 
          (20) 'Von'(003) color col_heading no-gap, sy-vline no-gap,
 
          (20) 'Nach'(004) color col_heading no-gap, sy-vline no-gap,
 
          (8)  'Zeit'(005) color col_heading no-gap, sy-vline no-gap.
 
  uline /(61).
 
* display flights
 
  loop at it_spfli.
 
    write: / sy-vline no-gap,
 
             it_spfli-carrid color col_key no-gap, sy-vline no-gap,
 
             it_spfli-connid color col_normal no-gap, sy-vline no-gap,
 
             it_spfli-cityfrom color col_normal no-gap, sy-vline no-gap,
 
             it_spfli-cityto color col_normal no-gap, sy-vline no-gap,
 
             it_spfli-deptime color col_normal no-gap, sy-vline no-gap.
 
  endloop.
 
  uline /(61).
 
* tell user what is going on
 
  call function 'SAPGUI_PROGRESS_INDICATOR'
 
     exporting
 
*           PERCENTAGE = 0
 
           text       = text-007
 
       exceptions
 
            others     = 1.
 
* start Excel
 
  create object h_excel 'EXCEL.APPLICATION'.
 
*  PERFORM ERR_HDL.
 
 
 
  set property of h_excel  'Visible' = 1.
 
*  CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:kis_excel.xls'
 
  .
 
 
 
*  PERFORM ERR_HDL.
 
* tell user what is going on
 
  call function 'SAPGUI_PROGRESS_INDICATOR'
 
     exporting
 
*           PERCENTAGE = 0
 
           text       = text-008
 
       exceptions
 
            others     = 1.
 
* get list of workbooks, initially empty
 
  call method of h_excel 'Workbooks' = h_mapl.
 
  perform err_hdl.
 
* add a new workbook
 
  call method of h_mapl 'Add' = h_map.
 
  perform err_hdl.
 
* tell user what is going on
 
  call function 'SAPGUI_PROGRESS_INDICATOR'
 
     exporting
 
*           PERCENTAGE = 0
 
           text       = text-009
 
       exceptions
 
            others     = 1.
 
* output column headings to active Excel sheet
 
  perform fill_cell using 1 1 1 200 'Carrier id'(001).
 
  perform fill_cell using 1 2 1 200 'Connection id'(002).
 
  perform fill_cell using 1 3 1 200 'City from'(003).
 
  perform fill_cell using 1 4 1 200 'City to'(004).
 
  perform fill_cell using 1 5 1 200 'Dep. Time'(005).
 
  loop at it_spfli.
 
* copy flights to active EXCEL sheet
 
    h = sy-tabix + 1.
 
    if it_spfli-carrid cs 'AA'.
 
      perform fill_cell using h 1 0 000255000 it_spfli-carrid.
 
    elseif it_spfli-carrid cs 'AZ'.
 
      perform fill_cell using h 1 0 168000000 it_spfli-carrid.
 
    elseif it_spfli-carrid cs 'JL'.
 
      perform fill_cell using h 1 0 168168000 it_spfli-carrid.
 
    elseif it_spfli-carrid cs 'LH'.
 
      perform fill_cell using h 1 0 111111111 it_spfli-carrid.
 
    elseif it_spfli-carrid cs 'SQ'.
 
      perform fill_cell using h 1 0 100100100 it_spfli-carrid.
 
    else.
 
      perform fill_cell using h 1 0 000145000 it_spfli-carrid.
 
    endif.
 
 
 
    if it_spfli-connid lt 400.
 
      perform fill_cell using h 2 0 255000255 it_spfli-connid.
 
    elseif it_spfli-connid lt 800.
 
      perform fill_cell using h 2 0 077099088 it_spfli-connid.
 
    else.
 
      perform fill_cell using h 2 0 246156138 it_spfli-connid.
 
    endif.
 
 
 
    if it_spfli-cityfrom cp 'S*'.
 
      perform fill_cell using h 3 0 155155155 it_spfli-cityfrom.
 
    elseif it_spfli-cityfrom cp 'N*'.
 
      perform fill_cell using h 3 0 189111222 it_spfli-cityfrom.
 
    else.
 
      perform fill_cell using h 3 0 111230222 it_spfli-cityfrom.
 
    endif.
 
 
 
    if it_spfli-cityto cp 'S*'.
 
      perform fill_cell using h 4 0 200200200 it_spfli-cityto.
 
    elseif it_spfli-cityto cp 'N*'.
 
      perform fill_cell using h 4 0 000111222 it_spfli-cityto.
 
    else.
 
      perform fill_cell using h 4 0 130230230 it_spfli-cityto.
 
    endif.
 
 
 
    if it_spfli-deptime lt '020000'.
 
      perform fill_cell using h 5 0 145145145 it_spfli-deptime.
 
    elseif it_spfli-deptime lt '120000' .
 
      perform fill_cell using h 5 0 015215205 it_spfli-deptime.
 
    elseif it_spfli-deptime lt '180000' .
 
      perform fill_cell using h 5 0 000215205 it_spfli-deptime.
 
    else.
 
      perform fill_cell using h 5 0 115115105 it_spfli-deptime.
 
    endif.
 
  endloop.
 
 
 
 
 
* EXCEL FILENAME
 
  CONCATENATE SY-REPID '_' SY-DATUM+6(2) '_' SY-DATUM+4(2) '_'
 
              SY-DATUM(4) '_' SY-UZEIT '.XLS' INTO FILENAME.
 
 
 
  CALL METHOD OF H_MAP 'SAVEAS' EXPORTING #1 = FILENAME.
 
 
 
 
 
  free object h_excel.
 
  perform err_hdl.
 
*---------------------------------------------------------------------*
 
*       FORM FILL_CELL                                                *
 
*---------------------------------------------------------------------*
 
*       sets cell at coordinates i,j to value val boldtype bold       *
 
*---------------------------------------------------------------------*
 
form fill_cell using i j bold col val.
 
  call method of h_excel 'Cells' = h_zl
 
    exporting
 
      #1 = i
 
      #2 = j.
 
  perform err_hdl.
 
  set property of h_zl 'Value' = val .
 
  perform err_hdl.
 
  get property of h_zl 'Font' = h_f.
 
  perform err_hdl.
 
  set property of h_f 'Bold' = bold .
 
  perform err_hdl.
 
  set property of h_f 'Color' = col.
 
  perform err_hdl.
 
endform.                    "FILL_CELL
 
 
 
*&amp;amp;---------------------------------------------------------------------*
 
 
 
*&amp;amp;      Form  ERR_HDL
 
*&amp;amp;---------------------------------------------------------------------*
 
 
 
*       outputs OLE error if any                                       *
 
 
 
*----------------------------------------------------------------------*
 
 
 
*  --&amp;gt;  p1        text
 
*  &amp;lt;--  p2        text
 
*----------------------------------------------------------------------*
 
 
 
form err_hdl.
 
  if sy-subrc &amp;lt;&amp;gt; 0.
 
    write: / 'OLE-Automation Error:'(010), sy-subrc.
 
    stop.
 
  endif.
 
endform.                    " ERR_HDL

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Deepu.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Jul 2007 09:59:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-07-11T09:59:51Z</dc:date>
    <item>
      <title>to send data to excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/to-send-data-to-excel/m-p/2540343#M577188</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hai all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  urgent   i had a problem  to send sap data(created in modulepool programming) to excelsheet.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2007 09:55:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/to-send-data-to-excel/m-p/2540343#M577188</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-11T09:55:52Z</dc:date>
    </item>
    <item>
      <title>Re: to send data to excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/to-send-data-to-excel/m-p/2540344#M577189</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use FM   &amp;lt;b&amp;gt;SAP_CONVERT_TO_XLS_FORMAT&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;reward if useful..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2007 09:58:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/to-send-data-to-excel/m-p/2540344#M577189</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-11T09:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: to send data to excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/to-send-data-to-excel/m-p/2540345#M577190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Anand,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        Either in Report or in MPP u'l be having thedata to be transported to XL in the Internal Table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT ztest1 .
 
 
 
 
 
* this report demonstrates how to send some ABAP data to an
 
* EXCEL sheet using OLE automation.
 
include ole2incl.
 
* handles for OLE objects
 
data: h_excel type ole2_object,        " Excel object
 
      h_mapl type ole2_object,         " list of workbooks
 
      h_map type ole2_object,          " workbook
 
      h_zl type ole2_object,           " cell
 
      h_f type ole2_object,            " font
 
      h_c type ole2_object.            " color
 
 
 
DATA: FILENAME LIKE RLGRAP-FILENAME.
 
 
 
tables: spfli.
 
data  h type i.
 
* table of flights
 
data: it_spfli like spfli occurs 10 with header line.
 
 
 
*&amp;amp;---------------------------------------------------------------------*
 
 
 
*&amp;amp;   Event START-OF-SELECTION
 
*&amp;amp;---------------------------------------------------------------------*
 
 
 
start-of-selection.
 
* read flights
 
  select * from spfli into table it_spfli.
 
* display header
 
  uline (61).
 
  write: /     sy-vline no-gap,
 
          (3)  'Flg'(001) color col_heading no-gap, sy-vline no-gap,
 
          (4)  'Nr'(002) color col_heading no-gap, sy-vline no-gap,
 
          (20) 'Von'(003) color col_heading no-gap, sy-vline no-gap,
 
          (20) 'Nach'(004) color col_heading no-gap, sy-vline no-gap,
 
          (8)  'Zeit'(005) color col_heading no-gap, sy-vline no-gap.
 
  uline /(61).
 
* display flights
 
  loop at it_spfli.
 
    write: / sy-vline no-gap,
 
             it_spfli-carrid color col_key no-gap, sy-vline no-gap,
 
             it_spfli-connid color col_normal no-gap, sy-vline no-gap,
 
             it_spfli-cityfrom color col_normal no-gap, sy-vline no-gap,
 
             it_spfli-cityto color col_normal no-gap, sy-vline no-gap,
 
             it_spfli-deptime color col_normal no-gap, sy-vline no-gap.
 
  endloop.
 
  uline /(61).
 
* tell user what is going on
 
  call function 'SAPGUI_PROGRESS_INDICATOR'
 
     exporting
 
*           PERCENTAGE = 0
 
           text       = text-007
 
       exceptions
 
            others     = 1.
 
* start Excel
 
  create object h_excel 'EXCEL.APPLICATION'.
 
*  PERFORM ERR_HDL.
 
 
 
  set property of h_excel  'Visible' = 1.
 
*  CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:kis_excel.xls'
 
  .
 
 
 
*  PERFORM ERR_HDL.
 
* tell user what is going on
 
  call function 'SAPGUI_PROGRESS_INDICATOR'
 
     exporting
 
*           PERCENTAGE = 0
 
           text       = text-008
 
       exceptions
 
            others     = 1.
 
* get list of workbooks, initially empty
 
  call method of h_excel 'Workbooks' = h_mapl.
 
  perform err_hdl.
 
* add a new workbook
 
  call method of h_mapl 'Add' = h_map.
 
  perform err_hdl.
 
* tell user what is going on
 
  call function 'SAPGUI_PROGRESS_INDICATOR'
 
     exporting
 
*           PERCENTAGE = 0
 
           text       = text-009
 
       exceptions
 
            others     = 1.
 
* output column headings to active Excel sheet
 
  perform fill_cell using 1 1 1 200 'Carrier id'(001).
 
  perform fill_cell using 1 2 1 200 'Connection id'(002).
 
  perform fill_cell using 1 3 1 200 'City from'(003).
 
  perform fill_cell using 1 4 1 200 'City to'(004).
 
  perform fill_cell using 1 5 1 200 'Dep. Time'(005).
 
  loop at it_spfli.
 
* copy flights to active EXCEL sheet
 
    h = sy-tabix + 1.
 
    if it_spfli-carrid cs 'AA'.
 
      perform fill_cell using h 1 0 000255000 it_spfli-carrid.
 
    elseif it_spfli-carrid cs 'AZ'.
 
      perform fill_cell using h 1 0 168000000 it_spfli-carrid.
 
    elseif it_spfli-carrid cs 'JL'.
 
      perform fill_cell using h 1 0 168168000 it_spfli-carrid.
 
    elseif it_spfli-carrid cs 'LH'.
 
      perform fill_cell using h 1 0 111111111 it_spfli-carrid.
 
    elseif it_spfli-carrid cs 'SQ'.
 
      perform fill_cell using h 1 0 100100100 it_spfli-carrid.
 
    else.
 
      perform fill_cell using h 1 0 000145000 it_spfli-carrid.
 
    endif.
 
 
 
    if it_spfli-connid lt 400.
 
      perform fill_cell using h 2 0 255000255 it_spfli-connid.
 
    elseif it_spfli-connid lt 800.
 
      perform fill_cell using h 2 0 077099088 it_spfli-connid.
 
    else.
 
      perform fill_cell using h 2 0 246156138 it_spfli-connid.
 
    endif.
 
 
 
    if it_spfli-cityfrom cp 'S*'.
 
      perform fill_cell using h 3 0 155155155 it_spfli-cityfrom.
 
    elseif it_spfli-cityfrom cp 'N*'.
 
      perform fill_cell using h 3 0 189111222 it_spfli-cityfrom.
 
    else.
 
      perform fill_cell using h 3 0 111230222 it_spfli-cityfrom.
 
    endif.
 
 
 
    if it_spfli-cityto cp 'S*'.
 
      perform fill_cell using h 4 0 200200200 it_spfli-cityto.
 
    elseif it_spfli-cityto cp 'N*'.
 
      perform fill_cell using h 4 0 000111222 it_spfli-cityto.
 
    else.
 
      perform fill_cell using h 4 0 130230230 it_spfli-cityto.
 
    endif.
 
 
 
    if it_spfli-deptime lt '020000'.
 
      perform fill_cell using h 5 0 145145145 it_spfli-deptime.
 
    elseif it_spfli-deptime lt '120000' .
 
      perform fill_cell using h 5 0 015215205 it_spfli-deptime.
 
    elseif it_spfli-deptime lt '180000' .
 
      perform fill_cell using h 5 0 000215205 it_spfli-deptime.
 
    else.
 
      perform fill_cell using h 5 0 115115105 it_spfli-deptime.
 
    endif.
 
  endloop.
 
 
 
 
 
* EXCEL FILENAME
 
  CONCATENATE SY-REPID '_' SY-DATUM+6(2) '_' SY-DATUM+4(2) '_'
 
              SY-DATUM(4) '_' SY-UZEIT '.XLS' INTO FILENAME.
 
 
 
  CALL METHOD OF H_MAP 'SAVEAS' EXPORTING #1 = FILENAME.
 
 
 
 
 
  free object h_excel.
 
  perform err_hdl.
 
*---------------------------------------------------------------------*
 
*       FORM FILL_CELL                                                *
 
*---------------------------------------------------------------------*
 
*       sets cell at coordinates i,j to value val boldtype bold       *
 
*---------------------------------------------------------------------*
 
form fill_cell using i j bold col val.
 
  call method of h_excel 'Cells' = h_zl
 
    exporting
 
      #1 = i
 
      #2 = j.
 
  perform err_hdl.
 
  set property of h_zl 'Value' = val .
 
  perform err_hdl.
 
  get property of h_zl 'Font' = h_f.
 
  perform err_hdl.
 
  set property of h_f 'Bold' = bold .
 
  perform err_hdl.
 
  set property of h_f 'Color' = col.
 
  perform err_hdl.
 
endform.                    "FILL_CELL
 
 
 
*&amp;amp;---------------------------------------------------------------------*
 
 
 
*&amp;amp;      Form  ERR_HDL
 
*&amp;amp;---------------------------------------------------------------------*
 
 
 
*       outputs OLE error if any                                       *
 
 
 
*----------------------------------------------------------------------*
 
 
 
*  --&amp;gt;  p1        text
 
*  &amp;lt;--  p2        text
 
*----------------------------------------------------------------------*
 
 
 
form err_hdl.
 
  if sy-subrc &amp;lt;&amp;gt; 0.
 
    write: / 'OLE-Automation Error:'(010), sy-subrc.
 
    stop.
 
  endif.
 
endform.                    " ERR_HDL

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Deepu.K&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2007 09:59:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/to-send-data-to-excel/m-p/2540345#M577190</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-11T09:59:51Z</dc:date>
    </item>
    <item>
      <title>Re: to send data to excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/to-send-data-to-excel/m-p/2540346#M577191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;chk this simple eg. will work for u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  Z_GUI_DOWNLOAD_TO_EXCEL.
 
data : itab type mara occurs 0 with header line.
 
select * into itab
         from mara
         up to 10 rows.
         append itab.
endselect.
 
data : begin of itab1 occurs 0,
         line(50) type c,
       end of itab1.
 
itab1-line = 'field1 description'.
append itab1.
itab1-line = 'field2 desc'.
append itab1.
itab1-line = 'field3 desc'.
append itab1.
*--and so on you have to add up the records in itab1.
 
CALL FUNCTION 'GUI_DOWNLOAD'
 EXPORTING
*   BIN_FILESIZE                  = ' '
*   CODEPAGE                      = ' '
   FILENAME                      = 'C:ABCD.XLS '
   FILETYPE                      = 'DAT'
*   MODE                          = ' '
*   WK1_N_FORMAT                  = ' '
*   WK1_N_SIZE                    = ' '
*   WK1_T_FORMAT                  = ' '
*   WK1_T_SIZE                    = ' '
*   COL_SELECT                    = ' '
*   COL_SELECTMASK                = ' '
*   NO_AUTH_CHECK                 = ' '
* IMPORTING
*   FILELENGTH                    = FILELENGTH
  TABLES
    DATA_TAB                      = ITAB
   FIELDNAMES                    = ITAB1
 EXCEPTIONS
   FILE_OPEN_ERROR               = 1
   FILE_WRITE_ERROR              = 2
   INVALID_FILESIZE              = 3
   INVALID_TYPE                  = 4
   NO_BATCH                      = 5
   UNKNOWN_ERROR                 = 6
   INVALID_TABLE_WIDTH           = 7
   GUI_REFUSE_FILETRANSFER       = 8
   CUSTOMER_ERROR                = 9
   NO_AUTHORITY                  = 10
   OTHERS                        = 11
          .
IF SY-SUBRC &amp;lt;&amp;gt; 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds&lt;/P&gt;&lt;P&gt;Reshma&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2007 09:59:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/to-send-data-to-excel/m-p/2540346#M577191</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-11T09:59:58Z</dc:date>
    </item>
    <item>
      <title>Re: to send data to excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/to-send-data-to-excel/m-p/2540347#M577192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use the function module XXL_SIMPLE_API&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2007 10:00:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/to-send-data-to-excel/m-p/2540347#M577192</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-11T10:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: to send data to excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/to-send-data-to-excel/m-p/2540348#M577193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;refer to the following link:&lt;/P&gt;&lt;P&gt;&lt;A href="http://sap-img.com/abap/download-in-background-in-excel-format.htm" target="test_blank"&gt;http://sap-img.com/abap/download-in-background-in-excel-format.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Reward if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sipra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2007 10:00:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/to-send-data-to-excel/m-p/2540348#M577193</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-11T10:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: to send data to excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/to-send-data-to-excel/m-p/2540349#M577194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;go through the following example-----&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       T A B L E S      D E C L E R A T I O N&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tables : MARA ,  MAKT  ,  MARD .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       T Y P E - P O O L S   D E C L E R A T I O N&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPE-POOLS OLE2 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       D A T A    D E C L E R A T I O N&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--&lt;DEL&gt;-handles for OLE objects&lt;/DEL&gt;--&lt;/P&gt;&lt;P&gt;DATA: H_EXCEL   TYPE OLE2_OBJECT,        " Excel object&lt;/P&gt;&lt;P&gt;      H_MAPL    TYPE OLE2_OBJECT,        " list of workbooks&lt;/P&gt;&lt;P&gt;      H_MAP     TYPE OLE2_OBJECT,        " workbook&lt;/P&gt;&lt;P&gt;      H_ZL      TYPE OLE2_OBJECT,        " cell&lt;/P&gt;&lt;P&gt;      H_FORMAT2 TYPE OLE2_OBJECT,&lt;/P&gt;&lt;P&gt;      H_FORMAT3 TYPE OLE2_OBJECT,&lt;/P&gt;&lt;P&gt;      H_FORMAT4 TYPE OLE2_OBJECT,&lt;/P&gt;&lt;P&gt;      H_FORMAT1 TYPE OLE2_OBJECT.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      I N T E R N A L     T A B L E&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data :  Begin of it_1 occurs 0 ,&lt;/P&gt;&lt;P&gt;         matnr like mara-matnr ,&lt;/P&gt;&lt;P&gt;         maktx like makt-maktx ,&lt;/P&gt;&lt;P&gt;         werks like mard-werks ,&lt;/P&gt;&lt;P&gt;         labst like mard-labst ,&lt;/P&gt;&lt;P&gt;        End of it_1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       S E L E C T I O N   S C R E E N&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      S T A R T - O F - S E L E C T I O N&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT&lt;/P&gt;&lt;P&gt;         A~MATNR&lt;/P&gt;&lt;P&gt;         B~MAKTX&lt;/P&gt;&lt;P&gt;         C~WERKS&lt;/P&gt;&lt;P&gt;         SUM( C~LABST )&lt;/P&gt;&lt;P&gt;                       INTO TABLE IT_1&lt;/P&gt;&lt;P&gt;                       FROM ( ( mara as a inner join makt as b on&lt;/P&gt;&lt;P&gt;                               a&lt;SUB&gt;matnr = b&lt;/SUB&gt;matnr and b~spras = 'EN' )&lt;/P&gt;&lt;P&gt;                       INNER JOIN MARD AS C ON A&lt;SUB&gt;MATNR = C&lt;/SUB&gt;MATNR )&lt;/P&gt;&lt;P&gt;                       WHERE A~MATNR IN S_MATNR&lt;/P&gt;&lt;P&gt;                       GROUP BY A&lt;SUB&gt;MATNR B&lt;/SUB&gt;MAKTX C~WERKS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT IT_1 BY MATNR WERKS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           PERCENTAGE = 100&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           TEXT       = TEXT-I08&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      EXCEPTIONS&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;           OTHERS     = 1.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--&lt;DEL&gt;-REATE AN EXCEL DOCUMENT&lt;/DEL&gt;--&lt;/P&gt;&lt;HR originaltext="---" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.&lt;/P&gt;&lt;P&gt;SET PROPERTY OF H_EXCEL  'Visible' = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--&lt;DEL&gt;-SET AN OBJECT FOR WORKBOOK&lt;/DEL&gt;---&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;DEL&gt;CREATE A WORKBOOK&lt;/DEL&gt;-----&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD OF H_MAPL 'ADD' = h_map.&lt;/P&gt;&lt;P&gt;CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = 1  #2 = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--&lt;DEL&gt;-CHANGE THE PROPERTY OF THE CELL&lt;/DEL&gt;--&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; GET PROPERTY OF H_ZL 'INTERIOR' = H_FORMAT4.&lt;/P&gt;&lt;P&gt; SET PROPERTY OF H_FORMAT4 'COLORINDEX' = 22.&lt;/P&gt;&lt;P&gt; GET PROPERTY OF H_ZL 'COLUMNS' = H_FORMAT4.&lt;/P&gt;&lt;P&gt; CALL METHOD OF H_FORMAT4 'AUTOFIT'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--&lt;DEL&gt;FOR MATERIAL NUMBER&lt;/DEL&gt;---&lt;/P&gt;&lt;P&gt;SET PROPERTY OF H_ZL 'VALUE' = 'Material Number'.&lt;/P&gt;&lt;P&gt;call method of h_excel 'Cells' = h_zl exporting #1 = 1  #2 = 2 .&lt;/P&gt;&lt;P&gt;CALL METHOD OF H_EXCEL 'COLUMNS' = H_FORMAT4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--&lt;DEL&gt;FOR MATERIAL DESCRIPTION&lt;/DEL&gt;---&lt;/P&gt;&lt;P&gt;SET PROPERTY OF H_ZL 'VALUE' = 'Material Description'.&lt;/P&gt;&lt;P&gt;call method of h_excel 'Cells' = h_zl exporting #1 = 1  #2 = 3 .&lt;/P&gt;&lt;P&gt;CALL METHOD OF H_EXCEL 'COLUMNS' = H_FORMAT4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--&lt;DEL&gt;FOR PLANT&lt;/DEL&gt;---&lt;/P&gt;&lt;P&gt;SET PROPERTY OF H_ZL 'VALUE' = 'Plant'.&lt;/P&gt;&lt;P&gt;call method of h_excel 'Cells' = h_zl exporting #1 = 1  #2 = 4 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--&lt;DEL&gt;FOR STOCK&lt;/DEL&gt;----&lt;/P&gt;&lt;P&gt;SET PROPERTY OF H_ZL 'VALUE' = 'Stock'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;DEL&gt;DECLEARING A VARIABLE&lt;/DEL&gt;----&lt;/P&gt;&lt;P&gt;data : v_t type i.&lt;/P&gt;&lt;P&gt;clear v_t.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       P R I N T   T H E  O U T P U T&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT IT_1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;v_t = sy-tabix + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--&lt;DEL&gt;for columns format&lt;/DEL&gt;---&lt;/P&gt;&lt;P&gt;CALL METHOD OF H_EXCEL 'COLUMNS' = H_FORMAT1.&lt;/P&gt;&lt;P&gt;SET PROPERTY OF H_FORMAT1 'ColumnWidth'  = 20.&lt;/P&gt;&lt;P&gt;call method of h_excel 'Cells' = h_zl exporting #1 = v_t  #2 = 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--&lt;DEL&gt;for material number&lt;/DEL&gt;---&lt;/P&gt;&lt;P&gt;SET PROPERTY OF H_ZL 'VALUE' = it_1-matnr.&lt;/P&gt;&lt;P&gt;CALL METHOD OF H_EXCEL 'COLUMNS' = H_FORMAT1.&lt;/P&gt;&lt;P&gt;call method of h_excel 'Cells' = h_zl exporting #1 = v_t  #2 = 2 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--&lt;DEL&gt;for material description&lt;/DEL&gt;----&lt;/P&gt;&lt;P&gt;SET PROPERTY OF H_ZL 'VALUE' = it_1-maktx.&lt;/P&gt;&lt;P&gt;call method of h_excel 'Cells' = h_zl exporting #1 = v_t  #2 = 3 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--&lt;DEL&gt;for plants&lt;/DEL&gt;---&lt;/P&gt;&lt;P&gt;SET PROPERTY OF H_ZL 'VALUE' = it_1-werks.&lt;/P&gt;&lt;P&gt;call method of h_excel 'Cells' = h_zl exporting #1 = v_t  #2 = 4 .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--&lt;DEL&gt;for stock&lt;/DEL&gt;--&lt;/P&gt;&lt;P&gt;SET PROPERTY OF H_ZL 'VALUE' = it_1-labst.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*-------METHOD FOR SAVE THE BOOK -&lt;/P&gt;&lt;HR originaltext="-------" /&gt;&lt;P&gt;call method of h_excel 'SAVE' = H_FORMAT4.&lt;/P&gt;&lt;P&gt;*----&lt;DEL&gt;DECLARE WHERE ITS SAVE&lt;/DEL&gt;--&lt;/P&gt;&lt;HR originaltext="----" /&gt;&lt;P&gt;SET PROPERTY OF H_FORMAT4 'FILENAME' = 'C:\TESTS.XLS'..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*******do rewards if usefull&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2007 10:01:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/to-send-data-to-excel/m-p/2540349#M577194</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-11T10:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: to send data to excel</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/to-send-data-to-excel/m-p/2540350#M577195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;     try  For uploading use the FM TEXT_CONVERT_XLS_TO_SAP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Reward points&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jul 2007 10:02:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/to-send-data-to-excel/m-p/2540350#M577195</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-07-11T10:02:38Z</dc:date>
    </item>
  </channel>
</rss>

