To send outbound mails from SAP
Hi team,
Here i need to configure email setting from SAP to any other email ID ( yahoo,gmail etc).For this configuration do i need to confgure any program or to genrate some RFC settings.
Can some one guide me the process step by step what to be done to send outbound mails from SAP. Immediate help will be really appreciated.
thanks in advance.
Check note 455140 - Configuration of e-mail, fax, paging or SMS using SMTP
Markus
Similar Messages
-
Sample code to send a mail from SAP
Hi guys
could any one provide me with the
sample code to send a mail from SAP with text as the main body of that mail via bcs classesHi,
Please go through this code: U can send mail;
Tables : zchp_cust-info.
DATA: OBJCONT LIKE SOLISTI1 OCCURS 5 WITH HEADER LINE.
DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
DATA: DOC_CHNG LIKE SODOCCHGI1.
DATA: ENTRIES LIKE SY-TABIX.
DATA: NAME(15).
DATA: CON_NAME(20).
DATA: req_num like zchp_cust_info.
DATA: I_TAB_CHP LIKE ZCHP_CUST_INFO OCCURS 0 WITH HEADER LINE.
*data: reno like ZCHP_CUST_INFO-req_num value .
data input for the mail
select * from zchp_cust_info
appending table i_tab_chp where req_num = c_knumv.
LOOP AT I_TAB_CHP.
concatenate i_tab_chp-created_by i_tab_chp-req_num into CON_NAME.
*WRITE: / con_name.
ENDLOOP.
Fill the document
DOC_CHNG-OBJ_NAME = 'Refe'.
DOC_CHNG-OBJ_DESCR = 'TESCRA Ref Number !'.
DOC_CHNG-SENSITIVTY = 'P'.
*OBJCONT = 'Tescra'.
OBJCONT = CON_NAME.
APPEND OBJCONT.
OBJCONT = con_name.
APPEND OBJCONT.
DESCRIBE TABLE OBJCONT LINES ENTRIES.
READ TABLE OBJCONT INDEX ENTRIES.
DOC_CHNG-DOC_SIZE = ( ENTRIES - 1 ) * 255 + STRLEN( OBJCONT ).
Fill the receiver list
CLEAR RECLIST.
RECLIST-RECEIVER = SY-UNAME. " replace with <login name>
RECLIST-REC_TYPE = 'B'.
RECLIST-EXPRESS = 'X'.
APPEND RECLIST.
CLEAR RECLIST.
RECLIST-RECEIVER = 'sapuser'.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
Send the document
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_TYPE = 'RAW'
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
TABLES
OBJECT_CONTENT = OBJCONT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
CASE SY-SUBRC.
WHEN 0.
LOOP AT RECLIST.
IF RECLIST-RECEIVER = SPACE.
NAME = RECLIST-REC_ID.
ELSE.
NAME = RECLIST-RECEIVER.
ENDIF.
IF RECLIST-RETRN_CODE = 0.
WRITE: / NAME, ': succesfully sent'.
ELSE.
WRITE: / NAME, ': error occured'.
ENDIF.
ENDLOOP.
WHEN 1.
WRITE: / 'Too many receivers specified !'.
WHEN 2.
WRITE: / 'No receiver got the document !'.
WHEN 4.
WRITE: / 'Missing send authority !'.
WHEN OTHERS.
WRITE: / 'Unexpected error occurred !'.
ENDCASE.
<b>Please provide points if the issue is solved.</b>
Regards,
Sunil -
Outbound mails from SAP CRM server
Hi,
Is there any way by which Outbound mails from SAP CRM server can be routed to more than one mail servers?
Any suggestions or work arounds will be appreciated.
Thanks and regards,
AsheeshHello Asheesh,
it is possible to create more than one Mail Node in Transaction SCOT. The mail can then be routed depending on the Domain Name.
Regards
Gregor -
How will we send smtp mail from SAP via Exchange
Hi;
We changed SAP OS between Windows and Linux and still 4.6c . Now we use linux OS.
We used smtp mail at SAP via Exchange with 3.party (sendmail,indigomail etc.) But Now I dont know how will we send smtp mail from SAP.
Please help me,
Thanks for answers.
Moderator message: not directly related to ABAP development, please have look in the Netweaver forums, also search for available information on sending emails.
Edited by: Thomas Zloch on Nov 22, 2010 2:39 PMHi,
What is the nature of the URL you wish to include in the e-mail ?
Is it fixed or dynamic ?
Cheers
Colin. -
Problem sending externail mail from SAP
I am facing problem in sending external mail from SAP. for ex: yahoo, hotmail like that. But, i can able to send the mails to my domain ids. I have configured both the SMTP and SAP internet gateway to send mails.
But, i dont know what could be the problem in sending external mails.
Is there any body to help me in this regard
Regards,
B.SudharsanHi Sudarsan,
How are you trying to send an e-mail using ABAP or using actions or ?
Enclosed link gives you a complete overview of the settings and the way to send an e-mail using ABAP ( if necessary).
/people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface
Reward points if it helps.
Regards,
Vamsi Krishna P. -
Problem while sending the mail from sap
Hi experts,
I am facing some problem while sending mail from sap to external mail.
this is th code i am using but it is not working. plz check and tell me.
REPORT ZMAIL_DEMO.
data: maildata type sodocchgi1.
data: mailtxt type table of solisti1 with header line.
data: mailrec type table of somlrec90 with header line.
start-of-selection.
break-point.
clear: maildata, mailtxt, mailrec.
refresh: mailtxt, mailrec.
maildata-obj_name = 'TEST'.
maildata-obj_descr = 'Test'.
maildata-obj_langu = sy-langu.
mailtxt-line = 'This is a test'.
append mailtxt.
mailrec-receiver = 'SOME MAIL ID'.
mailrec-rec_type = 'U'.
append mailrec.
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
document_type = 'RAW'
put_in_outbox = 'X'
tables
object_header = mailtxt
object_content = mailtxt
receivers = mailrec
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. "( did not receive any mail) *
write : 'mail sent'.
endif.Hi,
Please check with the following code.
TABLES: KNA1.
data for send function
DATA DOC_DATA LIKE SODOCCHGI1.
DATA OBJECT_ID LIKE SOODK.
DATA OBJCONT LIKE SOLI OCCURS 10 WITH HEADER LINE.
DATA RECEIVER LIKE SOMLRECI1 OCCURS 1 WITH HEADER LINE.
SELECT * FROM KNA1 WHERE ANRED LIKE 'C%'.
WRITE:/ KNA1-KUNNR, KNA1-ANRED.
send data internal table
CONCATENATE KNA1-KUNNR KNA1-ANRED
INTO OBJCONT-LINE SEPARATED BY SPACE.
APPEND OBJCONT.
ENDSELECT.
insert receiver (sap name)
REFRESH RECEIVER.
CLEAR RECEIVER.
MOVE: 'any_email'_ TO RECEIVER-RECEIVER, " SY-UNAME
'X' TO RECEIVER-EXPRESS,
'U' TO RECEIVER-REC_TYPE.
APPEND RECEIVER.
insert mail description
WRITE 'Sending a mail through abap'
TO DOC_DATA-OBJ_DESCR.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_DATA
IMPORTING
NEW_OBJECT_ID = OBJECT_ID
TABLES
OBJECT_CONTENT = OBJCONT
RECEIVERS = 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. -
How to send a mail from SAP 3.1H Ver.
Hi,
I am working on SAP 3.1H Version. I need to send mail from one of my ABAP program. Since SAP 3.1H version does not have Standard function modules which send mails from any ABAP program so how can I achive this task in this version of SAP.
The Operating system of my application server is Sun solaris.
Waiting for an early and postive reply.
Thanks & Regards,
Maqsood KhanREPORT ZSAPMAIL NO STANDARD PAGE HEADING.
TABLES: DRAD,
QINF,
DRAW,
SOUC,
SOFD,
DRAP.
DATA: P_RETURN_CODE LIKE SY-SUBRC.
data: d_username LIKE DRAP-PRNAM.
mail declarations
DATA : BEGIN OF NEW_OBJECT_ID. " the newly created email object
INCLUDE STRUCTURE SOODK.
DATA : END OF NEW_OBJECT_ID.
DATA : BEGIN OF FOLDER_ID. " the folder id of the outbox
INCLUDE STRUCTURE SOODK.
DATA : END OF FOLDER_ID.
DATA : BEGIN OF REC_TAB OCCURS 5. " the table which will contain the
INCLUDE STRUCTURE SOOS1. " information on the destination
DATA : END OF REC_TAB.
DATA : BEGIN OF OBJECT_HD_CHANGE. " the table which contains the
INCLUDE STRUCTURE SOOD1. " info for the object we will be
DATA : END OF OBJECT_HD_CHANGE. " creating
DATA : OBJECT_TYPE LIKE SOOD-OBJTP. " the type of object
DATA : BEGIN OF OBJHEAD OCCURS 5. " the header of the object
INCLUDE STRUCTURE SOLI.
DATA : END OF OBJHEAD.
DATA : BEGIN OF OBJCONT OCCURS 0. " the contents of the object
INCLUDE STRUCTURE SOLI. " i.e. the text etc
DATA : END OF OBJCONT.
DATA : BEGIN OF OBJPARA OCCURS 5. " formatting options
INCLUDE STRUCTURE SELC.
DATA : END OF OBJPARA.
DATA : BEGIN OF OBJPARB OCCURS 5. " formatting options
INCLUDE STRUCTURE SOOP1.
DATA : END OF OBJPARB.
DATA : BEGIN OF T_MAIL_TEXT OCCURS 0, "Message table for messages to
STRING(255), "user via mailbox
END OF T_MAIL_TEXT.
Parameter: p_uname like sy-uname.
**START-OF-SELECTION
START-OF-SELECTION.
d_username = p_uname.
PERFORM POPULATE_EMAIL_TEXT.
PERFORM SETUP_TRX_AND_RTX_MAILBOXES USING P_RETURN_CODE.
PERFORM CREATE_AND_SEND_MAIL_OBJECT.
FORM POPULATE_EMAIL_TEXT *
Inserts text for email message *
FORM POPULATE_EMAIL_TEXT.
CLEAR T_MAIL_TEXT-STRING. "puts a blank line in
APPEND T_MAIL_TEXT.
APPEND T_MAIL_TEXT.
adds failed list on to end of success list.
T_MAIL_TEXT-STRING = 'Test email message line 1'.
APPEND T_MAIL_TEXT.
T_MAIL_TEXT-STRING = 'Test email message line 1'.
APPEND T_MAIL_TEXT.
CLEAR T_MAIL_TEXT-STRING. "puts a blank line in
APPEND T_MAIL_TEXT.
T_MAIL_TEXT-STRING = 'Header1 Header2 Header3'.
APPEND T_MAIL_TEXT.
T_MAIL_TEXT-STRING = '----
APPEND T_MAIL_TEXT.
ENDFORM.
*& Form SETUP_TRX_&_RTX_MAILBOXES
Ensure that the mailboxes of the sender (INTMGR) are set up OK
FORM SETUP_TRX_AND_RTX_MAILBOXES USING P_RETURN_CODE.
get the user no of the sender in order to add the mail to the
user name's outbox for future reference
SELECT SINGLE * FROM SOUC
WHERE SAPNAM = SY-UNAME. "SAP name of a SAPoffice user
IF SY-SUBRC NE 0.
"Error finding the SAPoffice user info for the user
MESSAGE E064(ZR53) WITH SY-UNAME.
P_RETURN_CODE = 1.
EXIT.
ENDIF.
*Get the outbox No for the sender from the user No where the folder
" type is an outbox
SELECT * FROM SOFD WHERE OWNTP = SOUC-USRTP "Owner type from ID
AND OWNYR = SOUC-USRYR "Owner year from the ID
AND OWNNO = SOUC-USRNO "Owner number from the I
AND FOLRG = 'O'."Output box
ENDSELECT.
IF SY-SUBRC NE 0.
" Error getting folder information for the user
MESSAGE E065(ZR53) WITH SY-UNAME.
P_RETURN_CODE = 1.
EXIT.
ENDIF.
ENDFORM. " SETUP_TRX_&_RTX_MAILBOXES
*& Form CREATE_AND_SEND_MAIL_OBJECT
FORM CREATE_AND_SEND_MAIL_OBJECT.
FOLDER_ID-OBJTP = SOFD-FOLTP. " the folder type ( usually FOL )
FOLDER_ID-OBJYR = SOFD-FOLYR. " the folder year ( usually 22 )
FOLDER_ID-OBJNO = SOFD-FOLNO. " the folder no.
OBJECT_TYPE = 'RAW'. " the type of object being added
build up the object information for creating the object
OBJECT_HD_CHANGE-OBJLA = SY-LANGU. " the language of the email
OBJECT_HD_CHANGE-OBJNAM = 'PS to DM Interface'. " the object name
mail subject 'Mass Linking of QA, pass/fail'
MOVE TEXT-002 TO OBJECT_HD_CHANGE-OBJDES.
OBJECT_HD_CHANGE-DLDAT = SY-DATUM. " the date of the email
OBJECT_HD_CHANGE-DLTIM = SY-UZEIT. " the time of the email
OBJECT_HD_CHANGE-OBJPRI = '1'. " the priority ( highest )
OBJECT_HD_CHANGE-OBJSNS = 'F'. " the object sensitivity
F is functional, C - company sensitive
object_hd_change-skips = ' '. " Skip first screen
object_hd_change-acnam = 'SM35'. " Batch imput transaction
object_hd_change-vmtyp = 'T'. " Transaction type
add the text lines into the contents of the email
CLEAR OBJCONT.
REFRESH OBJCONT.
free objcont. " added this to delete the mail contents records
LOOP AT T_MAIL_TEXT.
OBJCONT-LINE = T_MAIL_TEXT-STRING.
APPEND OBJCONT.
ENDLOOP.
CLEAR OBJCONT.
build up the table of receivers for the email
REC_TAB-RCDAT = SY-DATUM. " the date to send the email
REC_TAB-RCTIM = SY-UZEIT. " the time to send the email
the SAP username of the person who will receive the email
REC_TAB-RECNAM = D_USERNAME.
the user type of the person who will send the email ( USR )
REC_TAB-SNDTP = SOUC-USRTP.
the user year of the person who will send the email ( 22 )
REC_TAB-SNDYR = SOUC-USRYR.
the user number of the person who will send the email
REC_TAB-SNDNO = SOUC-USRNO.
the sap username of the person who will send the email
REC_TAB-SNDNAM = SY-UNAME.
get the user info for the receiver of the document
SELECT SINGLE * FROM SOUC WHERE SAPNAM = D_USERNAME.
IF SY-SUBRC NE 0.
WRITE : / TEXT-001, D_USERNAME. "usnam.
EXIT.
ENDIF.
the user number of the person who will receive the email ( USR )
REC_TAB-RECNO = SOUC-USRNO.
the user type of the person who will receive the email ( USR )
REC_TAB-RECTP = SOUC-USRTP.
the user year of the person who will receive the email ( USR )
REC_TAB-RECYR = SOUC-USRYR.
the priority of the email ( highest )
REC_TAB-SNDPRI = '1'.
check for delivery on the email
REC_TAB-DELIVER = 'X'.
send express so recipient knows there is a problem
REC_TAB-SNDEX = 'X'.
check for a return receipt
REC_TAB-READ = 'X'.
the sap username of the person receiving the email
REC_TAB-ADR_NAME = D_USERNAME. "usnam.
add this receiver to the internal table
APPEND REC_TAB.
CLEAR REC_TAB.
call the function to create the object in the outbox of the sender
CALL FUNCTION 'SO_OBJECT_INSERT'
EXPORTING
FOLDER_ID = FOLDER_ID
OBJECT_HD_CHANGE = OBJECT_HD_CHANGE
OBJECT_TYPE = OBJECT_TYPE
OWNER = SY-UNAME
IMPORTING
OBJECT_ID = NEW_OBJECT_ID
TABLES
OBJCONT = OBJCONT
OBJHEAD = OBJHEAD
OBJPARA = OBJPARA
OBJPARB = OBJPARB
EXCEPTIONS
ACTIVE_USER_NOT_EXIST = 1
COMMUNICATION_FAILURE = 2
COMPONENT_NOT_AVAILABLE = 3
DL_NAME_EXIST = 4
FOLDER_NOT_EXIST = 5
FOLDER_NO_AUTHORIZATION = 6
OBJECT_TYPE_NOT_EXIST = 7
OPERATION_NO_AUTHORIZATION = 8
OWNER_NOT_EXIST = 9
PARAMETER_ERROR = 10
SUBSTITUTE_NOT_ACTIVE = 11
SUBSTITUTE_NOT_DEFINED = 12
SYSTEM_FAILURE = 13
X_ERROR = 14
OTHERS = 15.
IF SY-SUBRC NE 0.
MESSAGE A063(ZR53) WITH SY-SUBRC.
EXIT.
ENDIF.
call the function to send the already created email to the receivers
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
FOLDER_ID = FOLDER_ID
OBJECT_ID = NEW_OBJECT_ID
OUTBOX_FLAG = 'X'
OWNER = SY-UNAME
TABLES
RECEIVERS = REC_TAB
EXCEPTIONS
ACTIVE_USER_NOT_EXIST = 1
COMMUNICATION_FAILURE = 2
COMPONENT_NOT_AVAILABLE = 3
FOLDER_NOT_EXIST = 4
FOLDER_NO_AUTHORIZATION = 5
FORWARDER_NOT_EXIST = 6
NOTE_NOT_EXIST = 7
OBJECT_NOT_EXIST = 8
OBJECT_NOT_SENT = 9
OBJECT_NO_AUTHORIZATION = 10
OBJECT_TYPE_NOT_EXIST = 11
OPERATION_NO_AUTHORIZATION = 12
OWNER_NOT_EXIST = 13
PARAMETER_ERROR = 14
SUBSTITUTE_NOT_ACTIVE = 15
SUBSTITUTE_NOT_DEFINED = 16
SYSTEM_FAILURE = 17
TOO_MUCH_RECEIVERS = 18
USER_NOT_EXIST = 19
X_ERROR = 20
OTHERS = 21.
IF SY-SUBRC EQ 0.
MESSAGE I035(ZR53) WITH NEW_OBJECT_ID D_USERNAME. "usnam.
ELSE.
MESSAGE I036(ZR53) WITH D_USERNAME." sy-subrc.
ENDIF.
ENDFORM. " CREATE_AND_SEND_MAIL_OBJECT
award points if useful,
Aleem. -
How to apply Password Protection On attachment send through mail from SAP
Hi All,
I want to apply Password Protection on file send as an attachment from SAP on Email.
I know how to send email from sap with attachment in it. A smartform is coverted to a attachment and send on email.
But how can i apply password protection on it.
Any type of file format will be fine. I just need to know how can i make that file as password protected.
Thanks in advance.
Sonal Jain.>
Sonal Jain wrote:
But how can i convert the PDF to folder and than how can i zip that folder with password protection.
Not folder but file (I do hope you understand the difference). Have you tried to search SDN at all? I don't have much time, but before replying initially I did just a quick search and it brought several posts mentioning the archiving functionality. And I'm sure 'Smartform to PDF' will bring up gozillion posts. Also I find the Google search with addition 'site:sap.com' to be quite helpful.
However, I would still recommend to review the requirements. Why exactly do you need this password protection? If there is a fear that someone other than a recipient might get access to the email account then there is really a bigger security issue in the organization and it should be resolved by some other means. As I have mentioned, password does not really add much protection.
Out of curiosity I briefly looked at the IRM description on the Microsoft's web site and it doesn't seem to be very helpful. First of all, it's the MS software and has to be installed on the user's PC and configured (how do we know the emai recipients are even on Windows?). Also it does say "Prevent an unauthorized recipient from accessing e-mail content", but I didn't quite get how exactly. Is there a retinal scan that comes with it? And the list of things it does not do gives you the whole another perspective on the email security. -
How to send a mail from SAP to Users more than 200
Hi
some one can help i have one scenario in my company we have to send a mail to our user more than 200 to inform price changes once in a month or two month
Thanks in advance
Best Regards,
MHHi Mohammed
As you want to send to around 200 customers then maintain a condition record with the combination of Output medium 7 in the Output medium field
Second Option is Go to VA02 -> Edit -> Editor to reach the SAPscript Editor and then come back to the header output data and then The system sends the electronic mail at the time you have specified in the timing data..
Regards
Srinath -
Problem while sending e-mail from SAP
Hi,
I need to modify customized report, my problem is i need to download as .XLS file as well i need to send as an attachment to e-mail. If i select with NO-Delimeter the attachment comming as .TXT file and if i select any delimeter that occupying one cell in .XLS file.
Can anyone help me out in this.
Thanks,
YogeshHi Yogesh,
Refer the following code as pointer to sending email with attachment.
REPORT ZSAMPL_001 .
INCLUDE ZINCLUDE_01.
DATA
DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : file_name TYPE string.
data : path like PCFILE-PATH.
data : extension(5) type c.
data : name(100) type c.
SELECTION SCREEN
PARAMETERS : receiver TYPE somlreci1-receiver lower case.
PARAMETERS : p_file LIKE rlgrap-filename
OBLIGATORY.
AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CLEAR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM ml_customize USING 'Tst' 'Testing'.
PERFORM ml_addrecp USING receiver 'U'.
PERFORM upl.
PERFORM doconv TABLES itab objbin.
PERFORM ml_prepare USING 'X' extension name.
PERFORM ml_dosend.
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
FORM
FORM upl.
file_name = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_name
filetype = 'BIN'
TABLES
data_tab = itab
EXCEPTIONS
*file_open_error = 1
*file_read_error = 2
*no_batch = 3
*gui_refuse_filetransfer = 4
*invalid_type = 5
*no_authority = 6
*unknown_error = 7
*bad_data_format = 8
*header_not_allowed = 9
*separator_not_allowed = 10
*header_too_long = 11
*unknown_dp_error = 12
*access_denied = 13
*dp_out_of_memory = 14
*disk_full = 15
*dp_timeout = 16
*OTHERS = 17.
path = file_name.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
CHECK_DOS_FORMAT =
IMPORTING
DRIVE =
EXTENSION = extension
NAME = name
NAME_WITH_EXT =
PATH =
EXCEPTIONS
INVALID_DRIVE = 1
INVALID_EXTENSION = 2
INVALID_NAME = 3
INVALID_PATH = 4
OTHERS = 5
ENDFORM. "upl
***INCLUDE ZINCLUDE_01 .
Data
tables crmrfcpar.
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
data v_rfcdest LIKE crmrfcpar-rfcdest.
FORM
FORM ml_customize USING objname objdesc.
Clear Variables
CLEAR docdata.
REFRESH objpack.
CLEAR objpack.
REFRESH objhead.
REFRESH objtxt.
CLEAR objtxt.
REFRESH objbin.
CLEAR objbin.
REFRESH objhex.
CLEAR objhex.
REFRESH reclist.
CLEAR reclist.
REFRESH listobject.
CLEAR listobject.
CLEAR tab_lines.
CLEAR doc_size.
CLEAR att_type.
Set Variables
docdata-obj_name = objname.
docdata-obj_descr = objdesc.
ENDFORM. "ml_customize
FORM
FORM ml_addrecp USING preceiver prec_type.
CLEAR reclist.
reclist-receiver = preceiver.
reclist-rec_type = prec_type.
APPEND reclist.
ENDFORM. "ml_customize
FORM
FORM ml_addtxt USING ptxt.
CLEAR objtxt.
objtxt = ptxt.
APPEND objtxt.
ENDFORM. "ml_customize
FORM
FORM ml_prepare USING bypassmemory whatatt_type whatname.
IF bypassmemory = ''.
Fetch List From Memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
COMPRESSED_SIZE =
TABLES
in = listobject
out = objbin
EXCEPTIONS
OTHERS = 1
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
ENDIF.
Header Data
Already Done Thru FM
Main Text
Already Done Thru FM
Packing Info For Text Data
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
Packing Info Attachment
att_type = whatatt_type..
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = whatname.
APPEND objpack.
Receiver List
Already done thru fm
ENDFORM. "ml_prepare
FORM
FORM ml_dosend.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
CONTENTS_HEX = objhex
OBJECT_PARA =
object_parb =
receivers = reclist
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.
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
ENDFORM. "ml_customize
FORM
FORM ml_spooltopdf USING whatspoolid.
DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
Call Function
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = whatspoolid
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
OTHERS = 12.
Convert
PERFORM doconv TABLES pdf objbin.
ENDFORM. "ml_spooltopdf
FORM
FORM doconv TABLES
mypdf STRUCTURE tline
outbin STRUCTURE solisti1.
Data
DATA : pos TYPE i.
DATA : len TYPE i.
Loop And Put Data
LOOP AT mypdf.
pos = 255 - len.
IF pos > 134. "length of pdf_table
pos = 134.
ENDIF.
outbin+len = mypdf(pos).
len = len + pos.
IF len = 255. "length of out (contents_bin)
APPEND outbin.
CLEAR: outbin, len.
IF pos < 134.
outbin = mypdf+pos.
len = 134 - pos.
ENDIF.
ENDIF.
ENDLOOP.
IF len > 0.
APPEND outbin.
ENDIF.
ENDFORM. "doconv
FORM
FORM ml_saveforbp USING jobname jobcount.
Data
*data : yhead like yhrt_bp_head.
*DATA : ydocdata LIKE yhrt_bp_docdata,
*yobjtxt LIKE yhrt_bp_objtxt OCCURS 0 WITH HEADER LINE,
*yreclist LIKE yhrt_bp_reclist OCCURS 0 WITH HEADER LINE.
*DATA : seqnr TYPE i.
Head
*yhead-jobname = jobname.
*yhead-jobcount = jobcount..
*MODIFY yhrt_bp_head FROM yhead.
Doc Data
*ydocdata-jobname = jobname.
*ydocdata-jobcount = jobcount.
*MOVE-CORRESPONDING docdata TO ydocdata.
*MODIFY yhrt_bp_docdata FROM ydocdata.
Objtxt
*seqnr = 0.
*LOOP AT objtxt.
*seqnr = seqnr + 1.
*yobjtxt-jobname = jobname.
*yobjtxt-jobcount = jobcount.
*yobjtxt-seqnr = seqnr.
*MOVE-CORRESPONDING objtxt TO yobjtxt.
*MODIFY yhrt_bp_objtxt FROM yobjtxt.
*ENDLOOP.
RecList
*seqnr = 0.
*LOOP AT reclist.
*seqnr = seqnr + 1.
*yreclist-jobname = jobname.
*yreclist-jobcount = jobcount.
*yreclist-seqnr = seqnr.
*MOVE-CORRESPONDING reclist TO yreclist.
*MODIFY yhrt_bp_reclist FROM yreclist.
*ENDLOOP.
ENDFORM. "ml_saveforbp
FORM
FORM ml_fetchfrombp USING jobname jobcount.
*CLEAR docdata.
*REFRESH objtxt.
*REFRESH reclist.
*SELECT SINGLE * FROM yhrt_bp_docdata
*INTO corresponding fields of docdata
*WHERE jobname = jobname
*AND jobcount = jobcount.
*SELECT * FROM yhrt_bp_objtxt
*INTO corresponding fields of TABLE objtxt
*WHERE jobname = jobname
*AND jobcount = jobcount
*ORDER BY seqnr.
*SELECT * FROM yhrt_bp_reclist
*INTO corresponding fields of TABLE reclist
*WHERE jobname = jobname
*AND jobcount = jobcount
*ORDER BY seqnr.
ENDFORM. "ml_fetchfrombp
<b>Please reward points if it helps.</b>
Regards,
Amit Mishra -
Send outlook mail from SAP- urgent help me
Hi
I am using FM SO_NEW_DOCUMENT_SEND_API1 to send mail. Following code sy-subrc is 0. but i din nt receive mail. pls help me.
REPORT Z_MAIL.
data: maildata type sodocchgi1.
data: mailtxt type table of solisti1 with header line.
data: mailrec type table of somlrec90 with header line.
start-of-selection.
clear: maildata, mailtxt, mailrec.
refresh: mailtxt, mailrec.
maildata-obj_name = 'TEST'.
maildata-obj_descr = 'Test'.
maildata-obj_langu = sy-langu.
mailtxt-line = 'This is a test'.
append mailtxt.
mailrec-receiver = 'name.company.com'.
mailrec-rec_type = 'U'.
append mailrec.
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
document_type = 'RAW'
put_in_outbox = 'X'
tables
object_header = mailtxt
object_content = mailtxt
receivers = mailrec
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. "( did not receive any mail) *
write : 'mail sent'.
endif.REPORT z_email_test1.
TABLES:
spfli.
DATA:
t_spfli LIKE TABLE OF spfli.
DATA:
objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 0 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
objhex LIKE solix OCCURS 0 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
DATA:
doc_chng LIKE sodocchgi1.
CONSTANTS:
This is constant for Horizontal Tab.
con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab,
This is for Line feed and Carreige return.
con_cret(2) TYPE c VALUE cl_abap_char_utilities=>cr_lf.
DATA:
w_string TYPE string,
w_tempstring TYPE string,
w_tablines LIKE sy-tabix.
Here Document details will be filled
doc_chng-obj_name = 'SPFLI'.
doc_chng-obj_descr = 'Spfli table contents'.
If the Priority is '1' then the mail will go with High priority
If it is '9' then the mail will go with Low priority
If nothing is given then there will be no priority.
doc_chng-priority = '1'.
Getting Flight data
SELECT * FROM spfli INTO TABLE t_spfli.
This is the Boby of the mail
objtxt = 'Hi,'.
APPEND objtxt.
objtxt = 'These are the contents of Flight data'.
APPEND objtxt.
objtxt = 'Have fun and Enjoy'.
APPEND objtxt.
DESCRIBE TABLE objtxt LINES w_tablines.
READ TABLE objtxt INDEX w_tablines.
doc_chng-doc_size = ( w_tablines - 1 ) * 255 + STRLEN( objtxt ).
Creating the entry for the compressed document
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = w_tablines.
objpack-doc_type = 'RAW'.
APPEND objpack.
DATA:
w_fltime(10) TYPE c,
w_period(3) TYPE c,
w_distance(11) TYPE c,
data_tab LIKE TABLE OF solisti1,
sent_to_all TYPE sonv-flag,
new_object_id TYPE sofolenti1-object_id.
Here the data needs to be converted to respective format.
First the entire table data will be converted into a string
After that string will be converted to ITAB with
line type of 255 characters
CLEAR w_string.
LOOP AT t_spfli INTO spfli.
MOVE: spfli-fltime TO w_fltime,
spfli-distance TO w_distance,
spfli-period TO w_period.
CLEAR w_tempstring.
Here each field will be seerated by 'Tab' and for every row
'Carriage Return and Line Feed' will be used
CONCATENATE spfli-carrid
spfli-connid
spfli-countryfr
spfli-cityfrom
spfli-airpfrom
spfli-countryto
spfli-cityto
spfli-airpto
w_fltime
spfli-deptime
spfli-arrtime
w_distance
spfli-distid
spfli-fltype
w_period
INTO w_tempstring SEPARATED BY con_tab.
CONCATENATE w_string w_tempstring con_cret INTO w_string.
AT LAST.
DATA: lw_string LIKE w_tempstring.
CONCATENATE 'saibaba kondani' 'temp'
INTO lw_string SEPARATED BY con_tab.
CONCATENATE w_string w_tempstring con_cret INTO w_string.
ENDAT.
ENDLOOP.
Converting the above String to the Internal table of FM
CALL FUNCTION 'SCMS_STRING_TO_FTEXT'
EXPORTING
text = w_string
IMPORTING
LENGTH = LENGTH
TABLES
ftext_tab = data_tab.
This is the Data of Attachment
objbin[] = data_tab.
DESCRIBE TABLE objbin LINES w_tablines.
This is the name of Attachment
If the Attachment type is text then name should be given with
'.TXT' extension and for Excel attachment '.XLS' extension
should be given.
objhead = 'SPFLI.XLS'.
APPEND objhead.
Creating the entry for the compressed attachment
These are the details for the Attachemnt
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = w_tablines.
This is the Attachment type(For excel 'XLS' and fot text 'TXT' should
objpack-doc_type = 'XLS'.
objpack-obj_name = 'DATA_ATTACHMENT'.
objpack-obj_descr = 'Spfli attachment table'.
objpack-doc_size = w_tablines * 255.
APPEND objpack.
Entering names in the distribution list( These are the receivers )
reclist-receiver = mailid.
reclist-rec_type = 'U'.
RECLIST-NOTIF_READ = 'X'.
APPEND reclist.
REFRESH data_tab.
CLEAR data_tab.
CALL FUNCTION 'SCMS_STRING_TO_FTEXT'
EXPORTING
text = lw_string
IMPORTING
LENGTH = LENGTH
TABLES
ftext_tab = data_tab.
DESCRIBE TABLE objbin LINES w_tablines.
Creating the entry for the compressed attachment
These are the details for the Attachemnt
objpack-transf_bin = 'X'.
objpack-head_start = w_tablines + 1.
objpack-head_num = 0.
objpack-body_start = w_tablines + 1.
objpack-body_num = w_tablines.
This is the Attachment type(For excel 'XLS' and fot text 'TXT' should
objpack-doc_type = 'XLS'.
objpack-obj_name = 'DATA_ATTACHMENT'.
objpack-obj_descr = 'Spfli attachment table'.
objpack-doc_size = w_tablines * 255.
APPEND objpack.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = sent_to_all
new_object_id = new_object_id
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
receivers = reclist
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.
IF sy-subrc EQ 0.
WRITE : / sent_to_all,new_object_id.
ENDIF.
This Program is used to Trigger the send process Explicitely
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN. -
Hi all,
I have one ALV-report which has 64 columns.
Now i want to send this report to external mail.
I have already created a program for this but the problem is that my report contains 64 columns but only 30 columns is sending to external mail remaining data is not generating in excel sheet.first check o/p in spool t.code sp02
o/p is having 64 columns or 30. -
Send SMTP-Mail from SAP with URL to the Workplace Inbox
Does anybody knows how I can create an URL adress within an E-Mail (which is generated in a step in workflow) to provide the receiver an direct access to his SAP-Inbox.
Logon-data must not be included.
thanks to everybodyHi,
What is the nature of the URL you wish to include in the e-mail ?
Is it fixed or dynamic ?
Cheers
Colin. -
Error while sending mails from SAP
Hello Experts,
I am facing the below problem:
If an error occurs during the processing of a Z SAP transaction, an email needs to be sent to the user who is executing the transaction.
So, in this case the sender and receiver is the same user.
But the problem that i am facing is that for sending the mail from SAP, i have to maintain the email address in the user profile as blank. If I maintain some email address in the user profile, i encounter the following error:
Internal error: CL_SMTP_RESPONSE ESMTP error code is not known. 554 554 <email address>: Sender address rejected .
Please help me resolve this.
Thanks a lot in advance to answer the above query.
Regards,
HimanshuHi Himanshu,
I think its the problem with mail server configured in ur system.
Please contact ur basis Person.Ask him to chk The SCOT tcode once.Maybe ur SMTP configuration is not done properly.Also chk this sap note 455140 - Configuration for e-mail, fax using SMTP
Regards,
Lakshman. -
How to set Default text when sending a blank mail from SAP
Hi all,
How to add Signature with company logo in the mail body.
User should see at least one default text (eg; Hi) in the mail body if the sender did not type any text in the mail body when sending a mail from SAP.
Is it possible to set like this on Subject also.
Kindly share your ideas.
Regards,
Mathan AHi Mathan,
Please check sap note
SAP Note No. 1304146 Email Signatures feature note
1163250 - How to Create an Email Signature on several rows
I hope it will solve your issue.PLease mark thread as answerd.
Best Regards,
Atul
Maybe you are looking for
-
My 4th gen ipod touch is running slow. how do i look for updates?
my 4th gen ipod touch is running slow with everything. how do i look for updates or is there somthing i can do to speed it up?
-
How to download a local mirror of public yum, public-yum-downloader.sh
Hello there I did write an script to create a local mirror of public-yum.oracle.com, it now includes the errata and security bug fixes information._ First of all, thanks for giving a try to the script. The script can be located at: https://github.com
-
Truncated (incomplete) Page-Thumbnail View (6.03)
On my Windows XP 64 machine that is running two 1920x1200 monitors via NVIDIA Quadro FX 4600 with the latest drivers I am having the following problem: in both Acrobat and InDesign the page thumbnail views do not show all of the thumbnail whatever th
-
How do you get an app back into Launchpad?
I accidentally deleted iMovie '11 from my launchpad. How do I get it back in there? I have tried deleting the application from my computer and then re-installing it via the app store. When I tried this, the application icon was in launchpad when it w
-
Three serious problems that didn't exist on 8.0
I can't see the double arrow that is black on a black background. In 8.0 I could change the surrounding background in the Org screen to lighter in the preference/file section. That is now missing and I have to slide my cursor blindly to look for a fl