2010 Oct 04 10:39 AM
HI THIS IS SAROJ.
i am facing issues regarding sending mails from SAP to non sap.my requirement is mail has to be sent from SAP TO NON SAP
I.E ANY NON SAP MAIL BOX(YOUR COMP MAIL BOX).I AM TRYING THIS CODE BUT I AM NOT GETTING THE OUTPUT.
DATA: ld_uid TYPE char20, "Unique Indentifier
ls_soli TYPE soli, "Work area for E mail
lt_soli TYPE soli_tab. "Table for Email
CONCATENATE i_recipient-objid i_bus_transaction_info-objid INTO ld_uid.
CONDENSE ld_uid.
Calendar logic begin
ls_soli-line = 'BEGIN:VCALENDAR'.
APPEND ls_soli TO lt_soli.
ls_soli-line = 'PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN'.
APPEND ls_soli TO lt_soli.
ls_soli-line = 'VERSION:2.0'.
APPEND ls_soli TO lt_soli.
IF i_notif_type EQ 'BUCH'. " Abbr for the course booking
ls_soli-line = 'METHOD:REQUEST'.
ELSEIF i_notif_type EQ 'DELVORM'. "Course Cancellation
ls_soli-line = 'METHOD:CANCEL'.
ENDIF.
APPEND ls_soli TO lt_soli.
ls_soli-line = 'BEGIN:VEVENT'.
APPEND ls_soli TO lt_soli.
CONCATENATE 'UID:' ld_uid INTO ls_soli-line.
APPEND ls_soli TO lt_soli.
Populate the Sequnce number
ls_soli-line = 'SEQUENCE:1'.
APPEND ls_soli TO lt_soli.
CLEAR ls_soli-line.
Email ID of the sender
ls_soli-line = 'ORGANIZER:send@...'.
APPEND ls_soli TO lt_soli.
CLEAR ls_soli-line.
Populate the Time Stamp
CONCATENATE 'DTSTART:' sy-datum 'T080000Z' INTO ls_soli-line.
APPEND ls_soli TO lt_soli.
CONCATENATE 'DTEND:' sy-datum 'T100000Z' INTO ls_soli-line.
APPEND ls_soli TO lt_soli.
Populate the Location of the course
ls_soli-line = 'LOCATION: This is Course Location'.
APPEND ls_soli TO lt_soli.
This Would appear in Calender file
ls_soli-line = 'DESCRIPTION: Course Participation'.
APPEND ls_soli TO lt_soli.
CONCATENATE 'SUMMARY: Course Participation for '&Give Participant Name&' INTO ls_soli-line SEPARATED BY space.
APPEND ls_soli TO lt_soli.
ls_soli-line = 'END:VEVENT'.
APPEND ls_soli TO lt_soli.
ls_soli-line = 'END:VCALENDAR'.
APPEND ls_soli TO lt_soli.
Convert the data to Txt format
CALL FUNCTION 'SO_RAW_TO_RTF'
TABLES
objcont_old = lt_soli[]
objcont_new = e_contents_txt.
e_no_add = space.
e_doc_type = 'ICS'.
e_obj_descr = 'Name of the Calender file'.
CAN ANY BODY PLEASE PROVIDE ME SOME SAMPLE CODES.WAITING FOR RESPONSE.
SAROJ
HI THIS IS SAROJ.
i am facing issues regarding sending mails from SAP to non sap.my requirement is mail has to be sent from SAP TO NON SAP
I.E ANY NON SAP MAIL BOX(YOUR COMP MAIL BOX).I AM TRYING THIS CODE BUT I AM NOT GETTING THE OUTPUT.
DATA: ld_uid TYPE char20, "Unique Indentifier
ls_soli TYPE soli, "Work area for E mail
lt_soli TYPE soli_tab. "Table for Email
CONCATENATE i_recipient-objid i_bus_transaction_info-objid INTO ld_uid.
CONDENSE ld_uid.
Calendar logic begin
ls_soli-line = 'BEGIN:VCALENDAR'.
APPEND ls_soli TO lt_soli.
ls_soli-line = 'PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN'.
APPEND ls_soli TO lt_soli.
ls_soli-line = 'VERSION:2.0'.
APPEND ls_soli TO lt_soli.
IF i_notif_type EQ 'BUCH'. " Abbr for the course booking
ls_soli-line = 'METHOD:REQUEST'.
ELSEIF i_notif_type EQ 'DELVORM'. "Course Cancellation
ls_soli-line = 'METHOD:CANCEL'.
ENDIF.
APPEND ls_soli TO lt_soli.
ls_soli-line = 'BEGIN:VEVENT'.
APPEND ls_soli TO lt_soli.
CONCATENATE 'UID:' ld_uid INTO ls_soli-line.
APPEND ls_soli TO lt_soli.
Populate the Sequnce number
ls_soli-line = 'SEQUENCE:1'.
APPEND ls_soli TO lt_soli.
CLEAR ls_soli-line.
Email ID of the sender
ls_soli-line = 'ORGANIZER:send@...'.
APPEND ls_soli TO lt_soli.
CLEAR ls_soli-line.
Populate the Time Stamp
CONCATENATE 'DTSTART:' sy-datum 'T080000Z' INTO ls_soli-line.
APPEND ls_soli TO lt_soli.
CONCATENATE 'DTEND:' sy-datum 'T100000Z' INTO ls_soli-line.
APPEND ls_soli TO lt_soli.
Populate the Location of the course
ls_soli-line = 'LOCATION: This is Course Location'.
APPEND ls_soli TO lt_soli.
This Would appear in Calender file
ls_soli-line = 'DESCRIPTION: Course Participation'.
APPEND ls_soli TO lt_soli.
CONCATENATE 'SUMMARY: Course Participation for '&Give Participant Name&' INTO ls_soli-line SEPARATED BY space.
APPEND ls_soli TO lt_soli.
ls_soli-line = 'END:VEVENT'.
APPEND ls_soli TO lt_soli.
ls_soli-line = 'END:VCALENDAR'.
APPEND ls_soli TO lt_soli.
Convert the data to Txt format
CALL FUNCTION 'SO_RAW_TO_RTF'
TABLES
objcont_old = lt_soli[]
objcont_new = e_contents_txt.
e_no_add = space.
e_doc_type = 'ICS'.
e_obj_descr = 'Name of the Calender file'.
CAN ANY BODY PLEASE PROVIDE ME SOME SAMPLE CODES.WAITING FOR RESPONSE.
SAROJ
2010 Oct 04 10:46 AM
Hi
Refer the wiki, [Sending Mails |http://wiki.sdn.sap.com/wiki/display/ABAP/SendingMails-HomePage] for all mail sending related queries.
Regards
Abhii
2010 Oct 04 11:29 AM
abhii,
the code i have given there 'ld_uid' varible refers to which table or structure
' i_notif_type' refers to which table or structure that i could not find out.
i have TO send the mail from SAP TO NON SAP WHICH SHOULD BE RECIEVED IN OUTLOOK FORMAT.THAT IS MY REQUIREMENT.PLZ GIVE ME SOME SAMPLE CODE.
SAROJ
2010 Oct 04 12:28 PM
Hi,
If I see your code, You have defined ld_uid of type char20.
Please check the link I have provided for the sample code snippet.
Regards
Abhii
2010 Oct 04 10:48 AM
Hello Saroj,
No where in your code have you used any function to send the mail. The function SO_RAW_TO_RTF will not send any mail.
For sending the mails you can use the function SO_NEW_DOCUMENT_ATT_SEND_API1.
For the usage of this function, you can search SDN and you will get loads of examples.
Hope this helps.
Regards,
Himanshu
2010 Oct 04 10:55 AM
Hi,
Hi use Object oriented to sedn mails.
the class CL_BCS is used to send mails.
you can search on SDN you will get a lot of info in this regard.
call function 'SCMS_XSTRING_TO_BINARY'
exporting
buffer = v_fpformoutput-pdf "PDF file from function module
tables
binary_tab = v_att_content_hex.
try.
refresh t_message_body.
*---Message body and subject
append text-001 to t_message_body.
append ' ' to t_message_body.
append text-002
to t_message_body.
append ' ' to t_message_body.
append text-003 to t_message_body.
*---Creates an Office Document
o_document = cl_document_bcs=>create_document(
i_type = c_raw
i_text = t_message_body
i_subject = text-004 ).
try.
o_document->add_attachment(
exporting
i_attachment_type = c_pdf
i_attachment_subject = text-004
i_att_content_hex = v_att_content_hex ).
catch cx_document_bcs into o_document_bcs.
clear v_msg.
v_msg = o_document_bcs->get_text( ).
write : text-006,v_msg.
endtry.
o_send_request = cl_bcs=>create_persistent( ).
*---Add attachment
*---Pass the document to send request
o_send_request->set_document( o_document ).
*---Create sender
o_sender = cl_cam_address_bcs=>create_internet_address( p_send ).
*---Set sender
o_send_request->set_sender(
exporting
i_sender = o_sender ).
*---Create recipient
o_recipient = cl_cam_address_bcs=>create_internet_address( p_rece ).
*---Set recipient
o_send_request->add_recipient(
exporting
i_recipient = o_recipient
i_express = c_x ).
o_send_request->add_recipient( o_recipient ).
**---Send email
call method o_send_request->send
exporting
i_with_error_screen = c_x
receiving
result = v_result
.
commit work.
if v_result = 'X'.
message text-008 type 'I'.
endif.
*---Catch exceptions
catch cx_bcs into o_bcs_exception.
v_msg = o_bcs_exception->get_text( ).
write : text-006,v_msg.
endtry. regards,
Sakshi
2010 Oct 13 3:05 PM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |