<?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: ABAP OLE Objects in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-ole-objects/m-p/3566529#M858324</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;  I think  you have given the third  sheet name  for fourth and fifth.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; call method of application 'Worksheets' = sheet&lt;/P&gt;&lt;P&gt;      exporting&lt;/P&gt;&lt;P&gt;      #1 = 1.&lt;/P&gt;&lt;P&gt;      set property of sheet 'Name' = sheet_name.&lt;/P&gt;&lt;P&gt;      call method of sheet 'Activate'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you might have missed to add sheet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD OF application 'Sheets' = sheets.&lt;/P&gt;&lt;P&gt;   CALL METHOD OF sheets 'Add'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Run my program:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT ZP_EXCEL .&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Report ZP_EXCEL *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&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;include ole2incl.&lt;/P&gt;&lt;P&gt;data: application type ole2_object,&lt;/P&gt;&lt;P&gt;workbook type ole2_object,&lt;/P&gt;&lt;P&gt;sheet type ole2_object,&lt;/P&gt;&lt;P&gt;cells type ole2_object,&lt;/P&gt;&lt;P&gt;sheets TYPE ole2_object.&lt;/P&gt;&lt;P&gt;constants: row_max type i value 256.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data index type i.&lt;/P&gt;&lt;P&gt;data : det type ref to CL_ABAP_structDESCR,&lt;/P&gt;&lt;P&gt;       wa like line of det-&amp;gt;components.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of i_finaltab occurs 0,&lt;/P&gt;&lt;P&gt;       Col1 type i,&lt;/P&gt;&lt;P&gt;       col2 type i,&lt;/P&gt;&lt;P&gt;       col3 type i,&lt;/P&gt;&lt;P&gt;       col4 type i,&lt;/P&gt;&lt;P&gt;      end of i_finaltab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; data : count type i,&lt;/P&gt;&lt;P&gt;        v_excel_count(3), " type i value 1,&lt;/P&gt;&lt;P&gt;        sheet_name(15)  .&lt;/P&gt;&lt;P&gt;&lt;/P&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;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do 100 times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  count =  count + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  i_finaltab-col2 = 5 * count.&lt;/P&gt;&lt;P&gt;  i_finaltab-col3 = 10 * count.&lt;/P&gt;&lt;P&gt;  i_finaltab-col4 = 20 * count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  move : count to i_finaltab-col1.&lt;/P&gt;&lt;P&gt;  append  i_finaltab.&lt;/P&gt;&lt;P&gt;  clear i_finaltab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create object application 'excel.application'.&lt;/P&gt;&lt;P&gt;set property of application 'visible' = 1.&lt;/P&gt;&lt;P&gt;call method of application 'Workbooks' = workbook.&lt;/P&gt;&lt;P&gt;call method of workbook 'Add'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;Create first Excel Sheet&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;call method of application 'Worksheets' = sheet&lt;/P&gt;&lt;P&gt; exporting&lt;/P&gt;&lt;P&gt; #1 = 1.&lt;/P&gt;&lt;P&gt;  call method of sheet 'Activate'.&lt;/P&gt;&lt;P&gt;  set property of sheet 'Name' = 'EXCEL0'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     count = 1.&lt;/P&gt;&lt;P&gt;     index = row_max * ( count - 1 ) + 1.&lt;/P&gt;&lt;P&gt;     perform header_details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; DATA FNAME(60) VALUE '/data/sapdata/mk112.xls'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR OUTPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at i_finaltab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   count = count + 1.&lt;/P&gt;&lt;P&gt;  if count LE 6.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    index = row_max * ( count - 1 ) + 1. " 1 - column name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    call method of sheet 'Cells' = cells&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;     #1 = index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    set property of cells 'Value' = i_finaltab-col1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     index =  index + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    call method of sheet 'Cells' = cells&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;     #1 = index.&lt;/P&gt;&lt;P&gt;    set property of cells 'Value' = i_finaltab-col2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    index =  index + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    call method of sheet 'Cells' = cells&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;     #1 = index.&lt;/P&gt;&lt;P&gt;    set property of cells 'Value' = i_finaltab-col3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    index =  index + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    call method of sheet 'Cells' = cells&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;     #1 = index.&lt;/P&gt;&lt;P&gt;    set property of cells 'Value' = i_finaltab-col4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    v_excel_count =  v_excel_count + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   CALL METHOD OF application 'Sheets' = sheets.&lt;/P&gt;&lt;P&gt;   CALL METHOD OF sheets 'Add'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   concatenate 'EXCEL' v_excel_count into sheet_name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     clear count.&lt;/P&gt;&lt;P&gt;     count =  count + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     call method of application 'Worksheets' = sheet&lt;/P&gt;&lt;P&gt;      exporting&lt;/P&gt;&lt;P&gt;      #1 = 1.&lt;/P&gt;&lt;P&gt;      set property of sheet 'Name' = sheet_name.&lt;/P&gt;&lt;P&gt;      call method of sheet 'Activate'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      index = row_max * ( count - 1 ) + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      perform header_details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      count =  count + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      index = row_max * ( count - 1 ) + 1. " 1 - column name&lt;/P&gt;&lt;P&gt;      call method of sheet 'Cells' = cells&lt;/P&gt;&lt;P&gt;      exporting&lt;/P&gt;&lt;P&gt;       #1 = index.&lt;/P&gt;&lt;P&gt;     set property of cells 'Value' = i_finaltab-col1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      index =  index + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      call method of sheet 'Cells' = cells&lt;/P&gt;&lt;P&gt;      exporting&lt;/P&gt;&lt;P&gt;       #1 = index.&lt;/P&gt;&lt;P&gt;      set property of cells 'Value' = i_finaltab-col2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    index =  index + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    call method of sheet 'Cells' = cells&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;     #1 = index.&lt;/P&gt;&lt;P&gt;    set property of cells 'Value' = i_finaltab-col3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    index =  index + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    call method of sheet 'Cells' = cells&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;     #1 = index.&lt;/P&gt;&lt;P&gt;    set property of cells 'Value' = i_finaltab-col4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  header_details&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&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;      text&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; --&amp;gt;  p1        text&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; &amp;lt;--  p2        text&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;form header_details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;det ?= cl_abap_typedescr=&amp;gt;describe_by_DATA( i_finaltab ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at det-&amp;gt;components into wa.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call method of sheet 'Cells' = cells&lt;/P&gt;&lt;P&gt;  exporting&lt;/P&gt;&lt;P&gt;  #1 = index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  set property of cells 'Value' = wa-name.&lt;/P&gt;&lt;P&gt;  index = index + 1.&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;endform.                    " header_details&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Mar 2008 08:41:11 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-27T08:41:11Z</dc:date>
    <item>
      <title>ABAP OLE Objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-ole-objects/m-p/3566527#M858322</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;  I have used OLE Objects to move data from  5 internal tables to 5 sheets in a single XL file , but i am not able to get 4th and 5th sheet newly created , instead they are getting over writed in the third sheet itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so how to resolve this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;help reg this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2008 08:18:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-ole-objects/m-p/3566527#M858322</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-27T08:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OLE Objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-ole-objects/m-p/3566528#M858323</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suppose you did not create the sheets, but your Excel seems to be configured to create three sheets when a new file is created &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For sample look at thread &lt;SPAN __jive_macro_name="thread" id="735098"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2008 08:39:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-ole-objects/m-p/3566528#M858323</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2008-03-27T08:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP OLE Objects</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-ole-objects/m-p/3566529#M858324</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;  I think  you have given the third  sheet name  for fourth and fifth.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; call method of application 'Worksheets' = sheet&lt;/P&gt;&lt;P&gt;      exporting&lt;/P&gt;&lt;P&gt;      #1 = 1.&lt;/P&gt;&lt;P&gt;      set property of sheet 'Name' = sheet_name.&lt;/P&gt;&lt;P&gt;      call method of sheet 'Activate'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you might have missed to add sheet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CALL METHOD OF application 'Sheets' = sheets.&lt;/P&gt;&lt;P&gt;   CALL METHOD OF sheets 'Add'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Run my program:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT ZP_EXCEL .&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp; Report ZP_EXCEL *&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&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;include ole2incl.&lt;/P&gt;&lt;P&gt;data: application type ole2_object,&lt;/P&gt;&lt;P&gt;workbook type ole2_object,&lt;/P&gt;&lt;P&gt;sheet type ole2_object,&lt;/P&gt;&lt;P&gt;cells type ole2_object,&lt;/P&gt;&lt;P&gt;sheets TYPE ole2_object.&lt;/P&gt;&lt;P&gt;constants: row_max type i value 256.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data index type i.&lt;/P&gt;&lt;P&gt;data : det type ref to CL_ABAP_structDESCR,&lt;/P&gt;&lt;P&gt;       wa like line of det-&amp;gt;components.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of i_finaltab occurs 0,&lt;/P&gt;&lt;P&gt;       Col1 type i,&lt;/P&gt;&lt;P&gt;       col2 type i,&lt;/P&gt;&lt;P&gt;       col3 type i,&lt;/P&gt;&lt;P&gt;       col4 type i,&lt;/P&gt;&lt;P&gt;      end of i_finaltab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; data : count type i,&lt;/P&gt;&lt;P&gt;        v_excel_count(3), " type i value 1,&lt;/P&gt;&lt;P&gt;        sheet_name(15)  .&lt;/P&gt;&lt;P&gt;&lt;/P&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;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do 100 times.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  count =  count + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  i_finaltab-col2 = 5 * count.&lt;/P&gt;&lt;P&gt;  i_finaltab-col3 = 10 * count.&lt;/P&gt;&lt;P&gt;  i_finaltab-col4 = 20 * count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  move : count to i_finaltab-col1.&lt;/P&gt;&lt;P&gt;  append  i_finaltab.&lt;/P&gt;&lt;P&gt;  clear i_finaltab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;clear count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create object application 'excel.application'.&lt;/P&gt;&lt;P&gt;set property of application 'visible' = 1.&lt;/P&gt;&lt;P&gt;call method of application 'Workbooks' = workbook.&lt;/P&gt;&lt;P&gt;call method of workbook 'Add'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="3" type="ul"&gt;&lt;P&gt;Create first Excel Sheet&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;call method of application 'Worksheets' = sheet&lt;/P&gt;&lt;P&gt; exporting&lt;/P&gt;&lt;P&gt; #1 = 1.&lt;/P&gt;&lt;P&gt;  call method of sheet 'Activate'.&lt;/P&gt;&lt;P&gt;  set property of sheet 'Name' = 'EXCEL0'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     count = 1.&lt;/P&gt;&lt;P&gt;     index = row_max * ( count - 1 ) + 1.&lt;/P&gt;&lt;P&gt;     perform header_details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; DATA FNAME(60) VALUE '/data/sapdata/mk112.xls'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OPEN DATASET FNAME FOR OUTPUT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at i_finaltab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   count = count + 1.&lt;/P&gt;&lt;P&gt;  if count LE 6.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    index = row_max * ( count - 1 ) + 1. " 1 - column name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    call method of sheet 'Cells' = cells&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;     #1 = index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    set property of cells 'Value' = i_finaltab-col1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     index =  index + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    call method of sheet 'Cells' = cells&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;     #1 = index.&lt;/P&gt;&lt;P&gt;    set property of cells 'Value' = i_finaltab-col2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    index =  index + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    call method of sheet 'Cells' = cells&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;     #1 = index.&lt;/P&gt;&lt;P&gt;    set property of cells 'Value' = i_finaltab-col3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    index =  index + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    call method of sheet 'Cells' = cells&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;     #1 = index.&lt;/P&gt;&lt;P&gt;    set property of cells 'Value' = i_finaltab-col4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    v_excel_count =  v_excel_count + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   CALL METHOD OF application 'Sheets' = sheets.&lt;/P&gt;&lt;P&gt;   CALL METHOD OF sheets 'Add'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   concatenate 'EXCEL' v_excel_count into sheet_name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     clear count.&lt;/P&gt;&lt;P&gt;     count =  count + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     call method of application 'Worksheets' = sheet&lt;/P&gt;&lt;P&gt;      exporting&lt;/P&gt;&lt;P&gt;      #1 = 1.&lt;/P&gt;&lt;P&gt;      set property of sheet 'Name' = sheet_name.&lt;/P&gt;&lt;P&gt;      call method of sheet 'Activate'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      index = row_max * ( count - 1 ) + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      perform header_details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      count =  count + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      index = row_max * ( count - 1 ) + 1. " 1 - column name&lt;/P&gt;&lt;P&gt;      call method of sheet 'Cells' = cells&lt;/P&gt;&lt;P&gt;      exporting&lt;/P&gt;&lt;P&gt;       #1 = index.&lt;/P&gt;&lt;P&gt;     set property of cells 'Value' = i_finaltab-col1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      index =  index + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      call method of sheet 'Cells' = cells&lt;/P&gt;&lt;P&gt;      exporting&lt;/P&gt;&lt;P&gt;       #1 = index.&lt;/P&gt;&lt;P&gt;      set property of cells 'Value' = i_finaltab-col2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    index =  index + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    call method of sheet 'Cells' = cells&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;     #1 = index.&lt;/P&gt;&lt;P&gt;    set property of cells 'Value' = i_finaltab-col3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    index =  index + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    call method of sheet 'Cells' = cells&lt;/P&gt;&lt;P&gt;    exporting&lt;/P&gt;&lt;P&gt;     #1 = index.&lt;/P&gt;&lt;P&gt;    set property of cells 'Value' = i_finaltab-col4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  header_details&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&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;      text&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;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; --&amp;gt;  p1        text&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; &amp;lt;--  p2        text&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;form header_details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;det ?= cl_abap_typedescr=&amp;gt;describe_by_DATA( i_finaltab ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at det-&amp;gt;components into wa.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call method of sheet 'Cells' = cells&lt;/P&gt;&lt;P&gt;  exporting&lt;/P&gt;&lt;P&gt;  #1 = index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  set property of cells 'Value' = wa-name.&lt;/P&gt;&lt;P&gt;  index = index + 1.&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;endform.                    " header_details&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Mar 2008 08:41:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-ole-objects/m-p/3566529#M858324</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-27T08:41:11Z</dc:date>
    </item>
  </channel>
</rss>

