Professional Documents
Culture Documents
What is the FM for sending the external email through SAP by attaching layout set to it?
SO_DOCUMENT_SEND_API1
SAPoffice: Send new document with attachments via RFC
SO_NEW_DOCUMENT_ATT_SEND_API1
(In 4.6C only, You can go to SE37 and click the documentation on how to use it. A sample program is
provided there.)
SAPoffice: Send new document with attachments via RFC
Note : If you are using FM SO_NEW_DOCUMENT_ATT_SEND_API1 then Export Parameter
DOCUMENT_DATA-OBJ_DESCR contains the Subject.
SO_NEW_DOCUMENT_SEND_API1
SAPoffice: Send new document
START-OF-SELECTION.
LOOP AT ITAB.
WRITE :/02 SY-VLINE , ITAB-PERNR, 15 SY-VLINE , ITAB-ENAME, 50
SY-VLINE.
ENDLOOP.
* Receivers
receiver_list-recextnam = 'EXTERNAL-MAIL-ID@YAHOO.COM'. "-->
* EMAIL ADDRESS
RECEIVER_list-RECESC = 'E'. "<-
RECEIVER_list-SNDART = 'INT'."<-
RECEIVER_list-SNDPRI = '1'."<-
APPEND receiver_list.
* General data
w_object_hd_change-objla = sy-langu.
w_object_hd_change-objnam = 'Object name'.
w_object_hd_change-objsns = 'P'.
* Mail subject
w_object_hd_change-objdes = 'Message subject'.
* Mail body
APPEND 'Message content' TO message_content.
* Attachment
CALL FUNCTION 'SAVE_LIST'
EXPORTING
list_index = '0'
TABLES
listobject = listobject.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
compressed_size = compressed_size
TABLES
in = listobject
out = compressed_attachment.
DESCRIBE TABLE compressed_attachment.
CLEAR packing_list.
packing_list-transf_bin = 'X'.
packing_list-head_start = 0.
packing_list-head_num = 0.
packing_list-body_start = 1.
packing_list-body_num = sy-tfill.
packing_list-objtp = 'ALI'.
packing_list-objnam = 'Object name'.
packing_list-objdes = 'Attachment description'.
packing_list-objlen = compressed_size.
APPEND packing_list.
************************************************************************
Re: SO_NEW_DOCUMENT_ATT_SEND_API1
Posted: Feb 3, 2005 11:27 AM in response to: Laura Portal
Reply
Here is a sample code:
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
bin_filesize = pdf_bytecount
TABLES
otf = otf_data
doctab_archive = lt_docs
lines = pdfout
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 2
OTHERS = 3.
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
TABLES
content_in = pdfout
content_out = pdfout2.
* Mail Contents
mailtxt-line = 'Order output '.
APPEND mailtxt.
* Set recipient - email address here!!!
SELECT SINGLE adrnr FROM kna1
INTO adrnr_sv
WHERE kunnr = vbdka-kunnr.
SELECT SINGLE *
FROM adrc
INTO adrc_sv
WHERE addrnumber = adrnr_sv.
*********************************************************************************
Here is the code to send the Smartform to mail as PDF attachment.
*&---------------------------------------------------------------------*
*& Report ZTEST_NREDDY_PDF_MAIL
*&
*&---------------------------------------------------------------------*
REPORT ZTEST_NREDDY_PDF_MAIL.
by the above code system treat the first line in table I_OBJBIN as header and the 2nd line to 10 lines
tread as body.