Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Hyperlink in email

Former Member
0 Likes
12,615

Hi gurus

I'm sending emails using SO_NEW_DOCUMENT_ATT_SEND_API1. The email body contains a message and a URL "http://........." plus an attachement. Everything is fine except that the URL doesn't appear as a hyperlink - ie its not underlined and doesn't react when clicked on.

The message and URL are both in t_contents_txt and the attachement in t_contents_bin.

The email will be received in Lotus Notes which will not autmatically make the URL a hyperlink.

Anybody got any suggestions?

Thanks

Brigitte

12 REPLIES 12
Read only

Former Member
0 Likes
5,818

HI Brigitte

I have tried adding the URL to the body of the mail and i was successful in displaying as HYPERLINK...

Eg: www.yahoo.com

Please re-check your code...

Kind Regards

Eswar

Read only

raja_thangamani
Active Contributor
0 Likes
5,818

Try HTML <"a href"> tag in email body..



`<`a href="http://www.yahoo.com"> http://www.yahoo.com </a`>

<b>In Tag, remove character ` when you use in your code</b>

Raja T

Message was edited by:

Raja T

Read only

Former Member
0 Likes
5,818

Eswar. I've tried numerous things to make it work. Telling me to check my code doesn't help because I obviously don't know what's wrong with it.

Raja.

Do you mean:

t_contents_txt = 'href=http://AUYHOK12:6370/viewer/notify/d_AUYHOK12^6370_4094.men'.

If you do, that didn't work - it just appears in my email as "href=http://AUYHOK12:6370/viewer/notify/d_AUYHOK12^6370_4094.men"

instead of just the "http://AUYHOK12:6370/viewer/notify/d_AUYHOK12^6370_4094.men"

I was getting before.

The way your message appears makes it difficult to understand (formatting characters appear).

Thanks

Brigitte

Read only

0 Likes
5,818

Hi,

Since its HTML code, i can not write with adding the special character <b>`</b>.

`<`a href="http://www.yahoo.com"> http://www.yahoo.com </a`> - Here remove the special character <b>`</b>. So that you will get the Hyper link.

Raja T

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
5,818

Hi Brigitte, what is the document type that you are using when calling the function module. If you are passing HTML, you should set the DOC_TYPE to HTM.

Regards,

Rich Heilman

Read only

0 Likes
5,818

For example, this program works fine in my system.



report zrich_0002.

data: maildata   like sodocchgi1.
data: mailtxt    like solisti1 occurs 10 with header line.
data: mailrec    like somlrec90 occurs 0  with header line.

start-of-selection.

  clear:    maildata, mailtxt,  mailrec.
  refresh:  mailtxt, mailrec.

  perform build_text_message.
  perform build_receivers.
  perform send_mail_nodialog..

************************************************************************
*      Form  BUILD_TEXT_MESSAGE
************************************************************************
form build_text_message.


  maildata-obj_name = 'TEST'.
  maildata-obj_descr = 'Test Subject'.


  mailtxt  = '<html>'.
  append mailtxt.


  mailtxt  = '<body>'.
  append mailtxt.

  mailtxt
   = '<a href="http:\www.sap.com" target="_blank">SAP Hyperlink</a> '.
  append mailtxt.

  mailtxt  = '</body>'.
  append mailtxt.

  mailtxt  = '</html>'.
  append mailtxt.

endform.

************************************************************************
*      Form  BUILD_RECEIVERS
************************************************************************
form build_receivers.

  mailrec-receiver = 'you@yourcompany.com'.
  mailrec-rec_type  = 'U'.
  append mailrec.

endform.

************************************************************************
*      Form  SEND_MAIL_NODIALOG
************************************************************************
form send_mail_nodialog.

  call function 'SO_NEW_DOCUMENT_SEND_API1'
       exporting
            document_data              = maildata
            document_type              = 'HTM'
            put_in_outbox              = 'X'
       tables
            object_header              = mailtxt
            object_content             = mailtxt
            receivers                  = mailrec
       exceptions
            too_many_receivers         = 1
            document_not_sent          = 2
            document_type_not_exist    = 3
            operation_no_authorization = 4
            parameter_error            = 5
            x_error                    = 6
            enqueue_error              = 7
            others                     = 8.
  if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.

endform.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
5,818

Hi brigitte,

1. Do 2 things, and it will work.

(i was facing the same problem).

2. while calling the FM SO_NEW_DOCUMENT_SEND_API1

document_type = 'HTM'

<b>* object_header = mailtxt <----- DO NOT PASS THIS PARAMETER</b>

regards,

amit m.

Read only

Former Member
0 Likes
5,818

Thank you all so much for your time. I have spent the morning trying to modify my code using your suggestions but nothing works. Every way I try to write my URL it still comes out in my Lotus Notes email without the hyperlink (but exactly as its written).

I thought perhaps it would help if you could see my code - then tell me what's wrong with it. I've left out the bits (setting up title,recipients and attachment) that obviously work ok.

Again, thanks for your input.

Brigitte

  • Create instructions to be displayed in the body of the email.

concatenate 'This email has been auto generated from SAP. You are'

'required to log onto SAP and authorise or reject the credit'

'claim. For instructions, open Mentor and go to Guide for'

'Managers > Quick Guide to Approving or Rejecting Claims.'

into t_objtxt separated by space.

append t_objtxt.

clear t_objtxt.

append t_objtxt.

t_objtxt

= 'http://AUYHOK12:6370/viewer/notify/d_AUYHOK12^6370_4094.men'.

append t_objtxt.

clear t_objtxt.

append t_objtxt.

  • Set up the email's attributes.

CLEAR w_index.

READ TABLE t_attachment INDEX w_index.

w_doc_data-doc_size

= ( w_index - 1 ) * 255 + STRLEN( t_attachment ).

w_doc_data-obj_langu = sy-langu.

w_doc_data-sensitivty = 'F'.

w_doc_data-obj_name = w_repid.

w_doc_data-obj_descr = 'Claims requiring your authorization'.

  • Create table containing information about structure of data table

t_packing_list-transf_bin = space.

t_packing_list-head_start = 1.

t_packing_list-head_num = 0.

t_packing_list-body_start = 1.

DESCRIBE TABLE t_objtxt LINES t_packing_list-body_num.

t_packing_list-doc_type = 'RAW'.

t_packing_list-obj_descr = w_title.

t_packing_list-obj_name = w_repid.

t_packing_list-doc_size = ( t_packing_list-body_num - 1 ) * 255

+ STRLEN( t_objtxt ).

APPEND t_packing_list.

t_packing_list-transf_bin = 'X'.

t_packing_list-head_start = 1.

t_packing_list-head_num = 1.

t_packing_list-body_start = 1.

DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.

t_packing_list-doc_type = 'XLS'.

t_packing_list-obj_descr = w_title.

t_packing_list-obj_name = w_repid.

t_packing_list-doc_size = ( t_packing_list-body_num - 1 ) * 255

+ STRLEN( t_objtxt ).

APPEND t_packing_list.

  • Send an email to each recipient with an attached list of documents to

  • be authorised.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = w_doc_data

document_type = 'HTM'

put_in_outbox = 'X'

commit_work = 'X'

TABLES

packing_list = t_packing_list

contents_bin = t_attachment

contents_txt = t_objtxt

receivers = t_receivers

EXCEPTIONS

too_many_receivers = 1

etc.

Read only

0 Likes
5,818
t_objtxt
= 'http://AUYHOK12:6370/viewer/notify/d_AUYHOK12^6370_4094.men'.

The above line does not represent an HTML string. THere is not tag here. See my example above. This link must be within HTML tags.

If this still doesn't work, there is a chance that your mail server is configured to strip any HTML on outgoing mail, incoming mail, or both. This could also be causing the problem.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
5,818

Rich. I tried it your way too. It came out in the email as:

<html>

<body>

This email has been auto generated from SAP. You are required to log onto SAP and authorise or reject the credit claim. For instructions, open Mentor and go to Guide for Managers > Quick Guide to Approving or Rejecting Claims.

<a href="http://AUYHOK12:6370/viewer/notify/d_AUYHOK12^6370_4094.men" target="_blank">SAP Hyperlink</a>

</body>

</html>

so obviously I did that wrong too.

Read only

0 Likes
5,818

So it just show the text exactly as it is when filling the internal table with the tags and all, right? Interesting.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
5,818

Rich, for me the term "frustrating" (and others I won't mention) apply more than "interesting"

Brigitte