‎2004 Aug 20 3:05 PM
How does the email work for external users? Where do I add external users? Does SAP support this or we need a software to do this?
Please help.
Thanks in advance.
‎2004 Aug 27 7:34 AM
Hello,
here is a code-snippet:
Interface of this method:
Importing RECIPIENT TYPE STRING Importing MAILTEXT TYPE STRING
Changing MESSAGES TYPE REF TO CL_BSP_MESSAGES
Importing COUNTRY TYPE STRING OPTIONAL@78
Importing SUBJECT TYPE SO_OBJ_DES
METHOD SEND_FURTHER_INFORMATION_MAIL .
***** loading global Business Communication Class *******
CLASS: cl_cam_address_bcs DEFINITION LOAD.
DATA: send_request TYPE REF TO cl_bcs,
document TYPE REF TO cl_document_bcs,
sender TYPE REF TO cl_sapuser_bcs,
uname type syuname,
address TYPE REF TO if_recipient_bcs,
exception_info TYPE REF TO if_os_exception_info,
bcs_exception TYPE REF TO cx_bcs.
DATA: c_address TYPE adr6-smtp_addr.
DATA: mail_itab TYPE soli_tab,
mail_wa LIKE LINE OF mail_itab,
length TYPE i,
textlength TYPE so_obj_len.
TRY.
***** create persistent send request *********************
send_request = cl_bcs=>create_persistent( ).
***** create mail document *******************************
length = strlen( mailtext ).
MOVE length TO textlength.
IF length >= 255.
length = 255.
ENDIF.
WHILE NOT mailtext IS INITIAL.
mail_wa = mailtext(length).
mailtext = mailtext+length.
APPEND mail_wa TO mail_itab.
length = strlen( mailtext ).
IF length >= 255.
length = 255.
ENDIF.
ENDWHILE.
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = mail_itab
i_length = textlength
i_subject = subject ).
***** add document to send request ***********************
send_request->set_document( document ).
***** get sender object **********************************
concatenate 'DLA_INFO_' country into uname.
translate uname to upper case.
sender = cl_sapuser_bcs=>create( uname ).
***** add sender *****************************************
send_request->set_sender( sender ).
***** create recipient ***********************************
MOVE recipient TO c_address.
address = cl_cam_address_bcs=>create_internet_address(
c_address ).
***** add recipient to send request **********************
send_request->add_recipient(
EXPORTING i_recipient = address
i_express = ' '
i_copy = ' '
i_blind_copy = ' ' ).
***** send document **************************************
send_request->send( ).
COMMIT WORK.
***** catch errors ***************************************
CATCH cx_bcs INTO bcs_exception.
IF messages IS NOT INITIAL.
messages->add_message(
condition = 'mail'
message = 'Error when trying to send mail' ).
ENDIF.
ENDTRY.
ENDMETHOD.
I use SAPScript-text as templates in this way:
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = id
language = spras
name = name
object = object
TABLES
lines = lines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
Convert.
CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'
TABLES
text_stream = texts
itf_text = lines.
CALL FUNCTION 'CONVERT_ITF_TO_ASCII'
TABLES
itf_lines = lines
EXCEPTIONS
syntax_check = 1
replace = 2
illegal_header = 3
OTHERS = 4.
LOOP AT texts INTO text.
CONCATENATE mailtext text INTO mailtext.
ENDLOOP.
REPLACE '[DIRECT_URL]' WITH direct_url INTO mailtext.
Hope this helps,
Stefan
‎2004 Aug 20 3:26 PM
Dependend on your Release check the classes :
cl_Bcs
cl_Document_Bcs
cl_Cam_Address_Bcs (=>c_Address_Type_Smtp() )
or the fuba
'SO_NEW_DOCUMENT_SEND_API1'
and their usage so far.
Kind Regards
Klaus
‎2004 Aug 23 12:24 PM
Recipient type should to U for external users as well.
‎2004 Aug 23 2:37 PM
Thanks for replying but this does not help me much. The classes does not exists on our system or maybe i'm looking on a wrong place.Please guide on how to check for this.
Also, do we need to install sendmail for us to be able to send emails to external users?
please help.
Thanks
‎2004 Aug 23 8:13 PM
What release are you on? The process for the setup of E-Mail is VERY different depending upon release - 46x or 620. It is very much simplier in 620. Also have a look at OSS Note 312690. it is composite note with links to lots of good information on SAPConnect, SAP Internet Mail Gateway. Have a look at note 455140 if you are on 620.
‎2004 Aug 23 8:24 PM
You can use function module SO_OBJECT_SEND with RECEIVERS be filled against fields RECESC (= 'U') and RECEXTNAM (= <mail address>). This will send it to the SAP Gateway but from there to send it out - you need to configure SAPConnect (SCON) which is very simple. As some one suggesting - go through the documentation or the OSS notes...
Thanks
Anjaiah
‎2004 Aug 24 11:47 AM
Have you also checked the Fuba 'SO_NEW_DOCUMENT_SEND_API1' ? What Release you are working with ?
Kind Regards
Klaus
‎2004 Aug 24 7:14 AM
hi,
Please check the F G <b>SOI1</b>
You may find the useful.
Regards,
Thomas.
‎2004 Aug 25 2:09 PM
Thanks for all your replies. We're on 620. We wil look at the notes.
Regards,
‎2004 Aug 27 6:22 AM
Hi,
You check the differeent options for the function module 'SO_NEW_DOCUMENT_SEND_API1' for mail send. I hope you will find solution there.
Regards,
Amit
‎2004 Aug 27 7:34 AM
Hello,
here is a code-snippet:
Interface of this method:
Importing RECIPIENT TYPE STRING Importing MAILTEXT TYPE STRING
Changing MESSAGES TYPE REF TO CL_BSP_MESSAGES
Importing COUNTRY TYPE STRING OPTIONAL@78
Importing SUBJECT TYPE SO_OBJ_DES
METHOD SEND_FURTHER_INFORMATION_MAIL .
***** loading global Business Communication Class *******
CLASS: cl_cam_address_bcs DEFINITION LOAD.
DATA: send_request TYPE REF TO cl_bcs,
document TYPE REF TO cl_document_bcs,
sender TYPE REF TO cl_sapuser_bcs,
uname type syuname,
address TYPE REF TO if_recipient_bcs,
exception_info TYPE REF TO if_os_exception_info,
bcs_exception TYPE REF TO cx_bcs.
DATA: c_address TYPE adr6-smtp_addr.
DATA: mail_itab TYPE soli_tab,
mail_wa LIKE LINE OF mail_itab,
length TYPE i,
textlength TYPE so_obj_len.
TRY.
***** create persistent send request *********************
send_request = cl_bcs=>create_persistent( ).
***** create mail document *******************************
length = strlen( mailtext ).
MOVE length TO textlength.
IF length >= 255.
length = 255.
ENDIF.
WHILE NOT mailtext IS INITIAL.
mail_wa = mailtext(length).
mailtext = mailtext+length.
APPEND mail_wa TO mail_itab.
length = strlen( mailtext ).
IF length >= 255.
length = 255.
ENDIF.
ENDWHILE.
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = mail_itab
i_length = textlength
i_subject = subject ).
***** add document to send request ***********************
send_request->set_document( document ).
***** get sender object **********************************
concatenate 'DLA_INFO_' country into uname.
translate uname to upper case.
sender = cl_sapuser_bcs=>create( uname ).
***** add sender *****************************************
send_request->set_sender( sender ).
***** create recipient ***********************************
MOVE recipient TO c_address.
address = cl_cam_address_bcs=>create_internet_address(
c_address ).
***** add recipient to send request **********************
send_request->add_recipient(
EXPORTING i_recipient = address
i_express = ' '
i_copy = ' '
i_blind_copy = ' ' ).
***** send document **************************************
send_request->send( ).
COMMIT WORK.
***** catch errors ***************************************
CATCH cx_bcs INTO bcs_exception.
IF messages IS NOT INITIAL.
messages->add_message(
condition = 'mail'
message = 'Error when trying to send mail' ).
ENDIF.
ENDTRY.
ENDMETHOD.
I use SAPScript-text as templates in this way:
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = id
language = spras
name = name
object = object
TABLES
lines = lines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
Convert.
CALL FUNCTION 'CONVERT_ITF_TO_STREAM_TEXT'
TABLES
text_stream = texts
itf_text = lines.
CALL FUNCTION 'CONVERT_ITF_TO_ASCII'
TABLES
itf_lines = lines
EXCEPTIONS
syntax_check = 1
replace = 2
illegal_header = 3
OTHERS = 4.
LOOP AT texts INTO text.
CONCATENATE mailtext text INTO mailtext.
ENDLOOP.
REPLACE '[DIRECT_URL]' WITH direct_url INTO mailtext.
Hope this helps,
Stefan
‎2004 Aug 30 4:36 PM
Thank you all for your posts. I will try out your suggestions.