Application Development 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: 

email body text

Former Member
0 Kudos

Hello,

we need to add a mailbody text to a standard mail (e.g. sales order confirmation using program SAPMV45A).

The output type was defined using transaction NACE with application V1 and medium 5 (external sending).

Currently we have only the PDF attachment without any text.

The mail text using transaction V/30 cannot be used for external sending (-> OSS 191470).

Is it possible to fill the mailbody text (argument: contents_txt in SO_DUCUMENT_SEND_API1) with standard customizing?

Or is a modification necessary?

Thanks in advance for your help.

Marian.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello,

I am working in a 4.7 environment using standard output configuration using transaction NACE and I also could not get standard SAP to add email disclaimer text into the body of the email. Here is what I did:

-


1) In function module SO_OBJECT_SEND, I added an include statement (this IS a modification to SAP):

tm = cl_os_system=>get_transaction_manager( ).

if not tm is initial.

t = tm->get_current_transaction( ).

if not t is initial.

t->set_mode_update( oscon_dmode_direct ).

endif.

endif.

catch cx_os_error cx_os_system_error.

endtry.

INCLUDE ZZMVxxxxxx.

  • create send request

CALL FUNCTION 'SBCOMS_SEND_REQUEST_CREATE'

exporting

originator = originator

originator_type = originator_type

IMPORTING

SEND_REQUEST = send_request

TABLES

OBJCONT = objcont

OBJHEAD = objhead

OBJPARA = objpara

OBJPARB = objparb

-


2) In the INCLUDE, I added this code which retrieves standard text object and populates the table which becomes the email body:

DATA: ZZ_lines LIKE tline OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'READ_TEXT'

EXPORTING

    • CLIENT = SY-MANDT*

ID = 'ST'

LANGUAGE = 'E'

NAME = 'Z_EMAIL_DISCLAIMER_GENERAL'

OBJECT = 'TEXT'

    • ARCHIVE_HANDLE = 0*

    • LOCAL_CAT = ' '*

    • IMPORTING*

    • HEADER =*

TABLES

LINES = ZZ_LINES

    • EXCEPTIONS*

    • ID = 1*

    • LANGUAGE = 2*

    • NAME = 3*

    • NOT_FOUND = 4*

    • OBJECT = 5*

    • REFERENCE_CHECK = 6*

    • WRONG_ACCESS_TO_ARCHIVE = 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.

LOOP AT ZZ_LINES.

MOVE ZZ_LINES-TDLINE TO NOTE_TEXT-LINE.

APPEND NOTE_TEXT.

ADD 1 TO SIZE-NOTE_TEXT.

ENDLOOP.

ENDIF.

-


3) Finally, I created the standard text object Z_EMAIL_DISCLAIMER_GENERAL and added the following text:

PLEASE DO NOT REPLY TO THIS EMAIL. IF YOU HAVE QUESTIONS, PLEASE

CONTACT YOUR <your company's name> REPRESENTATIVE.

This communication is intended for the use of the addressee only and may

contain information that is privileged or confidential. If you are not

the addressee, you are hereby notified that any dissemination,

distribution or use of this communication is prohibited. If you received

this communication in error, please destroy it, all copies and any

attachments and notify the sender as soon as possible. Any comments,

statements or opinions expressed in this communication do not

necessarily reflect those of <your company's name>, its subsidiaries and

affiliates.

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

Hope this helps.

Edited by: Bruce Risto on Jun 18, 2009 11:27 AM

Edited by: Bruce Risto on Jun 18, 2009 11:54 AM

5 REPLIES 5

jaideepsharma
Active Contributor
0 Kudos

Hi,

Yes, you can have a mail body text if you populate OBJECT_CONTENT parameter in the function module SO_NEW_DOCUMENT_SEND_API1 or CONTENT_TXT in function module SO_NEW_DOCUMENT_SEND_API1.

KR Jaideep,

Former Member
0 Kudos

Hi Marian,

I posted this message few months back. I was able to add the body of the mail. It can be done through implicit enhancement

[Setting Mail Subject and Body |;

Regards

Former Member
0 Kudos

hi

Function Module SO_NEW_DOCUMENT_ATT_SEND_API1 is used to send a mail

with attachments

*-----Calling the function module to sending email

data : it_pcklist like sopcklsti1 occurs 0 with header line,

it_mess like solisti1 occurs 0 with header line,

it_table like solix occurs 0 with header line,

it_receivers like somlreci1 occurs 0 with header line.

solix is of char data type with length 255

call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'

exporting

document_data = wa_doc_data

put_in_outbox = 'X'

commit_work = 'X'

tables

packing_list = it_pcklist

contents_txt = it_mess

contents_hex = it_table

receivers = it_receivers.

here in this function module CONTENTS_TXT is where we can add our own text and

send it with the mail.

Regards

Former Member
0 Kudos

Former Member
0 Kudos

Hello,

I am working in a 4.7 environment using standard output configuration using transaction NACE and I also could not get standard SAP to add email disclaimer text into the body of the email. Here is what I did:

-


1) In function module SO_OBJECT_SEND, I added an include statement (this IS a modification to SAP):

tm = cl_os_system=>get_transaction_manager( ).

if not tm is initial.

t = tm->get_current_transaction( ).

if not t is initial.

t->set_mode_update( oscon_dmode_direct ).

endif.

endif.

catch cx_os_error cx_os_system_error.

endtry.

INCLUDE ZZMVxxxxxx.

  • create send request

CALL FUNCTION 'SBCOMS_SEND_REQUEST_CREATE'

exporting

originator = originator

originator_type = originator_type

IMPORTING

SEND_REQUEST = send_request

TABLES

OBJCONT = objcont

OBJHEAD = objhead

OBJPARA = objpara

OBJPARB = objparb

-


2) In the INCLUDE, I added this code which retrieves standard text object and populates the table which becomes the email body:

DATA: ZZ_lines LIKE tline OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'READ_TEXT'

EXPORTING

    • CLIENT = SY-MANDT*

ID = 'ST'

LANGUAGE = 'E'

NAME = 'Z_EMAIL_DISCLAIMER_GENERAL'

OBJECT = 'TEXT'

    • ARCHIVE_HANDLE = 0*

    • LOCAL_CAT = ' '*

    • IMPORTING*

    • HEADER =*

TABLES

LINES = ZZ_LINES

    • EXCEPTIONS*

    • ID = 1*

    • LANGUAGE = 2*

    • NAME = 3*

    • NOT_FOUND = 4*

    • OBJECT = 5*

    • REFERENCE_CHECK = 6*

    • WRONG_ACCESS_TO_ARCHIVE = 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.

LOOP AT ZZ_LINES.

MOVE ZZ_LINES-TDLINE TO NOTE_TEXT-LINE.

APPEND NOTE_TEXT.

ADD 1 TO SIZE-NOTE_TEXT.

ENDLOOP.

ENDIF.

-


3) Finally, I created the standard text object Z_EMAIL_DISCLAIMER_GENERAL and added the following text:

PLEASE DO NOT REPLY TO THIS EMAIL. IF YOU HAVE QUESTIONS, PLEASE

CONTACT YOUR <your company's name> REPRESENTATIVE.

This communication is intended for the use of the addressee only and may

contain information that is privileged or confidential. If you are not

the addressee, you are hereby notified that any dissemination,

distribution or use of this communication is prohibited. If you received

this communication in error, please destroy it, all copies and any

attachments and notify the sender as soon as possible. Any comments,

statements or opinions expressed in this communication do not

necessarily reflect those of <your company's name>, its subsidiaries and

affiliates.

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

Hope this helps.

Edited by: Bruce Risto on Jun 18, 2009 11:27 AM

Edited by: Bruce Risto on Jun 18, 2009 11:54 AM