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: 

How to email any document from sap through program

Former Member
0 Kudos

Dear Gurus,

i want to email my document from sap to external mail. i tried program using fm SO_NEW_DOCUMENT_ATT_SEND_API1 . but it is showing error 'error while sending' . please reply me how to do this in details with any configuration if required.

reagrds

Banaja Kumar Bal

3 REPLIES 3

Former Member
0 Kudos

Hi,

Try this link

[https://forums.sdn.sap.com/click.jspa?searchID=16119709&messageID=5922354]

Regards,

Surinder

former_member181995
Active Contributor
0 Kudos

>

> Dear Gurus,

> i want to email my document from sap to external mail

SBWP>ShiftF4(New message)>Ctrlshift+F3(For attachment)>select internet address from recieptent address from drop down(Recip type)>give the recieptent name>send(shift_F8).

Ps:this process muct need SMTP connect to your SAP system.

No coding required.

Amit.

Edited by: Amit Gujargoud on Sep 10, 2008 1:30 PM

Former Member
0 Kudos

Hello,

Follow the bellow piece of code and populate structures accordingly

FORM send_mail3.

DATA: l_lines TYPE i.

CONSTANTS: lc_raw(3) TYPE c VALUE 'RAW'.

CLEAR: i_receiver,

i_objpack.

DESCRIBE TABLE i_objtxt3 LINES l_lines.

READ TABLE i_objtxt3 INTO x_objtxt INDEX l_lines.

x_docchng-doc_size = ( l_lines - 1 ) * 255 + STRLEN( x_objtxt-line ).

*--Creating the entry for the compressed document

CLEAR x_objpack-transf_bin.

x_objpack-head_start = 1.

x_objpack-head_num = 0.

x_objpack-body_start = 1.

x_objpack-body_num = l_lines.

x_objpack-doc_type = lc_raw.

APPEND x_objpack TO i_objpack.

  • CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1' "-ASR SR65890e1

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

document_data = x_docmail3

put_in_outbox = c_x

SENDER_ADDRESS = p_sender

SENDER_ADDRESS_TYPE = c_smtp

commit_work = c_x

TABLES

packing_list = i_objpack

contents_txt = i_objtxt3

receivers = i_receiver

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.

*---Nothing to do

ENDIF.

ENDFORM. " send_mail3

Regards,

Subbu