<?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: Need OI Example - ADD_SCRIPT_FROM_TABLE and EXECUTE_MACRO in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316612#M163832</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can you please post the way you append your script to the script table?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Sep 2006 09:04:27 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-09-15T09:04:27Z</dc:date>
    <item>
      <title>Need OI Example - ADD_SCRIPT_FROM_TABLE and EXECUTE_MACRO</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316609#M163829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have an application that creates an Excel Inplace workbook with multiple worksheets.  It is done with the Office Intergration (OI) classes/interfaces.  I want to add functionality to CHART the worksheets within the InPlace session. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My plan was to populate an internal table with VB Script commands to create the charts.  I would use the method ADD_SCRIPT_FROM_TABLE in I_OI_SCRIPT_COLLECTION to add the script, and then method EXECUTE_MACRO in I_OI_DOCUMENT_PROXY to run the script/macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It does not work.  Right now, I am using simple commands in the script.  I am just selecting a range and setting it to ITALICS.  I have tried different variations of the commands.  Either the script won't load (SCRIPT CONTAINS ERRORS) or I get sytnax errors when the EXECUTE_MACRO method is called.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I cannot find any programs in SAP that use the ADD_SCRIPT_FROM_TABLE method.  Cannot find any examples on SDN.  Cannot find any examples on the internet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I do not want to use the OLE commands.  The workbook needs to remain open in Excel InPlace and I am already using the OI interfaces.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 May 2006 14:02:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316609#M163829</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-17T14:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: Need OI Example - ADD_SCRIPT_FROM_TABLE and EXECUTE_MACRO</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316610#M163830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Where are all of the replies?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 May 2006 19:15:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316610#M163830</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-17T19:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Need OI Example - ADD_SCRIPT_FROM_TABLE and EXECUTE_MACRO</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316611#M163831</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have more info.  When I use the ADD_SCRIPT_FROM_TABLE method, an internal table of VBscript commands is passed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just tried using only one command in the script.  It works.  I built three separate scripts with one command each.  This works too.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I need to pass a complicated script that contains more than one line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;example-&lt;/P&gt;&lt;P&gt;In two steps, it works.&lt;/P&gt;&lt;P&gt;Sub Sales1()&lt;/P&gt;&lt;P&gt;Dim objExcel&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sub Sales2()&lt;/P&gt;&lt;P&gt;ChartType = "Pie"&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The same code in one script does not work-&lt;/P&gt;&lt;P&gt;Sub Sales1()&lt;/P&gt;&lt;P&gt;Dim objExcel&lt;/P&gt;&lt;P&gt;ChartType = "Pie"&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In VBscript, the end of line signifies the end of the command.  It almost looks like the method is not sure where each command ends.  I tried adding a CR or LF to the end of each line.  It did not work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Still looking for ideas, an example, or documentation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 May 2006 19:46:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316611#M163831</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-05-17T19:46:29Z</dc:date>
    </item>
    <item>
      <title>Re: Need OI Example - ADD_SCRIPT_FROM_TABLE and EXECUTE_MACRO</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316612#M163832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can you please post the way you append your script to the script table?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Sep 2006 09:04:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316612#M163832</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-15T09:04:27Z</dc:date>
    </item>
    <item>
      <title>Re: Need OI Example - ADD_SCRIPT_FROM_TABLE and EXECUTE_MACRO</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316613#M163833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Norman,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you please post the example for one script line code on this thread.&lt;/P&gt;&lt;P&gt;We have been struggling to do this. Have tried all possible combination but no luck.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please post your code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Jun 2008 08:56:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316613#M163833</guid>
      <dc:creator>monasap08</dc:creator>
      <dc:date>2008-06-17T08:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: Need OI Example - ADD_SCRIPT_FROM_TABLE and EXECUTE_MACRO</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316614#M163834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the same problem when trying to add a script to a Word document. It is no difference if I add one line or several lines to the table, I always get the same error message SOFFICEINTEGRATION 118 meaning "script contains errors".&lt;/P&gt;&lt;P&gt;What I am trying to do is adding a mergefield with the following line:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldMergeField, _&lt;/P&gt;&lt;P&gt;Text:="MERGEFIELD FIELDNAME", _&lt;/P&gt;&lt;P&gt;PreserveFormatting:=True&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Unfortunately the interface I_OI_SCRIPT_COLLECTION has no documentation, the "documentation" in online help is not very useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Has anyone any clues?&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;Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Jun 2009 12:41:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316614#M163834</guid>
      <dc:creator>andreas_schreyer</dc:creator>
      <dc:date>2009-06-04T12:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: Need OI Example - ADD_SCRIPT_FROM_TABLE and EXECUTE_MACRO</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316615#M163835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;inspite of no one ever got any answer in this thread, I would like to give it a new try.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I observe the same phenomenons that norman described. When I use ADD_SCRIPT_FROM_TABLE an give only three lines of code I do not get any error. If I give more lines, I get message SOFFICEINTEGRATION 118.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But although the three lines example does not give an error, there is no makro in the excel-sheet at the end. So I doubt, that this method works as desired.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did anyone of you by now made a go of this method? Or perhaps found another way to put an macro to excel?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Aug 2009 13:25:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316615#M163835</guid>
      <dc:creator>103343</dc:creator>
      <dc:date>2009-08-25T13:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: Need OI Example - ADD_SCRIPT_FROM_TABLE and EXECUTE_MACRO</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316616#M163836</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;after some days trying different approaches, i've finally got a working example.&lt;/P&gt;&lt;P&gt;The following code shows inserting and the calling of one small vba script with one subroutine (okadis_demo_1).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;types: 
  ts_source_code  type text1024,
  tt_source_code   type standard table of ts_source_code with default key.

form insert_and_call_macro
using   pptr_script_collection type ref to i_oi_script_collection.

  data: ls_source_code  type ts_source_code,
           lt_source_code  type tt_source_code,
           lsz_return_code type soi_ret_string.

* Building the Script - every line has to end with cr/lf
  ls_source_code = 'Sub okadis_demo()'. "#EC NOTEXT

  concatenate ls_source_code cl_abap_char_utilities=&amp;gt;cr_lf
  into ls_source_code.
  append ls_source_code 
           to lt_source_code.

  ls_source_code = 'MsgBox("Huhu1")'. "#EC NOTEXT
  concatenate ls_source_code cl_abap_char_utilities=&amp;gt;cr_lf
  into ls_source_code.
  append ls_source_code 
           to lt_source_code.

  ls_source_code = 'MsgBox("Huhu2")'. "#EC NOTEXT
  concatenate ls_source_code cl_abap_char_utilities=&amp;gt;cr_lf
  into ls_source_code.
  append ls_source_code 
           to lt_source_code.

  ls_source_code = 'End Sub'. "#EC NOTEXT
  concatenate ls_source_code cl_abap_char_utilities=&amp;gt;cr_lf
  into ls_source_code.
  append ls_source_code 
           to lt_source_code.

* Saving the subroutines under one module name ("okadis")
  call method pptr_script_collection-&amp;gt;add_script_from_table
  exporting  no_flush       = space
          script_name  = 'okadis'   "#EC NOTEXT
          script_type   = pptr_script_collection-&amp;gt;script_type_vbscript
          script_table  = lt_source_code
  importing  retcode         = lsz_return_code.

  call method c_oi_errors=&amp;gt;raise_message
  exporting type = 'E'.  

* Calling the script:
  call method pptr_document-&amp;gt;execute_macro
  exporting macro_string    = 'okadis_demo_1'                
                  script_name     = 'okadis'               "#EC NOTEXT
                  no_flush           = space
  importing retcode             = lsz_return_code.

  call method c_oi_errors=&amp;gt;raise_message
  exporting type = 'E'.
endform.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lars&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2009 12:55:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316616#M163836</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-29T12:55:51Z</dc:date>
    </item>
    <item>
      <title>Re: Need OI Example - ADD_SCRIPT_FROM_TABLE and EXECUTE_MACRO</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316617#M163837</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Lars Kempkens &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seams that you are the one with the best idea of how to invoke a excel sheet from ABAP with macro.&lt;/P&gt;&lt;P&gt;I have used your example where you mange to have Excel to start a message box from ABAP - and this seams to work perfectly!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I try to use the same method on more advanced macro statements I get errors when executing the macros.&lt;/P&gt;&lt;P&gt;here is what I try to start i excel:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ls_source_code = &lt;EM&gt;'Worksheets("Pivot 1").PivotTables("PivotTable1").PivotCache.Refresh'&lt;/EM&gt;. &lt;/P&gt;&lt;P&gt;CONCATENATE ls_source_code cl_abap_char_utilities=&amp;gt;cr_lf  INTO ls_source_code.&lt;/P&gt;&lt;P&gt;APPEND ls_source_code  TO lt_source_code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This code gives me following error :&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Error "Type mismatch: 'Worksheets'" occurred during macro execution&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please, please help me Lars K. or anybody else who had solved this issue...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Br&lt;/P&gt;&lt;P&gt;Lars Bregnedal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Mar 2010 07:14:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316617#M163837</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-03-19T07:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: Need OI Example - ADD_SCRIPT_FROM_TABLE and EXECUTE_MACRO</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316618#M163838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Lars Bregnedal,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you find a fix for this? I have a similar request and can't get passed a sapscript error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Jan 2011 13:29:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316618#M163838</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-01-20T13:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: Need OI Example - ADD_SCRIPT_FROM_TABLE and EXECUTE_MACRO</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316619#M163839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Lars,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a ton for the example. We are using in the similiar way of the example you have mentioned but we are getting short dump while calling .&lt;/P&gt;&lt;P&gt;Error: "Access via 'NULL' object reference not possible."&lt;/P&gt;&lt;P&gt;Runtime Errors : OBJECTS_OBJREF_NOT_ASSIGNED_NO&lt;/P&gt;&lt;P&gt;Exception         :    CX_SY_REF_IS_INITIAL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: L_SCRIPT_COLLECTION TYPE REF TO I_OI_SCRIPT_COLLECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; CALL METHOD  L_SCRIPT_COLLECTION-&amp;gt;ADD_SCRIPT_FROM_TABLE&lt;/P&gt;&lt;P&gt;  EXPORTING  NO_FLUSH       = ''&lt;/P&gt;&lt;P&gt;          SCRIPT_NAME  = 'Macro'&lt;/P&gt;&lt;P&gt;          SCRIPT_TYPE   = L_SCRIPT_COLLECTION-&amp;gt;SCRIPT_TYPE_VBSCRIPT&lt;/P&gt;&lt;P&gt;          SCRIPT_TABLE  = LT_SOURCE_CODE&lt;/P&gt;&lt;P&gt;  IMPORTING   ERROR = GC_ERROR&lt;/P&gt;&lt;P&gt;    RETCODE         = L_RETURN_CODE .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;could you please suggest how to call this method. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jun 2011 09:59:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316619#M163839</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-06-08T09:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: Need OI Example - ADD_SCRIPT_FROM_TABLE and EXECUTE_MACRO</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316620#M163840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Lars,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I cannot find class implementation for i_oi_script_collection.so i was getting short dump " Access via 'NULL' object reference not possible."     Runtime Errors:OBJECTS_OBJREF_NOT_ASSIGNED_NO     Exception:CX_SY_REF_IS_INITIAL&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried to find using "where used list" but did not get any result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help us how you have implemented the method ADD_FROM_SCRIPT_TABLE  ?.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since i could not find class implementation, i have done it in other way but still its not working. Kindly verify the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TYPES:&lt;/P&gt;&lt;P&gt;    TS_SOURCE_CODE  TYPE TEXT1024,&lt;/P&gt;&lt;P&gt;    TT_SOURCE_CODE   TYPE STANDARD TABLE OF TS_SOURCE_CODE WITH DEFAULT KEY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: LS_SOURCE_CODE  TYPE TS_SOURCE_CODE,&lt;/P&gt;&lt;P&gt;           LT_SOURCE_CODE  TYPE TT_SOURCE_CODE,&lt;/P&gt;&lt;P&gt;           L_RETURN_CODE TYPE SOI_RET_STRING.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LS_SOURCE_CODE = 'Sub Macro1()'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CONCATENATE LS_SOURCE_CODE CL_ABAP_CHAR_UTILITIES=&amp;gt;CR_LF&lt;/P&gt;&lt;P&gt;  INTO LS_SOURCE_CODE.&lt;/P&gt;&lt;P&gt;  APPEND LS_SOURCE_CODE&lt;/P&gt;&lt;P&gt;           TO LT_SOURCE_CODE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LS_SOURCE_CODE = 'ActiveSheet.PageSetup.PrintArea = ""'.&lt;/P&gt;&lt;P&gt;  CONCATENATE LS_SOURCE_CODE CL_ABAP_CHAR_UTILITIES=&amp;gt;CR_LF&lt;/P&gt;&lt;P&gt;  INTO LS_SOURCE_CODE.&lt;/P&gt;&lt;P&gt;  APPEND LS_SOURCE_CODE&lt;/P&gt;&lt;P&gt;           TO LT_SOURCE_CODE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LS_SOURCE_CODE = 'With ActiveSheet.PageSetup'.&lt;/P&gt;&lt;P&gt;  CONCATENATE LS_SOURCE_CODE CL_ABAP_CHAR_UTILITIES=&amp;gt;CR_LF&lt;/P&gt;&lt;P&gt;  INTO LS_SOURCE_CODE.&lt;/P&gt;&lt;P&gt;  APPEND LS_SOURCE_CODE&lt;/P&gt;&lt;P&gt;           TO LT_SOURCE_CODE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LS_SOURCE_CODE = '.Orientation = xlLandscape'.&lt;/P&gt;&lt;P&gt;  CONCATENATE LS_SOURCE_CODE CL_ABAP_CHAR_UTILITIES=&amp;gt;CR_LF&lt;/P&gt;&lt;P&gt;  INTO LS_SOURCE_CODE.&lt;/P&gt;&lt;P&gt;  APPEND LS_SOURCE_CODE&lt;/P&gt;&lt;P&gt;           TO LT_SOURCE_CODE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LS_SOURCE_CODE = 'End With'.&lt;/P&gt;&lt;P&gt;  CONCATENATE LS_SOURCE_CODE CL_ABAP_CHAR_UTILITIES=&amp;gt;CR_LF&lt;/P&gt;&lt;P&gt;  INTO LS_SOURCE_CODE.&lt;/P&gt;&lt;P&gt;  APPEND LS_SOURCE_CODE&lt;/P&gt;&lt;P&gt;           TO LT_SOURCE_CODE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LS_SOURCE_CODE = 'End Sub'.&lt;/P&gt;&lt;P&gt;  CONCATENATE LS_SOURCE_CODE CL_ABAP_CHAR_UTILITIES=&amp;gt;CR_LF&lt;/P&gt;&lt;P&gt;  INTO LS_SOURCE_CODE.&lt;/P&gt;&lt;P&gt;  APPEND LS_SOURCE_CODE&lt;/P&gt;&lt;P&gt;           TO LT_SOURCE_CODE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: table_url(256).&lt;/P&gt;&lt;P&gt; DATA: DOC_COOKIE TYPE I VALUE 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; CALL FUNCTION 'DP_CREATE_URL'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        type    = ''&lt;/P&gt;&lt;P&gt;        subtype = ''&lt;/P&gt;&lt;P&gt;      TABLES&lt;/P&gt;&lt;P&gt;        data    = LT_SOURCE_CODE&lt;/P&gt;&lt;P&gt;      CHANGING&lt;/P&gt;&lt;P&gt;        url     = table_url.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: CONTAINER_CONTROL TYPE REF TO C_OI_CONTAINER_CONTROL_PROXY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CREATE OBJECT CONTAINER_CONTROL.&lt;/P&gt;&lt;P&gt;    CALL METHOD container_control-&amp;gt;add_document_script&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        NO_FLUSH       = ''&lt;/P&gt;&lt;P&gt;        document_cookie = doc_cookie&lt;/P&gt;&lt;P&gt;        script_name     = 'Macro'&lt;/P&gt;&lt;P&gt;        script_type     = '1'&lt;/P&gt;&lt;P&gt;        script_url      = table_url&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        error           = gc_error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    APPEND gc_error TO gt_error_table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly suggest us how we should go ahead. please help us.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jun 2011 16:21:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-oi-example-add-script-from-table-and-execute-macro/m-p/1316620#M163840</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-06-08T16:21:39Z</dc:date>
    </item>
  </channel>
</rss>

