<?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: MailMerge in Word using SAP - Problem with locking variable fields in document header - OLE in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/mailmerge-in-word-using-sap-problem-with-locking-variable-fields-in/m-p/412657#M11041</link>
    <description>&lt;P&gt;You should better ask the question in a non-ABAP forum, especially stackoverflow.&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jul 2017 18:26:42 GMT</pubDate>
    <dc:creator>Sandra_Rossi</dc:creator>
    <dc:date>2017-07-03T18:26:42Z</dc:date>
    <item>
      <title>MailMerge in Word using SAP - Problem with locking variable fields in document header - OLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mailmerge-in-word-using-sap-problem-with-locking-variable-fields-in/m-p/412654#M11038</link>
      <description>&lt;P&gt;I'm developing a custom tool to use SAP to perform MailMerge on office Word. From a table in SAP I let the system populate the variables contained in the &lt;STRONG&gt;header &lt;/STRONG&gt;of a Word template in order to print it. To do this we are using some standard &lt;STRONG&gt;OLE &lt;/STRONG&gt;instructions, marking the document as final before to preview it, in order to make it not changeable and to keep variables' values.&lt;/P&gt;&lt;P&gt;But we noticed that this "trick" works only on &lt;STRONG&gt;Word &lt;/STRONG&gt;versions until &lt;STRONG&gt;2007&lt;/STRONG&gt;. After this version is no longer possible to keep variables' values in header if the document is just "&lt;EM&gt;marked as final&lt;/EM&gt;" (this is a problem due to the Word versions very common on the internet). So I tried to use the &lt;STRONG&gt;lock functionality&lt;/STRONG&gt; (CTRL+F11) that should work always (and it works if I try on a Word document with variables in header). But someway instructions don't do their job through SAP! I paste here the whole instructions, I'm not an abaper but I hope you experts have any idea to overcome this issue.&lt;/P&gt;&lt;P&gt;Thank you in advance! &lt;/P&gt;&lt;P&gt;PS. I'm using SAP GUI 740 last patched and I already referred to several SAP notes (mainly 1645315 and 2100448)&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;CALL METHOD OF w_word 'ActiveWindow' = w_activewindow.&lt;BR /&gt;
 IF sy-subrc NE 0 .&lt;BR /&gt;
 MESSAGE i398(00) WITH 'Error ActiveWindow'.&lt;BR /&gt;
 LEAVE PROGRAM .&lt;BR /&gt;
 ENDIF .&lt;BR /&gt;
&lt;BR /&gt;
 CALL METHOD OF w_activewindow 'ActivePane' = w_activepane.&lt;BR /&gt;
 IF sy-subrc NE 0 .&lt;BR /&gt;
 MESSAGE i398(00) WITH 'Error ActivePane'.&lt;BR /&gt;
 LEAVE PROGRAM .&lt;BR /&gt;
 ENDIF .&lt;BR /&gt;
&lt;BR /&gt;
 CALL METHOD OF w_activepane 'View' = w_activeview.&lt;BR /&gt;
 IF sy-subrc NE 0 .&lt;BR /&gt;
 MESSAGE i398(00) WITH 'Error View'.&lt;BR /&gt;
 LEAVE PROGRAM .&lt;BR /&gt;
 ENDIF .&lt;BR /&gt;
&lt;BR /&gt;
 SET PROPERTY OF w_activeview 'SeekView' = '9'. " header view.&lt;BR /&gt;
 IF sy-subrc NE 0 .&lt;BR /&gt;
 MESSAGE i398(00) WITH 'Error SeekView = 9'.&lt;BR /&gt;
 LEAVE PROGRAM .&lt;BR /&gt;
 ENDIF .&lt;BR /&gt;
*&lt;BR /&gt;
* Selection.WholeStory&lt;BR /&gt;
* Selection.Fields.Locked = True&lt;BR /&gt;
 CALL METHOD OF w_activepane 'Selection' = w_selection.&lt;BR /&gt;
 IF sy-subrc NE 0 .&lt;BR /&gt;
 MESSAGE i398(00) WITH 'Error Selection'.&lt;BR /&gt;
 LEAVE PROGRAM .&lt;BR /&gt;
 ENDIF .&lt;/P&gt;&lt;P&gt;* Selection.WholeStory&lt;BR /&gt;
 CALL METHOD OF w_selection 'WholeStory' = w_wholestory.&lt;BR /&gt;
 IF sy-subrc NE 0 .&lt;BR /&gt;
 MESSAGE i398(00) WITH 'Error WholeStory'.&lt;BR /&gt;
 LEAVE PROGRAM .&lt;BR /&gt;
 ENDIF .&lt;/P&gt;&lt;P&gt;   CALL METHOD OF w_selection 'Fields' = w_fields.&lt;BR /&gt;
 IF sy-subrc NE 0.&lt;BR /&gt;
 ENDIF.&lt;BR /&gt;
&lt;BR /&gt;
 move 1 to ld_locked.&lt;BR /&gt;
 CALL METHOD OF w_fields 'Locked' = ld_locked.&lt;BR /&gt;
 IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;ENDIF. &lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 06:16:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mailmerge-in-word-using-sap-problem-with-locking-variable-fields-in/m-p/412654#M11038</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-07-03T06:16:24Z</dc:date>
    </item>
    <item>
      <title>Re: MailMerge in Word using SAP - Problem with locking variable fields in document header - OLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mailmerge-in-word-using-sap-problem-with-locking-variable-fields-in/m-p/412655#M11039</link>
      <description>&lt;P&gt;I did an ABAP controlled Word mail merge back in 2003. We used simple text replace, replacing tags like &amp;lt;&amp;lt;docno&amp;gt;&amp;gt; with the document number, for example, rather than variables.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 06:18:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mailmerge-in-word-using-sap-problem-with-locking-variable-fields-in/m-p/412655#M11039</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2017-07-03T06:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: MailMerge in Word using SAP - Problem with locking variable fields in document header - OLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mailmerge-in-word-using-sap-problem-with-locking-variable-fields-in/m-p/412656#M11040</link>
      <description>&lt;P&gt;Thank you for sharing, I will consider this as a last chance maybe.&lt;BR /&gt;I've the feeling we are near to the solution, but something is still missing.&lt;/P&gt;&lt;P&gt;Any other idea regarding this issue?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 15:09:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mailmerge-in-word-using-sap-problem-with-locking-variable-fields-in/m-p/412656#M11040</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-07-03T15:09:00Z</dc:date>
    </item>
    <item>
      <title>Re: MailMerge in Word using SAP - Problem with locking variable fields in document header - OLE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/mailmerge-in-word-using-sap-problem-with-locking-variable-fields-in/m-p/412657#M11041</link>
      <description>&lt;P&gt;You should better ask the question in a non-ABAP forum, especially stackoverflow.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 18:26:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/mailmerge-in-word-using-sap-problem-with-locking-variable-fields-in/m-p/412657#M11041</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2017-07-03T18:26:42Z</dc:date>
    </item>
  </channel>
</rss>

