Skip to Content

How to insert hyperlinks in email generated from Workflow

Hi Friends,

We have a requierement where in we need to send an email to approver based on status change in the transaction. For eg, when the status is changed from Inprogress to "to be approved, an email should be sent automatically to the approver.

Approver should have the flexibility to approve/reject the request by selecting the hyperlinks in the email.

Can some ohe guide us on how to achieve this functionality.



Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 17, 2009 at 10:46 AM

    constants : lc_htm type string value 'HTM',

    lc_x(1) type c value 'X'.

    DATA: lw_document_data TYPE sodocchgi1,

    lw_object_content TYPE solisti1,

    lw_packing_list TYPE sopcklsti1.

    DATA: li_object_content TYPE STANDARD TABLE OF solisti1,

    li_packing_list TYPE STANDARD TABLE OF sopcklsti1.

    *"Packing list for main document

    CLEAR lw_packing_list.

    FREE li_packing_list.

    MOVE: 1 TO lw_packing_list-head_start,

    0 TO lw_packing_list-head_num,

    1 TO lw_packing_list-body_start,

    lw_tab_lines TO lw_packing_list-body_num,

    lc_htm TO lw_packing_list-doc_type.

    APPEND lw_packing_list TO li_packing_list.

    *"Function module to send email



    document_data = lw_document_data

    put_in_outbox = lc_x

    commit_work = lc_x


    packing_list = li_packing_list

    contents_txt = li_object_content

    receivers = it_receivers


    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 NE 0.

    • MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

    • WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.


    Edited by: Harpreet Singh Bhuee on Sep 17, 2009 12:54 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 17, 2009 at 10:42 AM


    First of all you need to create custom function module to send mail that contains HTML data for that you can function module SO_DOCUMENT_SEND_API1.


    1. Create the HTML page for the email format for your reference.

    for eg



    60001226 has submitted Purchase Order 4500169047 for your Approval.



    2. Code the above created HTML page format in the ABAP as shown below

    for eg

    *"Body of mail

    <html> TO li_object_content.

    <body> TO li_object_content.

    CLEAR lw_object_content.

    CONCATENATE iv_buyer_id text-003 iv_buyer_name text-004 INTO lw_object_content SEPARATED BY space.

    APPEND lw_object_content TO li_object_content.

    iv_buyer_id is a variable for dynamic data

    Code the complete page like this.

    In the packing list pass doc type as HTM.

    3. Call the above created funcition module with receivers using workflow step.

    4. For implementing approval or rejection by clicking you need to create the function module with webservice.

    When user clicks the hyperlink the webservice is called for approval or rejection.


    Harpreet Singh

    Edited by: Harpreet Singh Bhuee on Sep 17, 2009 12:47 PM

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.