Skip to Content
author's profile photo Former Member
Former Member

Regarding email sending

Hi,

can any one let me know how to send a form in the body of the mail

<b>( NOTE : not an attachment )</b>

Regards,

siva

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Sep 19, 2007 at 05:56 AM

    Hi,

    Use the below code

    ****************************************

    • Check the mail in T-code SBWP

    • To check the send mail status T-Code SOST

    ***********************************************

    TABLES:pa0001.

    DATA: v_ans,

    v_body_lines TYPE i.

    • Local declarations

    CONSTANTS:

    c_note_00 TYPE solisti1 VALUE 'NOTE',

    c_note_01 TYPE solisti1 VALUE

    'Do not reply to this email, instead please contact the compensation ',

    c_note_02 TYPE solisti1 VALUE

    'specialist (see above for contact details). This will help avoid ',

    c_note_03 TYPE solisti1 VALUE

    'unnecessarily delaying your request.'.

    DATA: it_packing_list TYPE TABLE OF sopcklsti1,

    wa_packing_list LIKE LINE OF it_packing_list,

    it_receivers TYPE TABLE OF somlreci1,

    wa_receivers LIKE LINE OF it_receivers,

    it_mailbody TYPE TABLE OF solisti1,

    wa_mailbody LIKE LINE OF it_mailbody.

    DATA: it_doc TYPE sodocchgi1.

    DATA: v_sent_all TYPE boolean.

    START-OF-SELECTION.

    • mail header

    it_doc-obj_descr = 'Hello'.

    • Add the recipients email address

    CLEAR wa_receivers.

    REFRESH it_receivers.

    wa_receivers-receiver = 'XXXXX@XXXX.COM'.

    wa_receivers-rec_type = 'U'.

    wa_receivers-com_type = 'INT'.

    wa_receivers-notif_del = 'X'.

    wa_receivers-notif_ndel = 'X'.

    APPEND wa_receivers TO it_receivers.

    wa_receivers-receiver = 'XXXXX@XXXX.COM'.

    wa_receivers-rec_type = 'U'.

    wa_receivers-com_type = 'INT'.

    wa_receivers-notif_del = 'X'.

    wa_receivers-notif_ndel = 'X'.

    APPEND wa_receivers TO it_receivers.

    • Mail Body

    CLEAR wa_mailbody.

    REFRESH it_mailbody.

    wa_mailbody-line = 'Hi All,'.

    APPEND wa_mailbody TO it_mailbody.

    wa_mailbody-line = ' '.

    APPEND wa_mailbody TO it_mailbody.

    wa_mailbody-line = 'This is a test mail'.

    APPEND wa_mailbody TO it_mailbody.

    wa_mailbody-line = ' '.

    APPEND wa_mailbody TO it_mailbody.

    DO 3 TIMES.

    wa_mailbody-line = ' '.

    APPEND wa_mailbody TO it_mailbody.

    ENDDO.

    wa_mailbody-line = c_note_00.

    APPEND wa_mailbody TO it_mailbody.

    wa_mailbody-line = c_note_01.

    APPEND wa_mailbody TO it_mailbody.

    wa_mailbody-line = c_note_02.

    APPEND wa_mailbody TO it_mailbody.

    wa_mailbody-line = c_note_03.

    APPEND wa_mailbody TO it_mailbody.

    • Describe the body of the message

    CLEAR wa_packing_list.

    REFRESH it_packing_list.

    wa_packing_list-transf_bin = space.

    wa_packing_list-head_start = 1.

    wa_packing_list-head_num = 0.

    wa_packing_list-body_start = 1.

    DESCRIBE TABLE it_mailbody LINES v_body_lines.

    wa_packing_list-body_num = v_body_lines.

    wa_packing_list-doc_type = 'RAW'.

    APPEND wa_packing_list TO it_packing_list.

    CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

    EXPORTING

    document_data = it_doc

    put_in_outbox = 'X'

    commit_work = 'X'

    IMPORTING

    sent_to_all = v_sent_all

    TABLES

    packing_list = it_packing_list

    contents_txt = it_mailbody

    receivers = it_receivers

    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.

    ELSE.

    WRITE:/ 'Mail has been sent to the receivers sucessfully'.

    ENDIF.

    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.