<?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: Button with HTML-Link in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/button-with-html-link/m-p/1143576#M115409</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;develop a FM with the following code and call it onclick of a button.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;function y_outlook_mail_create.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(I_SUBJECT) OPTIONAL
*"  TABLES
*"      EMAIL_BODY STRUCTURE  SOLI OPTIONAL
*"      ADDRESS_LIST STRUCTURE  SOLI OPTIONAL
*"      ATTACHMENTS STRUCTURE  SOLI OPTIONAL
*"  EXCEPTIONS
*"      INVALID_PATH
*"      DOWNLOAD_FAILED
*"      EXECUTION_FAILED
*"----------------------------------------------------------------------
 data:
    v_translate(2),
    it_vbs          like soli
       occurs 50 with header line,
    v_last,
    v_vbs_filename  like rlgrap-filename,
    wf_filename like rlgrap-filename ,
    commandline(1000).
*- Prepare a code to translate a quote into a hex-tab
*- so it can then be translated back to 2 double quotes.
  concatenate '"' '9' into v_translate.
*  CON_HEX-TAB'

  append:
    'Dim myolapp                                        ' to it_vbs,
    'Dim olNamespace                                    ' to it_vbs,
    'Dim myItem                                         ' to it_vbs,
    'Dim myRecipient                                    ' to it_vbs,
    'Dim myAttachments                                  ' to it_vbs,
    '                                                   ' to it_vbs,
    'Set myolapp = CreateObject("Outlook.Application")  ' to it_vbs,
    'Set olNamespace = myolapp.GetNamespace("MAPI")     ' to it_vbs,
    'Set myItem = myolapp.CreateItem(olMailItem)        ' to it_vbs,
    '                                                   ' to it_vbs.

*- Translate the body into a single line.
  loop at address_list.
    concatenate
      'Set myRecipient = myItem.Recipients.Add("'
      address_list
      '")'
      into it_vbs.
    append it_vbs.
  endloop.

  append:
    'myItem.VotingOptions = "Approve;Reject"' to it_vbs.
*- Build the subject line.
  concatenate
    'myItem.Subject = "'
    i_subject
    '"'
    into it_vbs.
  append it_vbs.
*- Prepare attachments
  append:
    'Set myAttachments = myItem.Attachments' to it_vbs.
*- Check if the attachment exists
  loop at attachments.
  clear wf_filename .
  move: attachments-line to wf_filename .
    call function 'WS_QUERY'
         exporting
              filename       = wf_filename "ATTACHMENTS
              query          = 'FE'
         exceptions
              inv_query      = 1
              no_batch       = 2
              frontend_error = 3
              others         = 4.
    if sy-subrc eq 0.
      concatenate 'myAttachments.Add("'
                  attachments
                  '")'
        into it_vbs.
      append it_vbs.
* '    olByValue, 1, "4th Quarter 1996 Results Chart"'
*      append '    olByReference, 1' to it_vbs.
    else.
      message i017(zz) with
         'Could not attach' attachments.
    endif.
  endloop.

*- Prepare the email body.
  clear: v_last, it_vbs.
  append it_vbs.
  loop at email_body.
    at first.
      append 'myitem.HTMLbody = _' to it_vbs.
    endat.
    at last.
      v_last = 'X'.
    endat.

    translate email_body using v_translate.
    while sy-subrc eq 0.
      replace '09' with '""' into email_body.
    endwhile.

    if v_last = 'X'.
      concatenate '"' email_body '" &amp;amp;vbCrLf '
        into it_vbs.
    else.
      concatenate '"' email_body '" &amp;amp;vbCrLf  &amp;amp;_'
        into it_vbs.
    endif.
    append it_vbs.
  endloop.

  append 'myItem.Display' to it_vbs.

*- Prepare the vbscript filename for download and execution
  clear v_vbs_filename.
  call function 'WS_QUERY'
       exporting
            environment    = 'TEMP'
            query          = 'EN'
       importing
            return         = v_vbs_filename
       exceptions
            inv_query      = 1
            no_batch       = 2
            frontend_error = 3
            others         = 4.
  if sy-subrc &amp;lt;&amp;gt; 0.
    raise invalid_path.
  endif.
  concatenate v_vbs_filename 'mail.vbs'
    into v_vbs_filename.
  commandline = v_vbs_filename.
*- Download the file
  call function 'WS_DOWNLOAD'
       exporting
            filename            = v_vbs_filename
            filetype            = 'DAT'
            mode                = 'S'
       tables
            data_tab            = it_vbs
       exceptions
            file_open_error     = 1
            file_write_error    = 2
            invalid_filesize    = 3
            invalid_table_width = 4
            invalid_type        = 5
            no_batch            = 6
            unknown_error       = 7
            others              = 8.
  if sy-subrc &amp;lt;&amp;gt; 0.
    raise download_failed.
  endif.

  call function 'WS_EXECUTE'
       exporting
            commandline    = commandline
            program        = 'WSCRIPT.EXE'
       exceptions
            frontend_error = 1
            no_batch       = 2
            prog_not_found = 3
            illegal_option = 4
            others         = 5.
  if sy-subrc &amp;lt;&amp;gt; 0.
    raise execution_failed.
  endif.

endfunction.&lt;/CODE&gt;&lt;/PRE&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>Sat, 31 Dec 2005 06:31:56 GMT</pubDate>
    <dc:creator>athavanraja</dc:creator>
    <dc:date>2005-12-31T06:31:56Z</dc:date>
    <item>
      <title>Button with HTML-Link</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/button-with-html-link/m-p/1143575#M115408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi!&lt;/P&gt;&lt;P&gt;I've to create buttons on a dynpro, which process the currently installed frontend mail client (zB. Notes, Outlook, etc.) and fill the recipients, subject and mail body dynamically at the end of "PROCESS AFTER INPUT".&lt;/P&gt;&lt;P&gt;The application handling should be like a HTML-Link (for example: &amp;lt;a href="mailto:beispiel@example.org?body=Hello%20Fritz,%0D%0A%0D%0Aich%20wollte%20nur%20sagen,%20dass%20"&amp;gt;Mail mit Body&amp;lt;/a&amp;gt;).&lt;/P&gt;&lt;P&gt;The solution should work in SAPGui for Windows and SAPGui for HTML.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anybody knows a example coding?&lt;/P&gt;&lt;P&gt;Any hints are welcome.&lt;/P&gt;&lt;P&gt;Thanks, happy new year!&lt;/P&gt;&lt;P&gt;Peter Lintner&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Dec 2005 14:35:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/button-with-html-link/m-p/1143575#M115408</guid>
      <dc:creator>Peter_Lintner</dc:creator>
      <dc:date>2005-12-30T14:35:33Z</dc:date>
    </item>
    <item>
      <title>Re: Button with HTML-Link</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/button-with-html-link/m-p/1143576#M115409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;develop a FM with the following code and call it onclick of a button.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;function y_outlook_mail_create.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(I_SUBJECT) OPTIONAL
*"  TABLES
*"      EMAIL_BODY STRUCTURE  SOLI OPTIONAL
*"      ADDRESS_LIST STRUCTURE  SOLI OPTIONAL
*"      ATTACHMENTS STRUCTURE  SOLI OPTIONAL
*"  EXCEPTIONS
*"      INVALID_PATH
*"      DOWNLOAD_FAILED
*"      EXECUTION_FAILED
*"----------------------------------------------------------------------
 data:
    v_translate(2),
    it_vbs          like soli
       occurs 50 with header line,
    v_last,
    v_vbs_filename  like rlgrap-filename,
    wf_filename like rlgrap-filename ,
    commandline(1000).
*- Prepare a code to translate a quote into a hex-tab
*- so it can then be translated back to 2 double quotes.
  concatenate '"' '9' into v_translate.
*  CON_HEX-TAB'

  append:
    'Dim myolapp                                        ' to it_vbs,
    'Dim olNamespace                                    ' to it_vbs,
    'Dim myItem                                         ' to it_vbs,
    'Dim myRecipient                                    ' to it_vbs,
    'Dim myAttachments                                  ' to it_vbs,
    '                                                   ' to it_vbs,
    'Set myolapp = CreateObject("Outlook.Application")  ' to it_vbs,
    'Set olNamespace = myolapp.GetNamespace("MAPI")     ' to it_vbs,
    'Set myItem = myolapp.CreateItem(olMailItem)        ' to it_vbs,
    '                                                   ' to it_vbs.

*- Translate the body into a single line.
  loop at address_list.
    concatenate
      'Set myRecipient = myItem.Recipients.Add("'
      address_list
      '")'
      into it_vbs.
    append it_vbs.
  endloop.

  append:
    'myItem.VotingOptions = "Approve;Reject"' to it_vbs.
*- Build the subject line.
  concatenate
    'myItem.Subject = "'
    i_subject
    '"'
    into it_vbs.
  append it_vbs.
*- Prepare attachments
  append:
    'Set myAttachments = myItem.Attachments' to it_vbs.
*- Check if the attachment exists
  loop at attachments.
  clear wf_filename .
  move: attachments-line to wf_filename .
    call function 'WS_QUERY'
         exporting
              filename       = wf_filename "ATTACHMENTS
              query          = 'FE'
         exceptions
              inv_query      = 1
              no_batch       = 2
              frontend_error = 3
              others         = 4.
    if sy-subrc eq 0.
      concatenate 'myAttachments.Add("'
                  attachments
                  '")'
        into it_vbs.
      append it_vbs.
* '    olByValue, 1, "4th Quarter 1996 Results Chart"'
*      append '    olByReference, 1' to it_vbs.
    else.
      message i017(zz) with
         'Could not attach' attachments.
    endif.
  endloop.

*- Prepare the email body.
  clear: v_last, it_vbs.
  append it_vbs.
  loop at email_body.
    at first.
      append 'myitem.HTMLbody = _' to it_vbs.
    endat.
    at last.
      v_last = 'X'.
    endat.

    translate email_body using v_translate.
    while sy-subrc eq 0.
      replace '09' with '""' into email_body.
    endwhile.

    if v_last = 'X'.
      concatenate '"' email_body '" &amp;amp;vbCrLf '
        into it_vbs.
    else.
      concatenate '"' email_body '" &amp;amp;vbCrLf  &amp;amp;_'
        into it_vbs.
    endif.
    append it_vbs.
  endloop.

  append 'myItem.Display' to it_vbs.

*- Prepare the vbscript filename for download and execution
  clear v_vbs_filename.
  call function 'WS_QUERY'
       exporting
            environment    = 'TEMP'
            query          = 'EN'
       importing
            return         = v_vbs_filename
       exceptions
            inv_query      = 1
            no_batch       = 2
            frontend_error = 3
            others         = 4.
  if sy-subrc &amp;lt;&amp;gt; 0.
    raise invalid_path.
  endif.
  concatenate v_vbs_filename 'mail.vbs'
    into v_vbs_filename.
  commandline = v_vbs_filename.
*- Download the file
  call function 'WS_DOWNLOAD'
       exporting
            filename            = v_vbs_filename
            filetype            = 'DAT'
            mode                = 'S'
       tables
            data_tab            = it_vbs
       exceptions
            file_open_error     = 1
            file_write_error    = 2
            invalid_filesize    = 3
            invalid_table_width = 4
            invalid_type        = 5
            no_batch            = 6
            unknown_error       = 7
            others              = 8.
  if sy-subrc &amp;lt;&amp;gt; 0.
    raise download_failed.
  endif.

  call function 'WS_EXECUTE'
       exporting
            commandline    = commandline
            program        = 'WSCRIPT.EXE'
       exceptions
            frontend_error = 1
            no_batch       = 2
            prog_not_found = 3
            illegal_option = 4
            others         = 5.
  if sy-subrc &amp;lt;&amp;gt; 0.
    raise execution_failed.
  endif.

endfunction.&lt;/CODE&gt;&lt;/PRE&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>Sat, 31 Dec 2005 06:31:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/button-with-html-link/m-p/1143576#M115409</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2005-12-31T06:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Button with HTML-Link</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/button-with-html-link/m-p/1143577#M115410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;to open a browser you can just use FM CALL_BROWSER&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>Sat, 31 Dec 2005 10:03:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/button-with-html-link/m-p/1143577#M115410</guid>
      <dc:creator>athavanraja</dc:creator>
      <dc:date>2005-12-31T10:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: Button with HTML-Link</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/button-with-html-link/m-p/1143578#M115411</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;Another option to open a browser is&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
call method cl_gui_frontend_services=&amp;gt;execute
 exporting
   document = 'http://www.sap.com'
 exceptions
   others   = 1.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suresh Datti&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 31 Dec 2005 11:54:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/button-with-html-link/m-p/1143578#M115411</guid>
      <dc:creator>suresh_datti</dc:creator>
      <dc:date>2005-12-31T11:54:22Z</dc:date>
    </item>
  </channel>
</rss>

