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: 

Create hyperlink for reply to in mail body while sending email.

jaideepsharma
Active Contributor
0 Kudos
1,525

Hi All,

We have a requirement where we need to create an hyperlink for reply to in the mail body.

We have implemented entire functionality using CL_BCS classes and everything is working fine.

Only problem we have is when we give document type as HTM instead of RAW then entire formatting of mail body gets disturbed although we get the hyperlink.

Is there any way where we can send the mail in html format using CL_BCS,CL_DOCUMENT_BCS ?

KR Jaideep,

2 REPLIES 2

b_deterd2
Active Contributor
0 Kudos
589

Hi,

That is the correct way. Use HTM as document type but be sure you place the complete text as html text. in the text you can then also use href et cetera.

Regards,

Bert

0 Kudos
589

Hi ,

Please find the code below I am using to make the hyperlink. Do I need to fill the entire mail body using HTML Tags ? If yes, then I guess it will increase the complexity of program as the mail content will vary from one mail to another depending upon whether different invoice documents have text maintained in them.

lwa_text = '<html>'.
    APPEND lwa_text TO li_text.
    CLEAR lwa_text.

    lwa_text = '<body>'.
    APPEND lwa_text TO li_text.
    CLEAR lwa_text.

    lwa_text = text-012.
    APPEND lwa_text TO li_text.
    CLEAR lwa_text.

    CONCATENATE '<a href="mailto:'
                lv_receiver
                '">'
                lv_receiver
                '</a>'
           INTO lwa_text.

    APPEND lwa_text TO li_text.
    CLEAR lwa_text.

    lwa_text = '</body>'.
    APPEND lwa_text TO li_text.
    CLEAR lwa_text.

    lwa_text = '</html>'.
    APPEND lwa_text TO li_text.
    CLEAR lwa_text.

    TRY.
        CALL METHOD cl_document_bcs=>create_from_text
          EXPORTING
            i_text         = li_text
            i_documenttype = 'HTM'
            i_subject      = 'Test for hyperlink'
            i_importance   = '1'
            i_sensitivity  = 'P'
          RECEIVING
            result         = lref_document_bcs.
      CATCH cx_document_bcs .
    ENDTRY.