<?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: Reg. Dowloading to EXCEL FILE.. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dowloading-to-excel-file/m-p/1129371#M111325</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is an example of how you would create a new excel file and put data into.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;


report zrich_0002.

include ole2incl.

data: e_sheet type ole2_object.
data: e_appl  type ole2_object.
data: e_work  type ole2_object.
data: e_cell  type ole2_object.
data: e_wbooklist type ole2_object.

data: field_value(30) type c.

parameters: p_file type localfile default 'C:Test.xls'.

start-of-selection.


* Start the application
  create object e_appl 'EXCEL.APPLICATION'.
  set property of e_appl 'VISIBLE' = 0.

* Open the file
  call method of e_appl 'WORKBOOKS' = e_wbooklist.
  get property of e_wbooklist 'Application' = e_appl .
  set property of e_appl 'SheetsInNewWorkbook' = 1 .
  call method of e_wbooklist 'Add' = e_work .
  get property of e_appl 'ActiveSheet' = e_sheet .
  set property of e_sheet 'Name' = 'Test' .



* Write data to the excel file
* Here you are manipulating each cell one at a time.
* You can pretty much put the data anywhere you want.
* No restrictions.

  do 20 times.

* Create the value
    field_value  = sy-index.
    shift field_value left deleting leading space.
    concatenate 'Cell' field_value into field_value separated by space.


* Position to specific cell  in  Column 1
    call method of e_appl 'Cells' = e_cell
           exporting
                #1 = sy-index
                #2 = 1.
* Set the value
    set property of e_cell 'Value' = field_value .


* Position to specific cell  in  Column 2
    call method of e_appl 'Cells' = e_cell
           exporting
                #1 = sy-index
                #2 = 2.
* Set the value
    set property of e_cell 'Value' = field_value .


* Position to specific cell  in  Column 3
    call method of e_appl 'Cells' = e_cell
           exporting
                #1 = sy-index
                #2 = 3.
* Set the value
    set property of e_cell 'Value' = field_value .

  enddo.



** Close the file
  get property of e_appl 'ActiveWorkbook' = e_work.
  call method of e_work 'SAVEAS'
        exporting
            #1 = p_file
            #2 = 1.          " Don't ask me when closing

  call method of e_work 'close'.

* Quit the file
  call method of  e_appl  'QUIT'.

* Free them up
  free object e_cell.
  free object e_sheet.
  free object e_work.
  free object e_wbooklist.
  free object e_appl.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Feb 2006 14:39:24 GMT</pubDate>
    <dc:creator>RichHeilman</dc:creator>
    <dc:date>2006-02-01T14:39:24Z</dc:date>
    <item>
      <title>Reg. Dowloading to EXCEL FILE..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dowloading-to-excel-file/m-p/1129366#M111320</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;The Excel file which gets dowloaded should be of the form.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Main Heading 1&lt;/P&gt;&lt;P&gt;SUB HEADING ( in the form of an INTERNAL TABLE )&lt;/P&gt;&lt;P&gt; Contents    &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Main Heading 2&lt;/P&gt;&lt;P&gt;SUB HEADING  ( in the form of an INTERNAL TABLE )&lt;/P&gt;&lt;P&gt;  Contents.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know how effectively this can be done. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have used the FM MS_EXCEL_OLE_STANDARD_DAT . But my exact requirement isn't served.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maheshwari.V&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Feb 2006 14:08:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dowloading-to-excel-file/m-p/1129366#M111320</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-01T14:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Reg. Dowloading to EXCEL FILE..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dowloading-to-excel-file/m-p/1129367#M111321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried using OLE yet?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/rich.heilman2/blog/2005/09/12/manipulate-excel-with-ole-abap&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Feb 2006 14:12:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dowloading-to-excel-file/m-p/1129367#M111321</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-02-01T14:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: Reg. Dowloading to EXCEL FILE..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dowloading-to-excel-file/m-p/1129368#M111322</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;Check this link and kindly reward points by clicking the star on the left of reply,if it helps.&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.abap4.it/download/ZUSERMAIL.txt" target="test_blank"&gt;http://www.abap4.it/download/ZUSERMAIL.txt&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Feb 2006 14:14:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dowloading-to-excel-file/m-p/1129368#M111322</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2006-02-01T14:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: Reg. Dowloading to EXCEL FILE..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dowloading-to-excel-file/m-p/1129369#M111323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;have six itabs&lt;/P&gt;&lt;P&gt;itab1 for main heading,&lt;/P&gt;&lt;P&gt;itab2 for subheading&lt;/P&gt;&lt;P&gt;itab3 data&lt;/P&gt;&lt;P&gt;itab4 main heading2&lt;/P&gt;&lt;P&gt;itab5 subheading2&lt;/P&gt;&lt;P&gt;itab6 contents 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;download one by one to the same file name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;using GUI_DOWNLOAD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first call with append = ' ' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and next 5 calls with append = 'X' &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is a crude way, but if you want more fancier handling, you can go for OLE programming.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Raja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Feb 2006 14:14:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dowloading-to-excel-file/m-p/1129369#M111323</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2006-02-01T14:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: Reg. Dowloading to EXCEL FILE..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dowloading-to-excel-file/m-p/1129370#M111324</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;Hope finally u have entire data in one internal table.&lt;/P&gt;&lt;P&gt;Split the data into n tables according to criteria.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then Use GUI_DOWNLOAD &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) First time append = ' ' .   "First heading&lt;/P&gt;&lt;P&gt;2) from the next time append = 'X'. "First internal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;again "Heading   "Second ITAB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Eswar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Feb 2006 14:25:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dowloading-to-excel-file/m-p/1129370#M111324</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-01T14:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: Reg. Dowloading to EXCEL FILE..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dowloading-to-excel-file/m-p/1129371#M111325</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is an example of how you would create a new excel file and put data into.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;


report zrich_0002.

include ole2incl.

data: e_sheet type ole2_object.
data: e_appl  type ole2_object.
data: e_work  type ole2_object.
data: e_cell  type ole2_object.
data: e_wbooklist type ole2_object.

data: field_value(30) type c.

parameters: p_file type localfile default 'C:Test.xls'.

start-of-selection.


* Start the application
  create object e_appl 'EXCEL.APPLICATION'.
  set property of e_appl 'VISIBLE' = 0.

* Open the file
  call method of e_appl 'WORKBOOKS' = e_wbooklist.
  get property of e_wbooklist 'Application' = e_appl .
  set property of e_appl 'SheetsInNewWorkbook' = 1 .
  call method of e_wbooklist 'Add' = e_work .
  get property of e_appl 'ActiveSheet' = e_sheet .
  set property of e_sheet 'Name' = 'Test' .



* Write data to the excel file
* Here you are manipulating each cell one at a time.
* You can pretty much put the data anywhere you want.
* No restrictions.

  do 20 times.

* Create the value
    field_value  = sy-index.
    shift field_value left deleting leading space.
    concatenate 'Cell' field_value into field_value separated by space.


* Position to specific cell  in  Column 1
    call method of e_appl 'Cells' = e_cell
           exporting
                #1 = sy-index
                #2 = 1.
* Set the value
    set property of e_cell 'Value' = field_value .


* Position to specific cell  in  Column 2
    call method of e_appl 'Cells' = e_cell
           exporting
                #1 = sy-index
                #2 = 2.
* Set the value
    set property of e_cell 'Value' = field_value .


* Position to specific cell  in  Column 3
    call method of e_appl 'Cells' = e_cell
           exporting
                #1 = sy-index
                #2 = 3.
* Set the value
    set property of e_cell 'Value' = field_value .

  enddo.



** Close the file
  get property of e_appl 'ActiveWorkbook' = e_work.
  call method of e_work 'SAVEAS'
        exporting
            #1 = p_file
            #2 = 1.          " Don't ask me when closing

  call method of e_work 'close'.

* Quit the file
  call method of  e_appl  'QUIT'.

* Free them up
  free object e_cell.
  free object e_sheet.
  free object e_work.
  free object e_wbooklist.
  free object e_appl.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Feb 2006 14:39:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reg-dowloading-to-excel-file/m-p/1129371#M111325</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-02-01T14:39:24Z</dc:date>
    </item>
  </channel>
</rss>

