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

Send email Message - Create body text

Former Member
0 Likes
668

Dear all.

We are sending Purchase Orders, and Order Confirmations by email. At this Moment i can change the Subject and the name of the attch file.

What i need to know is if its possibel to Create a Boby Text to the email.

Best Regards

Thansk In advanced

PMR

Dear all.

We are sending Purchase Orders, and Order Confirmations by email. At this Moment i can change the Subject and the name of the attch file.

What i need to know is if its possibel to Create a Boby Text to the email.

Best Regards

Thansk In advanced

PMR

3 REPLIES 3
Read only

Former Member
0 Likes
594

Hi

DATA : tl_ltext TYPE bcsy_text.

DATA : l_sent_to_all TYPE os_boolean,

l_send_request TYPE REF TO cl_bcs,

l_document TYPE REF TO cl_document_bcs,

l_recipient TYPE REF TO if_recipient_bcs,

l_recpt TYPE adr6-smtp_addr.

TRY.

l_send_request = cl_bcs=>create_persistent( ).

CATCH cx_send_req_bcs.

PERFORM catch_exception.

ENDTRY.

*C--> lines of the internal table have the error messages

REFRESH tl_ltext.

IF t_err_crchg[] IS NOT INITIAL.

APPEND LINES OF t_err_crchg TO tl_ltext.

ENDIF.

APPEND LINES OF t_error TO tl_ltext.

IF t_error1[] IS NOT INITIAL.

wa_error-error = text-018.

APPEND wa_error TO tl_ltext.

CLEAR wa_error.

APPEND LINES OF t_error1 TO tl_ltext.

ENDIF.

*C--> Create the document and catch any exceptions

TRY.

l_document = cl_document_bcs=>create_document( i_type = text-015

i_text = tl_ltext i_subject = text-006 ).

CATCH cx_document_bcs.

PERFORM catch_exception.

ENDTRY.

TRY.

CALL METHOD l_send_request->set_document( l_document ).

CATCH cx_send_req_bcs.

PERFORM catch_exception.

ENDTRY.

*C--> Create the internet address and catch any exceptions

CLEAR l_recpt.

LOOP AT t_email INTO wa_email.

l_recpt = wa_email-val1.

TRY.

l_recipient = cl_cam_address_bcs=>create_internet_address( l_recpt )

.

CATCH cx_address_bcs.

PERFORM catch_exception.

ENDTRY.

TRY.

CALL METHOD l_send_request->add_recipient

EXPORTING

i_recipient = l_recipient

i_express = c_x.

CATCH cx_send_req_bcs.

PERFORM catch_exception.

ENDTRY.

ENDLOOP.

*C--> send the mail document to all the email addresses specified

CLEAR l_sent_to_all.

TRY.

CALL METHOD l_send_request->send

EXPORTING

i_with_error_screen = c_x

RECEIVING

result = l_sent_to_all.

COMMIT WORK AND WAIT.

CATCH cx_send_req_bcs.

PERFORM catch_exception.

ENDTRY.

NOTE: here the internal table tl_text is a system defined internal table, it can hold the body or the contents of the mail . . . .

Hope it suits your requirement

Read only

Former Member
0 Likes
594

Hello.

Thanks Sudhir. For your replay.

But may question at this moment is if its possible to in a automatic way, change the boby off the email when the Message off the Purchase order is send via SCOT.

Read only

0 Likes
594

There are a lot of posts asking about adding text to the automatic e-mail containing a PDF attchment sent from 5 - External send but no solutions.

Can someone confirm if this is possible?

Thank you

Karen

Message was edited by: Karen Dean