How you will send mail from one SAP system to other SAP
system?

Answer Posted / pramod

Please go through the sample code to Send mail

*********
*Data of an object which can be changed
DATA : doc_chng LIKE sodocchgi1.

*SAPoffice: Single List with Column Length 255
DATA : objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.

*SAPoffice: Description of Imported Object Components
DATA : objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.

*SAPoffice: Structure of the API Recipient List
DATA : reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.


FORM errors_send_mail .
* Creation of the document to be sent
doc_chng-obj_name = 'Log report For Historical Balance
Conversation'
.

CONCATENATE 'Log for ' sy-repid INTO doc_chng-obj_descr
SEPARATED BY space.


LOOP AT it_error. "HERE TYPE = 'A' OR TYPE = 'E'.
objtxt = it_error-message.
APPEND objtxt.
CLEAR: objtxt.
ENDLOOP.

LOOP AT it_message.
AT FIRST .
WRITE : / 'List of documents created :'.
SKIP 1.

ENDAT.
WRITE : / it_message-message.
objtxt = it_message-message.
APPEND objtxt.
CLEAR: objtxt.

ENDLOOP.

* Creation of the entry for the compressed document
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = 9.
objpack-doc_type = 'RAW'.
objpack-obj_name = 'DATA'.
objpack-doc_size = 10 * 255.
objpack-obj_langu = 'EN'.
APPEND objpack.
CLEAR objpack.

CLEAR objpack-transf_bin.
objpack-head_start = 0.
objpack-head_num = 0.
objpack-body_start = 10.
objpack-body_num = tab_lines.
objpack-doc_type = 'DAT'.
objpack-obj_name = 'DATA'.
objpack-doc_size = tab_lines * 255.
objpack-obj_langu = 'EN'.
APPEND objpack.
CLEAR objpack.

* Completing the recipient list
* RECLIST-RECEIVER = 'Michael.mccullough@ge.com'.
reclist-receiver = 'Tiffany.Boyle@ge.com'.
reclist-rec_type = 'U'.
APPEND reclist.
CLEAR reclist.
reclist-receiver = 'Kalpana.tyagi2@ge.com'.
reclist-rec_type = 'U'.
APPEND reclist.
CLEAR reclist.

* Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = objpack
contents_txt = objtxt
contents_bin = objbin
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
IF sy-subrc = 0.
SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
ENDIF.

Is This Answer Correct ?    4 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

In a loop of an internal table, what is the use of at first & at last statements?

1705


What is your approach to find exit and BAdi?

1067


B -Credit Note report Selection Screen Ranges: Creation date Sales Org Sold to Party Selection condition: Document Category – VBTYP should be ‘O’ Table to be used: VBRK, VBRP,VBPA,ADRC List the CR order types or credit billing type by customer number (or selected customer) and displays the: - Billing Document date (FKDAT) - Customer number (KUNRG) - Name of the reseller (on top of the SAP No) (NAME1) - Billing document number,(VBELN) - order reason (AUGRU_AUFT) - Amount (NETWR) - Currency (WAERK) Group Currency wise, billing type wise sum of Net value. When user double click on field ‘Billing Document #’ , display the document in VF03 Do this using OO ABAP.

2711


What is value table? : abap data dictionary

839


Describe the data classes?

781


What is an update type with reference to a match code id? : abap data dictionary

762


What is the advantage of structures?

790


How would you define the exponents for a type ‘f’ field?

824


What are the different types of view?

815


What are the types of the programming language used in the sap abap software?

819


Why do we use Abstract classes give an example from your project?

1090


How to get that a secondary index is attached to a select query?

1116


How can I make a differentiation between dependent and independent data? : abap hr

780


what are the important fields while preparing sales order,inquiry?

2091


What are the user groups?

775