<?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: Protected(read-only) Excel document as e-mail attachment in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/protected-read-only-excel-document-as-e-mail-attachment/m-p/8541968#M1657416</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kerim,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand that the program is generating the data from some internal table, and then attaching it to the email.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In that case, the attachment is really just a text file (with XLS extension) and gets opened in excel. Hence it truly does not have any excel features such as read only / protected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For those things we may have to use OLE concept. The steps could be like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a) create the text file, and save on local machine/front-end.&lt;/P&gt;&lt;P&gt;b) then open the same file using commands of OLE&lt;/P&gt;&lt;P&gt;c) then pass OLE command for read only / protect&lt;/P&gt;&lt;P&gt;d) save the file again, now as true .XLS format, using OLE command. (this will be a new file)&lt;/P&gt;&lt;P&gt;e) Now, attach the NEW XLS file from the front end to the email. This file will be a binary file now in MS EXCEL format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not done exactly this before but I had used OLE for test purposes. Hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amit Mittal.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 Feb 2012 05:34:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2012-02-01T05:34:51Z</dc:date>
    <item>
      <title>Protected(read-only) Excel document as e-mail attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/protected-read-only-excel-document-as-e-mail-attachment/m-p/8541965#M1657413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a program that sends email with Excel attachment. My request is to send this attachment as protected or/and read-only document. I am using cl_bcs class to send mail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found similar 2-3 topics about this issue but all useless. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jan 2012 11:03:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/protected-read-only-excel-document-as-e-mail-attachment/m-p/8541965#M1657413</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-27T11:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: Protected(read-only) Excel document as e-mail attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/protected-read-only-excel-document-as-e-mail-attachment/m-p/8541966#M1657414</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Still no answers?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2012 13:51:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/protected-read-only-excel-document-as-e-mail-attachment/m-p/8541966#M1657414</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-31T13:51:07Z</dc:date>
    </item>
    <item>
      <title>Re: Protected(read-only) Excel document as e-mail attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/protected-read-only-excel-document-as-e-mail-attachment/m-p/8541967#M1657415</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;After reading your post, I looked at all the BCS-associated methods I could find and searched SCN.  I don't find any reference to setting a read-only indicator on the attachment unfortunately.  I was hoping to find a "no change" parameter, but had no luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Jan 2012 19:39:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/protected-read-only-excel-document-as-e-mail-attachment/m-p/8541967#M1657415</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-01-31T19:39:15Z</dc:date>
    </item>
    <item>
      <title>Re: Protected(read-only) Excel document as e-mail attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/protected-read-only-excel-document-as-e-mail-attachment/m-p/8541968#M1657416</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kerim,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand that the program is generating the data from some internal table, and then attaching it to the email.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In that case, the attachment is really just a text file (with XLS extension) and gets opened in excel. Hence it truly does not have any excel features such as read only / protected.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For those things we may have to use OLE concept. The steps could be like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a) create the text file, and save on local machine/front-end.&lt;/P&gt;&lt;P&gt;b) then open the same file using commands of OLE&lt;/P&gt;&lt;P&gt;c) then pass OLE command for read only / protect&lt;/P&gt;&lt;P&gt;d) save the file again, now as true .XLS format, using OLE command. (this will be a new file)&lt;/P&gt;&lt;P&gt;e) Now, attach the NEW XLS file from the front end to the email. This file will be a binary file now in MS EXCEL format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not done exactly this before but I had used OLE for test purposes. Hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amit Mittal.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Feb 2012 05:34:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/protected-read-only-excel-document-as-e-mail-attachment/m-p/8541968#M1657416</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-01T05:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: Protected(read-only) Excel document as e-mail attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/protected-read-only-excel-document-as-e-mail-attachment/m-p/8541969#M1657417</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is another method also, apart from OLE. It is using XML / XSLT concept.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just tried it and it works fine. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a) the file opens in READ Mode preferred&lt;/P&gt;&lt;P&gt;b) It is protected, i.e. we cannot change the cells&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Make one Z program (code is given below as "SOURCE1")&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Inside the code, double-click on "ztest_np_xls" which will take you to new screen of XSLT. Inside that, there is one  tab "Source code". Inside that remove the old code of 5-7 lines, and copy-paste my code. "SOURCE2"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SOURCE1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZTEST_NP_EXCEL_XML
*&amp;amp;
*&amp;amp; Download the formatted excel file using XML
*&amp;amp;---------------------------------------------------------------------*

REPORT  ztest_np_excel_xml.

TYPES: BEGIN OF ty_mara,
       matnr TYPE matnr,
       maktx TYPE char30,
       END   OF ty_mara.

DATA: itab TYPE STANDARD TABLE OF ty_mara,
      la_tab LIKE LINE OF itab,
      xmlstr TYPE string.

START-OF-SELECTION.

*---------
* Test table
*---------
  la_tab-matnr = 'TEST1'.
  la_tab-maktx = 'Test description'.
  APPEND la_tab TO itab.

  la_tab-matnr = 'TEST2'.
  la_tab-maktx = 'Test description 2'.
  APPEND la_tab TO itab.

*---------
* Get the XML data excel
*---------
  CALL TRANSFORMATION ztest_np_xls
    SOURCE table = itab
    RESULT XML xmlstr.

*---------
* Download the file
*---------

* Fill the table
  DATA: xml_table TYPE STANDARD TABLE OF string.

  APPEND xmlstr TO xml_table.

  DATA: window_title TYPE string,
        fullpath TYPE string,
        path TYPE string,
        user_action TYPE i,
        default_extension TYPE string,
        default_file_name TYPE string,
        file_filter TYPE  string,
        filename TYPE string,
        initialpath TYPE string.

* File selection
  MOVE '.XLS' TO default_extension.
  MOVE 'XLS files (*.XLS)|*.XLS' TO file_filter.

  CALL METHOD cl_gui_frontend_services=&amp;gt;file_save_dialog
    EXPORTING
      default_extension = default_extension
      default_file_name = default_file_name
      file_filter       = file_filter
      initial_directory = initialpath
    CHANGING
      filename          = filename
      path              = path
      fullpath          = fullpath
      user_action       = user_action
    EXCEPTIONS
      cntl_error        = 1
      error_no_gui      = 2
      OTHERS            = 3.
  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.

* download file
  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename                = fullpath
      filetype                = 'ASC'
    TABLES
      data_tab                = xml_table
    EXCEPTIONS
      file_write_error        = 1
      no_batch                = 2
      gui_refuse_filetransfer = 3
      invalid_type            = 4
      OTHERS                  = 5.
  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;-&lt;/P&gt;&lt;HR originaltext="--------------------" /&gt;&lt;P&gt;SOURCE2 in next &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;regards,&lt;/P&gt;&lt;P&gt;Amit Mittal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Amit Mittal on Feb 1, 2012 3:59 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Amit Mittal on Feb 1, 2012 4:00 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Amit Mittal on Feb 1, 2012 4:01 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Amit Mittal on Feb 1, 2012 4:01 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Amit Mittal on Feb 1, 2012 4:02 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Amit Mittal on Feb 1, 2012 4:03 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Feb 2012 10:29:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/protected-read-only-excel-document-as-e-mail-attachment/m-p/8541969#M1657417</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-01T10:29:10Z</dc:date>
    </item>
    <item>
      <title>Re: Protected(read-only) Excel document as e-mail attachment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/protected-read-only-excel-document-as-e-mail-attachment/m-p/8541970#M1657418</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SOURCE2 (as per previus reply)&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;PRE&gt;&lt;CODE&gt;&amp;lt;?xml version="1.0"?&amp;gt;
&amp;lt;?mso-application progid="Excel.Sheet"?&amp;gt;
&amp;lt;tt:transform xmlns:tt='http://www.sap.com/transformation-templates'&amp;gt;

&amp;lt;tt:root name='table'/&amp;gt;

&amp;lt;tt:template&amp;gt;


&amp;lt;Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o="urn:schemas-microsoft-com:office:office"
 xmlns:x="urn:schemas-microsoft-com:office:excel"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html="http://www.w3.org/TR/REC-html40"&amp;gt;
 &amp;lt;DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"&amp;gt;
  &amp;lt;Author&amp;gt;authorname&amp;lt;/Author&amp;gt;
  &amp;lt;LastAuthor&amp;gt;authorname&amp;lt;/LastAuthor&amp;gt;
  &amp;lt;Created&amp;gt;2012-02-01T10:12:47Z&amp;lt;/Created&amp;gt;
  &amp;lt;Company&amp;gt;&amp;lt;/Company&amp;gt;
  &amp;lt;Version&amp;gt;12.00&amp;lt;/Version&amp;gt;
 &amp;lt;/DocumentProperties&amp;gt;
 &amp;lt;OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"&amp;gt;
  &amp;lt;ReadOnlyRecommended/&amp;gt;
 &amp;lt;/OfficeDocumentSettings&amp;gt;
 &amp;lt;ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"&amp;gt;
  &amp;lt;WindowHeight&amp;gt;11055&amp;lt;/WindowHeight&amp;gt;
  &amp;lt;WindowWidth&amp;gt;19155&amp;lt;/WindowWidth&amp;gt;
  &amp;lt;WindowTopX&amp;gt;0&amp;lt;/WindowTopX&amp;gt;
  &amp;lt;WindowTopY&amp;gt;120&amp;lt;/WindowTopY&amp;gt;
  &amp;lt;ProtectStructure&amp;gt;False&amp;lt;/ProtectStructure&amp;gt;
  &amp;lt;ProtectWindows&amp;gt;False&amp;lt;/ProtectWindows&amp;gt;
 &amp;lt;/ExcelWorkbook&amp;gt;
 &amp;lt;Styles&amp;gt;
  &amp;lt;Style ss:ID="Default" ss:Name="Normal"&amp;gt;
   &amp;lt;Alignment ss:Vertical="Bottom"/&amp;gt;
   &amp;lt;Borders/&amp;gt;
   &amp;lt;Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/&amp;gt;
   &amp;lt;Interior/&amp;gt;
   &amp;lt;NumberFormat/&amp;gt;
   &amp;lt;Protection/&amp;gt;
  &amp;lt;/Style&amp;gt;
  &amp;lt;Style ss:ID="s62"&amp;gt;
   &amp;lt;Protection/&amp;gt;
  &amp;lt;/Style&amp;gt;
 &amp;lt;/Styles&amp;gt;
 &amp;lt;Worksheet ss:Name="Sheet1" ss:Protected="1"&amp;gt;
  &amp;lt;Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="3" x:FullColumns="1"
   x:FullRows="1" ss:StyleID="s62" ss:DefaultRowHeight="15"&amp;gt;
   &amp;lt;Row ss:AutoFitHeight="0"&amp;gt;
    &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type="String"&amp;gt;ColA&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;
    &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type="String"&amp;gt;ColB&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;
   &amp;lt;/Row&amp;gt;
   &amp;lt;Row ss:AutoFitHeight="0"&amp;gt;
    &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type="String"&amp;gt;d1&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;
    &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type="String"&amp;gt;db&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;
   &amp;lt;/Row&amp;gt;
   &amp;lt;Row ss:AutoFitHeight="0"&amp;gt;
    &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type="String"&amp;gt;dc&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;
    &amp;lt;Cell&amp;gt;&amp;lt;Data ss:Type="String"&amp;gt;dd&amp;lt;/Data&amp;gt;&amp;lt;/Cell&amp;gt;
   &amp;lt;/Row&amp;gt;
  &amp;lt;/Table&amp;gt;
  &amp;lt;WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel"&amp;gt;
   &amp;lt;PageSetup&amp;gt;
    &amp;lt;Header x:Margin="0.3"/&amp;gt;
    &amp;lt;Footer x:Margin="0.3"/&amp;gt;
    &amp;lt;PageMargins x:Bottom="0.75" x:Left="0.7" x:Right="0.7" x:Top="0.75"/&amp;gt;
   &amp;lt;/PageSetup&amp;gt;
   &amp;lt;Unsynced/&amp;gt;
   &amp;lt;Print&amp;gt;
    &amp;lt;ValidPrinterInfo/&amp;gt;
    &amp;lt;HorizontalResolution&amp;gt;600&amp;lt;/HorizontalResolution&amp;gt;
    &amp;lt;VerticalResolution&amp;gt;600&amp;lt;/VerticalResolution&amp;gt;
   &amp;lt;/Print&amp;gt;
   &amp;lt;Selected/&amp;gt;
   &amp;lt;Panes&amp;gt;
    &amp;lt;Pane&amp;gt;
     &amp;lt;Number&amp;gt;3&amp;lt;/Number&amp;gt;
     &amp;lt;ActiveRow&amp;gt;22&amp;lt;/ActiveRow&amp;gt;
     &amp;lt;ActiveCol&amp;gt;2&amp;lt;/ActiveCol&amp;gt;
    &amp;lt;/Pane&amp;gt;
   &amp;lt;/Panes&amp;gt;
   &amp;lt;ProtectObjects&amp;gt;True&amp;lt;/ProtectObjects&amp;gt;
   &amp;lt;ProtectScenarios&amp;gt;True&amp;lt;/ProtectScenarios&amp;gt;
  &amp;lt;/WorksheetOptions&amp;gt;
 &amp;lt;/Worksheet&amp;gt;
&amp;lt;/Workbook&amp;gt;


&amp;lt;/tt:template&amp;gt;

&amp;lt;/tt:transform&amp;gt;&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;amit mittal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Amit Mittal on Feb 2, 2012 2:29 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Amit Mittal on Feb 2, 2012 2:30 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Feb 2012 10:34:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/protected-read-only-excel-document-as-e-mail-attachment/m-p/8541970#M1657418</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2012-02-01T10:34:10Z</dc:date>
    </item>
  </channel>
</rss>

