cancel
Showing results for 
Search instead for 
Did you mean: 

Open mailto link from a button

Torsten_
Advisor
Advisor
0 Kudos

Hi,

I try to open a new Mail client session by calling a malto link.

In case I use the LinkToUrl Component its works correct only the mail client window would be open.

In case I try to call the same link from the action event of button by using the method window_manager->create_external_window the mail client window would be open by a redirect from a browser window.

But the browser window is still open ;-[

It is possible to open a link in the action event like in LinkToUrl?

Or it is possible to hide the LinkToUrl Component and trigger the LinkToUrl via coding?

Thx

Torsten

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member184578
Active Contributor
0 Kudos

Hi Torsten,

Check this document :http://scn.sap.com/docs/DOC-34712 . You can open mail client onAction of button usine AcfExecute.

Hope this helps u.,

Regards,

Kiran

Former Member
0 Kudos

Hi Torsten,

     You can achieve the same using a onaction event of a button.

   If you dont want to use 'indow_manager->create_external_window' then you can try using a outbound plug of type 'EXIT in your window where you can add the parameter URL of type string & pass your malto

link there.

Now in your button action event handler you can fire that plug & it will open a mail client window in a separate window.

One more suggestion is use window_manager->create_external_window in the action to open the mail clint window & then if you want to close the parent window then try using the 'CLOSE_WINDOW'

parameter of the same outbound plug ( here parameter URL will not work , as both cannot be used at the same time. )

Reply in  case of any clarification.

Regards,

Monishankar Chatterjee

Abhinav_Sharma
Contributor
0 Kudos

Hi Torsten,

If I understand correctly you want to handle some vent when user clicks on the mail link and you want to open the mail client without opening a browser window. This is quite possible and I have implemented the same using FormattedTextView UI element.

You dont need to use the LinkToAction or LinkToUrl. This can be achieved using FormattedTextView.

Follow these steps:

  • Create a context attribute of type String, say mail.
  • Bind the TEXT property of the FormattedTextView with the mail attribute.
  • Assign onAction event of FormattedTextView to the custom action, lets say SEND_MAIL.
  • Formulate a link in wdDoInit or any other method based on business requirements as follow:

        DATA: el_root type REF TO if_wd_context_element,
                  lv_mail type string.
 

                  lv_mail = `Click <a href="mailto:someone@example.com">here</a> to send mail`.
                  el_root = wd_context->get_element( ).
                  el_root->set_attribute( exporting name = 'MAIL' VALUE = LV_MAIL ).

  • The above will display a text with an embedded mailto link
  • When user clicks on the link, the action will be handled and here you can write your business logic.

Thanks!

Abhinav

Torsten_
Advisor
Advisor
0 Kudos

Hi,

in that case I've the same result as in case I use the LinkToUrl Component.

I need a way to use a button to trigger the event.

Torsten