Sending Email. Urgent
Hi all,
i am planning to send an email from abap
To [email protected]
Subject: Mail from ABAP
text: example mail from an abap program
<b>How to aproach that?
Give me a Clear Idea.
which function modules to use?
which Structures to Use?</b>
try this Program.
TABLES: ekko.
PARAMETERS: p_email TYPE somlreci1-receiver
DEFAULT '[email protected]'.
TYPES: BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
wa_ekpo TYPE t_ekpo.
TYPES: BEGIN OF t_charekpo,
ebeln(10) TYPE c,
ebelp(5) TYPE c,
aedat(8) TYPE c,
matnr(18) TYPE c,
END OF t_charekpo.
DATA: wa_charekpo TYPE t_charekpo.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
*START_OF_SELECTION
START-OF-SELECTION.
Retrieve sample data from table ekpo
PERFORM data_retrieval.
Populate table with detaisl to be entered into .xls file
PERFORM build_xls_data_table.
*END-OF-SELECTION
END-OF-SELECTION.
Populate message body text
perform populate_email_message_body.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_message
it_attach
using p_email
'Example .xls documnet attachment'
'XLS'
'filename'
changing gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
SELECT ebeln ebelp aedat matnr
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekpo.
ENDFORM. " DATA_RETRIEVAL
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM build_xls_data_table.
CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE x VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
LOOP AT it_ekpo INTO wa_charekpo.
CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
wa_charekpo-aedat wa_charekpo-matnr
INTO it_attach SEPARATED BY con_tab.
CONCATENATE con_cret it_attach INTO it_attach.
APPEND it_attach.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables pit_message
pit_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = pit_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
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.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM initiate_mail_execute_program.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
form populate_email_message_body.
REFRESH it_message.
it_message = 'Please find attached a list test ekpo records'.
APPEND it_message.
endform. " POPULATE_EMAIL_MESSAGE_BODY
Regards
Abhishek
Similar Messages
-
Urgent: Regarding Sending Email Notifications
Hi all,
We have scenario in which we have to search those users who has not accessed their accounts from last 2 years and then send them an email notification and after one month of notificatio we have to search those users who have been notified but yet not accessed their account and delete those accounts from LDAP.
For this we are using JNDI to search users. Now we are facing two problems:
1. The users email ids are in the form of List. When we refer this list in To address of Email Template then it gives us an exception: Saying that service not responding, No recepient addresses while in case of hard coded values it runs successfully. I think this is due to that it requires a semicolon(;) seperated list to send email notification. Thats why we thought that we have to use some looping to send the notifications to one user at a time. But if there is any other solution, please suggest.
2. For the scenario of the users to be deleted, how will we come to know whether after two years the users have been notified successfully??
This is really urgent. Please suggest any idea regarding the above issues.
Thanks & Regards
Gaurav JainThe way to do it would be to put your human task inside a while loop. This while loop would set a variable to the approver's userid and would continue till all the four approve it. In your human task you need just one approver and that would be the variable which the while loop sets.
If you do it this way, then you can use the OOTB notification tab in the .task and select the 'Assignee' as the email notification receiver and you won't have to worry about getting the email ids as well.
As for the current approach which you have, that is of using the sequential approvers in the human task, I haven't tried it, but just try setting the notification tab in the .task to 'Assignee' and event 'On Assignment'. That should do it as well.
-Bikash -
How to send email notification in different languages in Workflow ?? Urgent Help Needed
Gurus,
How to send email notification in different languages in Workflow? Can anyone send me some useful guidelines or link where it is mentioned.There is no profile option available to specify whether send or not send email notification.
But after login, in preferences youcan set the notification preference value by which you can configure whether to send or not
to send email notifications.
If you select ''Do not send me mail' or 'Disabled' it will not send.
For other values it sends the notfication in different formats like text, html, attachments etc...
Edited by: sarojak on Jun 27, 2011 7:18 AM -
Error while sending email to external mail - Urgent
Hi All,
I am getting error while sending email with attachement. The Error code is 02.
I am not able to identify the error. bold Please help me in solving this problem.
Is it anything wrong with the code or Any Configuration with SCOT/SOST.bold
the code i am using is :
REPORT YVR_F MESSAGE-ID XX .
TABLES : EDIDC, EDIDS, EDPAR.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
PARAMETERS : P_STATUS LIKE EDIDC-STATUS DEFAULT '51'.
SELECT-OPTIONS : S_DIRECT FOR EDIDC-DIRECT,
S_MESTYP FOR EDIDC-MESTYP,
S_CREDAT FOR EDIDC-CREDAT.
SELECTION-SCREEN END OF BLOCK B1 .
PARAMETER: P_EMAIL LIKE SOMLRECI1-RECEIVER,
P_SENDER LIKE SOMLRECI1-RECEIVER no-display,
P_DELSPL AS CHECKBOX,
P_ONLINE NO-DISPLAY.
DATA : TB_EDIDC LIKE STANDARD TABLE OF EDIDC INITIAL SIZE 0 WITH HEADER
LINE.
DATA : TB_EDPAR LIKE STANDARD TABLE OF EDPAR INITIAL SIZE 0 WITH HEADER
LINE.
DATA : TB_KNA1 LIKE STANDARD TABLE OF KNA1 INITIAL SIZE 0 WITH HEADER
LINE.
DATA : TB_ADRC LIKE STANDARD TABLE OF ADRC INITIAL SIZE 0 WITH HEADER
LINE.
DATA: INT_PDF TYPE TABLE OF TLINE WITH HEADER LINE.
DATA : BEGIN OF TB_ED OCCURS 0,
SNDPRN LIKE EDIDC-SNDPRN,
LOC LIKE ADRC-BUILDING,
DOCNUM LIKE EDIDC-DOCNUM,
IDOCTP LIKE EDIDC-IDOCTP,
MESTYP LIKE EDIDC-MESTYP,
DIRECT LIKE EDIDC-DIRECT,
CREDAT LIKE EDIDC-CREDAT,
STATUS LIKE EDIDC-STATUS,
END OF TB_ED.
DATA: IT_MESSAGE TYPE STANDARD TABLE OF SOLISTI1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: IT_ATTACH TYPE STANDARD TABLE OF SOLISTI1 INITIAL SIZE 0
WITH HEADER LINE.
Job Runtime Parameters
DATA: GD_EVENTID LIKE TBTCM-EVENTID,
GD_EVENTPARM LIKE TBTCM-EVENTPARM,
GD_EXTERNAL_PROGRAM_ACTIVE LIKE TBTCM-XPGACTIVE,
GD_JOBCOUNT LIKE TBTCM-JOBCOUNT,
GD_JOBNAME LIKE TBTCM-JOBNAME,
GD_STEPCOUNT LIKE TBTCM-STEPCOUNT,
GD_ERROR TYPE SY-SUBRC,
GD_RECIEVER TYPE SY-SUBRC.
DATA: W_RECSIZE TYPE I,
W_SPOOL_NR LIKE SY-SPONO.
%_print LIKE pri_params.
DATA: GD_SUBJECT LIKE SODOCCHGI1-OBJ_DESCR,
IT_MESS_BOD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
IT_MESS_ATT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
GD_SENDER_TYPE LIKE SOEXTRECI1-ADR_TYP,
GD_ATTACHMENT_DESC TYPE SO_OBJ_NAM,
GD_ATTACHMENT_NAME TYPE SO_OBJ_DES.
Spool to PDF conversions
DATA: GD_SPOOL_NR LIKE TSP01-RQIDENT,
GD_DESTINATION LIKE RLGRAP-FILENAME,
GD_BYTECOUNT LIKE TST01-DSIZE,
GD_BUFFER TYPE STRING.
Binary store for PDF
DATA: BEGIN OF IT_PDF_OUTPUT OCCURS 0.
INCLUDE STRUCTURE TLINE.
DATA: END OF IT_PDF_OUTPUT.
DATA: GD_RECSIZE TYPE I.
CONSTANTS: C_DEV LIKE SY-SYSID VALUE 'DEV',
C_NO(1) TYPE C VALUE ' ',
C_DEVICE(4) TYPE C VALUE 'LOCL'.
DATA: T_PACKING_LIST LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
T_CONTENTS LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_RECEIVERS LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
T_ATTACHMENT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_OBJECT_HEADER LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
W_CNT TYPE I,
W_SENT_ALL(1) TYPE C,
W_DOC_DATA LIKE SODOCCHGI1.
DATA : MSTR_PRINT_PARMS LIKE PRI_PARAMS,
MC_VALID,
P_REPID LIKE SY-REPID,
WF_ID LIKE TSP01-RQIDENT,
LOC_BYTECOUNT TYPE I.
*start-of-selection.
MSTR_PRINT_PARMS-PDEST = 'LOCL'.
P_REPID = SY-REPID.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
authority= ' '
COPIES = '1'
COVER_PAGE = SPACE
DATA_SET = SPACE
DEPARTMENT = SPACE
DESTINATION = 'LP01'
EXPIRATION = '1'
IMMEDIATELY = 'X'
LAYOUT = 'X_65_132'
MODE = SPACE
NEW_LIST_ID = 'X'
NO_DIALOG = 'X'
USER = SY-UNAME
IMPORTING
OUT_PARAMETERS = MSTR_PRINT_PARMS
VALID = MC_VALID
EXCEPTIONS
ARCHIVE_INFO_NOT_FOUND = 1
INVALID_PRINT_PARAMS = 2
INVALID_ARCHIVE_PARAMS = 3
OTHERS = 4.
SUBMIT (P_REPID) TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS MSTR_PRINT_PARMS.
AND RETURN.
NEW-PAGE PRINT ON NO DIALOG PARAMETERS
MSTR_PRINT_PARMS.
perform data.
NEW-PAGE PRINT OFF. "This marks the end of the screen for which the
*SPOOL NO WAS GENERATED.
WF_ID = SY-SPONO.
*converting spool to pdf
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = WF_ID "SPOOL NUMBER
NO_DIALOG = SPACE
PDF_DESTINATION = 'X'
IMPORTING
PDF_BYTECOUNT =
LOC_BYTECOUNT "NUMBER OF BYTES TRANSFERRED
TABLES
PDF = INT_PDF "TABLE FOR PDF REPORT
EXCEPTIONS
ERR_NO_ABAP_SPOOLJOB = 1
ERR_NO_SPOOLJOB = 2
ERR_NO_PERMISSION = 3
ERR_CONV_NOT_POSSIBLE = 4
ERR_BAD_DESTDEVICE = 5
USER_CANCELLED = 6
ERR_SPOOLERROR = 7
ERR_TEMSEERROR = 8
ERR_BTCJOB_OPEN_FAILED = 9
ERR_BTCJOB_SUBMIT_FAILED = 10
ERR_BTCJOB_CLOSE_FAILED = 11
OTHERS = 12.
*CALL FUNCTION 'DOWNLOAD'
*EXPORTING
*bin_filesize = loc_bytecount "NO. OF BYTES
*filename = 'C:/EMAILPDF.PDF'
*filetype = 'BIN'
**IMPORTING
**act_filename = loc_filename
*TABLES
*data_tab = int_pdf.
IF P_DELSPL EQ 'X'.
PERFORM DELETE_SPOOL.
ENDIF.
Transfer the 132-long strings to 255-long strings
LOOP AT INT_PDF.
TRANSLATE INT_PDF USING ' ~'.
CONCATENATE GD_BUFFER INT_PDF INTO GD_BUFFER.
ENDLOOP.
TRANSLATE GD_BUFFER USING '~ '.
DO.
IT_MESS_ATT = GD_BUFFER.
APPEND IT_MESS_ATT.
SHIFT GD_BUFFER LEFT BY 255 PLACES.
IF GD_BUFFER IS INITIAL.
EXIT.
ENDIF.
ENDDO.
DESCRIBE TABLE IT_MESS_ATT LINES GD_RECSIZE.
CHECK GD_RECSIZE > 0.
PERFORM SENDMAIL USING P_EMAIL..
*& Form sendmail
text
--> p1 text
<-- p2 text
FORM SENDMAIL USING P_EMAIL.
CHECK NOT ( P_EMAIL IS INITIAL ).
REFRESH IT_MESS_BOD.
Default subject matter
GD_SUBJECT = 'Subject'.
GD_ATTACHMENT_DESC = 'IDOC LIST'.
CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
IT_MESS_BOD = 'List Of Failed Idocs'.
APPEND IT_MESS_BOD.
IT_MESS_BOD = 'List Of Failed Idocs'.
APPEND IT_MESS_BOD.
If no sender specified - default blank
IF P_SENDER EQ SPACE.
GD_SENDER_TYPE = SPACE.
ELSE.
GD_SENDER_TYPE = 'INT'.
ENDIF.
Send file by email as .xls speadsheet
PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
TABLES IT_MESS_BOD
IT_MESS_ATT
USING P_EMAIL
'Document attachment'
'PDF'
GD_ATTACHMENT_NAME
GD_ATTACHMENT_DESC
P_SENDER
GD_SENDER_TYPE
CHANGING GD_ERROR
GD_RECIEVER.
ENDFORM. " sendmail
*& Form DELETE_SPOOL
text
--> p1 text
<-- p2 text
FORM DELETE_SPOOL.
DATA: LD_SPOOL_NR TYPE TSP01_SP0R-RQID_CHAR.
LD_SPOOL_NR = WF_ID. "GD_SPOOL_NR.
CHECK P_DELSPL <> C_NO.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
SPOOLID = LD_SPOOL_NR.
ENDFORM. " DELETE_SPOOL
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
text
-->P_IT_MESS_BOD text
-->P_IT_MESS_ATT text
-->P_P_EMAIL text
-->P_0846 text
-->P_0847 text
-->P_GD_ATTACHMENT_NAME text
-->P_GD_ATTACHMENT_DESC text
-->P_P_SENDER text
-->P_GD_SENDER_TYPE text
<--P_GD_ERROR text
<--P_GD_RECIEVER text
FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES IT_MESSAGE
IT_ATTACH
USING P_EMAIL
P_MTITLE
P_FORMAT
P_FILENAME
P_ATTDESCRIPTION
P_SENDER_ADDRESS
P_SENDER_ADDRES_TYPE
CHANGING P_ERROR
P_RECIEVER.
DATA: LD_ERROR TYPE SY-SUBRC,
LD_RECIEVER TYPE SY-SUBRC,
LD_MTITLE LIKE SODOCCHGI1-OBJ_DESCR,
LD_EMAIL LIKE SOMLRECI1-RECEIVER,
LD_FORMAT TYPE SO_OBJ_TP ,
LD_ATTDESCRIPTION TYPE SO_OBJ_NAM ,
LD_ATTFILENAME TYPE SO_OBJ_DES ,
LD_SENDER_ADDRESS LIKE SOEXTRECI1-RECEIVER,
LD_SENDER_ADDRESS_TYPE LIKE SOEXTRECI1-ADR_TYP,
LD_RECEIVER LIKE SY-SUBRC.
DATA: T_PACKING_LIST LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
T_CONTENTS LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_RECEIVERS LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
T_ATTACHMENT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_OBJECT_HEADER LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
W_CNT TYPE I,
W_SENT_ALL(1) TYPE C,
W_DOC_DATA LIKE SODOCCHGI1.
LD_EMAIL = P_EMAIL.
LD_MTITLE = P_MTITLE.
LD_FORMAT = P_FORMAT.
LD_ATTDESCRIPTION = P_ATTDESCRIPTION.
LD_ATTFILENAME = P_FILENAME.
LD_SENDER_ADDRESS = P_SENDER.
LD_SENDER_ADDRESS_TYPE = P_SENDER_ADDRES_TYPE.
Fill the document data.
W_DOC_DATA-DOC_SIZE = 1.
Populate the subject/generic message attributes
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE .
W_DOC_DATA-SENSITIVTY = 'F'.
Fill the document data and get size of attachment
CLEAR W_DOC_DATA.
READ TABLE IT_ATTACH INDEX W_CNT.
W_DOC_DATA-DOC_SIZE =
( W_CNT - 1 ) * 255 + STRLEN( IT_ATTACH ).
W_DOC_DATA-OBJ_LANGU = SY-LANGU.
W_DOC_DATA-OBJ_NAME = 'SAPRPT'.
W_DOC_DATA-OBJ_DESCR = LD_MTITLE.
W_DOC_DATA-SENSITIVTY = 'F'.
CLEAR T_ATTACHMENT.
REFRESH T_ATTACHMENT.
T_ATTACHMENT[] = IT_ATTACH[].
Describe the body of the message
CLEAR T_PACKING_LIST.
REFRESH T_PACKING_LIST.
T_PACKING_LIST-TRANSF_BIN = SPACE.
T_PACKING_LIST-HEAD_START = 1.
T_PACKING_LIST-HEAD_NUM = 0.
T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE IT_MESSAGE LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = 'RAW'.
APPEND T_PACKING_LIST.
Create attachment notification
T_PACKING_LIST-TRANSF_BIN = 'X'.
T_PACKING_LIST-HEAD_START = 1.
T_PACKING_LIST-HEAD_NUM = 1.
T_PACKING_LIST-BODY_START = 1.
DESCRIBE TABLE T_ATTACHMENT LINES T_PACKING_LIST-BODY_NUM.
T_PACKING_LIST-DOC_TYPE = LD_FORMAT.
T_PACKING_LIST-OBJ_DESCR = LD_ATTDESCRIPTION.
T_PACKING_LIST-OBJ_NAME = LD_ATTFILENAME.
T_PACKING_LIST-DOC_SIZE = T_PACKING_LIST-BODY_NUM * 255.
APPEND T_PACKING_LIST.
Add the recipients email address
CLEAR T_RECEIVERS.
REFRESH T_RECEIVERS.
T_RECEIVERS-RECEIVER = p_EMAIL.
T_RECEIVERS-REC_TYPE = 'U'.
T_RECEIVERS-COM_TYPE = 'INT'.
T_RECEIVERS-NOTIF_DEL = 'X'.
T_RECEIVERS-NOTIF_NDEL = 'X'.
APPEND T_RECEIVERS.
DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
W_SENT_ALL = 'X'.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = W_DOC_DATA
PUT_IN_OUTBOX = 'X'
SENDER_ADDRESS = LD_SENDER_ADDRESS
SENDER_ADDRESS_TYPE = LD_SENDER_ADDRESS_TYPE
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL = W_SENT_ALL
TABLES
PACKING_LIST = T_PACKING_LIST
object_header = objhead
CONTENTS_BIN = T_ATTACHMENT
CONTENTS_TXT = IT_MESSAGE
RECEIVERS = T_RECEIVERS
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
IF SY-SUBRC NE 0.
MESSAGE E000 WITH 'Error occurred while sending'.
ELSE.
MESSAGE I000 WITH 'The document was sent'.
ENDIF.
ENDFORM. " SEND_FILE_AS_EMAIL_ATTACHMENT
*& Form data
text
--> p1 text
<-- p2 text
FORM data.
SELECT SNDPRN
DOCNUM
IDOCTP
MESTYP
DIRECT
CREDAT
STATUS
FROM EDIDC
INTO CORRESPONDING FIELDS
OF TABLE TB_EDIDC
WHERE STATUS = P_STATUS
AND MESTYP IN S_MESTYP
AND DIRECT IN S_DIRECT
AND CREDAT IN S_CREDAT.
SELECT KUNNR
INPNR
FROM EDPAR
INTO CORRESPONDING FIELDS
OF TABLE TB_EDPAR
FOR ALL ENTRIES IN TB_EDIDC
WHERE KUNNR = TB_EDIDC-SNDPRN.
SELECT KUNNR
ADRNR
FROM KNA1
INTO CORRESPONDING FIELDS
OF TABLE TB_KNA1
FOR ALL ENTRIES IN TB_EDPAR
WHERE KUNNR = TB_EDPAR-INPNR.
SELECT ADDRNUMBER
BUILDING
FROM ADRC
INTO CORRESPONDING FIELDS
OF TABLE TB_ADRC
FOR ALL ENTRIES IN TB_KNA1
WHERE ADDRNUMBER = TB_KNA1-ADRNR.
LOOP AT TB_EDIDC WHERE STATUS = P_STATUS
AND MESTYP IN S_MESTYP
AND DIRECT IN S_DIRECT
AND CREDAT IN S_CREDAT.
TB_ED-SNDPRN = TB_EDIDC-SNDPRN.
TB_ED-DOCNUM = TB_EDIDC-DOCNUM.
TB_ED-IDOCTP = TB_EDIDC-IDOCTP.
TB_ED-MESTYP = TB_EDIDC-MESTYP.
TB_ED-DIRECT = TB_EDIDC-DIRECT.
TB_ED-CREDAT = TB_EDIDC-CREDAT.
TB_ED-STATUS = TB_EDIDC-STATUS.
READ TABLE TB_EDPAR WITH KEY KUNNR = TB_EDIDC-SNDPRN.
READ TABLE TB_KNA1 WITH KEY KUNNR = TB_EDPAR-INPNR.
READ TABLE TB_ADRC WITH KEY ADDRNUMBER = TB_KNA1-ADRNR.
TB_ED-LOC = TB_ADRC-BUILDING.
APPEND TB_ED.
ENDLOOP.
WRITE :/02 'CustomerNo',
15 'Location Code',
30 'Idoc Number',
55 'Basic Type',
70 'Message Type',
95 'Direction',
110 'Received Date',
130 'Status'.
ULINE.
LOOP AT TB_ED.
WRITE :/02 TB_ED-SNDPRN,
15 TB_ED-LOC,
30 TB_ED-DOCNUM,
55 TB_ED-IDOCTP,
70 TB_ED-MESTYP,
95 TB_ED-DIRECT,
110 TB_ED-CREDAT,
130 TB_ED-STATUS.
ENDLOOP.
ENDFORM. " data
Kindly help me in solving the issue.
Thanks in advance.
Suki.Hi,
Check in transaction SCOT. If your mail is in error status in SCOT, you can assure that there is no problem with your code. If your message has not reached till SCOT, then the problem will be with the code.
If the mail is there in scot with error status tell the BASIS to configure it. I feel this could be the problem.
Regards,
Renjith Michael. -
URGENT:Dynamically sending email
hi,
I created an application,in which iam having two input fields.If i entered the email id in 1st input field and person name in other input field,then Email should open .In that the to:should be the email id and the person name should be written in text.So pease reply as quick as possible.>
Micky Oestreich wrote:
> Do you want to start an email client / application like MS Outlook, or do you want to send the email via SAP, which is the 'standard' way of doing so. For the latter option have a look at this blog (with very good explanation):
>
> [Blog: sending email from abap|/people/thomas.jung3/blog/2004/09/09/receiving-e-mail-and-processing-it-with-abap--version-610-and-higher]
Actually that is the receiving Email blog. There is the one for sending email:
[/people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface|/people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface]
You won't be able to open Outlook from Web Dynpro. The blog above shows you how to configure and then code the email sending process. If you want a screen to popup showing the email address and letting the person type the email (like they would if you could open Outlook), you would need to code that yourself in WDA.
>So pease reply as quick as possible.
That really isn't necessary or even polite to say on the forums. People are going to respond when the can. -
Email won't send: KINDA URGENT
Lately my MS Entourage was having trouble sending emails. I had to try several times before they would go out. Now, almost none of them will go. However, I can send to myself and to others in my office. But trying to send to someone outside my domain seems to now be impossible.
To complicate things a bit more. I tried setting up my Mac Mail email software. It could send and receive for a few minutes, then it would not RECEIVE! Now I can't even get it to stay online.
Could this have anything to do with a keychain problemiOS: Unable to send or receive email
http://support.apple.com/kb/TS3899
Can’t Send Emails on iPad – Troubleshooting Steps
http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
Setting up and troubleshooting Mail
http://www.apple.com/support/ipad/assistant/mail/
iPad Mail
http://www.apple.com/support/ipad/mail/
Try a Reset - iPad How-Tos http://ipod.about.com/lr/ipad_how-tos/903396/1/
Or this - Delete the account in Mail and then set it up again.
Cheers, Tom -
Cannot send email from WD Java
hi Experts,
I have created an email WD Java Application, this application sends an email to the users on click of a button.
My Problem is this application runs well on SP11, but we have upgraded our dev portal to SP14.
On SP14 mail is not send. Please help its really very urgent.
I am pasting the code used for sending email.
wdContext.currentEmailElement().setFrom(wdContext.currentContextElement().getEmpMailID());
wdContext.currentEmailElement().setCc("");
wdContext.currentEmailElement().setBcc("");
wdContext.currentEmailElement().setSubject("Personal Travel Request.");
wdContext.currentEmailElement().setTo("[email protected]");
Properties props = new Properties();
String host = "rmail070.zmail.ril.com";
props.put("rmail070.zmail.ril.com", host);
Session session = Session.getInstance(props, null);
MimeMessage message = new MimeMessage(session);
Address toAddress = new InternetAddress();
Address fromAddress = new InternetAddress();
Address ccAddress = new InternetAddress();
Address bccAddress = new InternetAddress();
try
/* Creates an email object with different parts, one for the
text and another for the attached file */
MimeMultipart multipart = new MimeMultipart();
BodyPart messageBodyPart = new MimeBodyPart();
/* the following statements build up the email */
if (! wdContext.currentEmailElement().getFrom().equals(""))
fromAddress = new InternetAddress(wdContext.currentEmailElement().getFrom());
message.setFrom(fromAddress);
} if (! wdContext.currentEmailElement().getTo().equals(""))
toAddress = new InternetAddress(wdContext.currentEmailElement().getTo());
message.setRecipient(Message.RecipientType.TO,toAddress);
if (! wdContext.currentEmailElement().getCc().equals(""))
ccAddress = new InternetAddress(wdContext.currentEmailElement().getCc());
message.setRecipient(Message.RecipientType.CC,ccAddress);
if (! wdContext.currentEmailElement().getBcc().equals(""))
bccAddress = new InternetAddress(wdContext.currentEmailElement().getBcc());
message.setRecipient(Message.RecipientType.BCC,bccAddress);
if (!wdContext.currentEmailElement().getSubject().equals(""))
message.setSubject(wdContext.currentEmailElement().getSubject());
if (! wdContext.currentEmailElement().getBody().equals(""))
messageBodyPart.setText(wdContext.currentEmailElement().getBody());
multipart.addBodyPart(messageBodyPart);
/* a new part will be added, in the complete email this will
be the attachment */
messageBodyPart = new MimeBodyPart();
// try{
// String filename =WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(),"test.pdf");
// DataSource source = new FileDataSource(filename);
// messageBodyPart.setDataHandler(new DataHandler(source));
// messageBodyPart.setFileName(source.getName());
// messageBodyPart.setHeader("Content-Type","application/pdf");
// multipart.addBodyPart(messageBodyPart);
message.setContent(multipart);
Transport.send(message);
// catch(WDAliasResolvingException e)
// e.getMessage();
catch (AddressException e)
wdComponentAPI.getMessageManager().reportWarning(e.
getLocalizedMessage());
e.printStackTrace();
catch (SendFailedException e)
wdComponentAPI.getMessageManager().reportWarning(e.getLocalizedMessage());
e.printStackTrace();
catch (MessagingException e)
wdComponentAPI.getMessageManager().reportWarning(e.getLocalizedMessage());
e.printStackTrace();
Points will be rewarded to helpful answers.
Regards,
Sanjyoti.Hi,
see this link it will be helpful for u
[http://help.sap.com/saphelp_nw04/helpdata/en/f7/f289c67c759a41b570890c62a03519/content.htm|http://help.sap.com/saphelp_nw04/helpdata/en/f7/f289c67c759a41b570890c62a03519/content.htm]
regards
Hazrath -
i am having internal table contains values.
i want that output should be send as an email attachment to email id given in selection screen.
but chinese can't diaplay rightly in attachment.eg:'批次; ','日期,and so on,all can't display rightly! .
please help me its urgent.thank you
*& Report YPD00010A
*& DEVELOPER/DATE : SJDU / 12.06.2007
*& REPORT: display barcodes which can't be updated in the sta
*& of x_ray
REPORT YPD00010A no standard page heading
line-count 90
line-size 120 .
selection-screen begin of block sel with frame.
PARAMETERS:
PA_WERKS LIKE YP043D-WERKS OBLIGATORY DEFAULT '8000',
PA_MAIL like ys054-mailaddress MATCHCODE OBJECT ZMAILADDRESS,
PA_MAIL1 like ys054-mailaddress MATCHCODE OBJECT ZMAILADDRESS,
PA_ZBAT like YP043D-ZBAT OBLIGATORY MATCHCODE OBJECT ZZBAT. "File
selection-screen end of block sel.
DATA: BEGIN OF Line1,
ZBARCD LIKE yp043d-zbarcd,
END OF Line1.
DATA: ta_yp043d like Line1 occurs 0 with header line.
data: begin of TAB,
X(1) type x value '09',
end of tab,
C(10) type c.
class cl_abap_char_utilities definition load.
c+5(1) = cl_abap_char_utilities=>horizontal_tab.
DATA:
it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0 WITH HEADER
LINE,
it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0 WITH HEADER
LINE.
data: p_email TYPE somlreci1-receiver .
data: p_email2 TYPE somlreci1-receiver .
DATA: TP_MAIL(255) TYPE C.
DATA: TP_MAIL_MAIN(255) TYPE C.
DATA: TP_MAIL_TMP(255) TYPE C.
DATA:
t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_doc_data LIKE sodocchgi1,
w_cnt TYPE I,
w_sent_all(1) TYPE C,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
DATA:COUNT1 TYPE I VALUE 0,
COUNT2 TYPE I VALUE 0.
INITIALIZATION.
clear: ta_yp043d, it_attach, it_message.
REFRESH: ta_yp043d, it_attach, it_message.
START-OF-SELECTION.
PERFORM GET_DATA.
IF PA_MAIL <> ' ' OR PA_MAIL1 <> ' '.
READ TABLE TA_YP043D INDEX 1.
IF SY-SUBRC = 0 .
pERFORM SEND_EMAIL.
ENDIF.
ENDIF.
END-OF-SELECTION.
PERFORM GET_WRITEDATA.
TOP-OF-PAGE.
PERFORM GET_HEADER.
END-OF-PAGE.
*& Form GET_HEADER *
*& To display the header *
FORM GET_HEADER.
data:
tp_header(120) type c.
TP_HEADER = '山东公司条码表'.
WRITE:4 '程序序号:',10 'YPD00010', 42 tp_header,
92 '日期:',102 SY-DATUM+0(4),
106 '年',
108 SY-DATUM+4(2),110 '月',112 SY-DATUM+6(2),114 '日',
/92 '时间 :',SY-TIMLO,
/3 '上传凭证:',18 PA_ZBAT, 92 '页码 :', SY-PAGNO.
ULINE.
ENDFORM.
*& Form GET_DATA
* text
* --> p1 text
* <-- p2 text
FORM GET_DATA .
DATA:TP_ZBARCD LIKE YP043-ZBARCD,
TP_ZBARCD1 LIKE YP043-ZBARCD,
TP_ZVALS LIKE YP043D-ZVALS.
SELECT ZBARCD INTO CORRESPONDING FIELDS OF TABLE ta_yp043d FROM YP043D
WHERE WERKS = PA_WERKS AND ZBAT = PA_ZBAT
AND ZUPDS = 'N' AND ZVALS = 'B' AND ZLVORM <> 'X'.
ENDFORM. " GET_DATA
*& Form GET_WRITEDATA
* text
* --> p1 text
* <-- p2 text
FORM GET_WRITEDATA .
WRITE: /'硫化未上传的条码有:'.
SKIP.
LOOP AT TA_YP043D.
WRITE:TA_YP043D-ZBARCD,' '.
ENDLOOP.
ENDFORM. " GET_WRITEDATA
*& Form SEND_EMAIL
* text
* --> p1 text
* <-- p2 text
FORM SEND_EMAIL.
READ TABLE TA_YP043D INDEX 1.
IF SY-SUBRC = 0 .
* Retrieve sample data from table ekpo
* PERFORM DATA_RETRIEVAL.
* Populate table with detaisl to be entered into .htm file
PERFORM BUILD_XLS_DATA_TABLE.
* Populate message body text
PERFORM POPULATE_EMAIL_MESSAGE_BODY.
* Send file by email attached as .htm file
PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
TABLES it_message
it_attach
USING p_email
'条码系统出库有问题的条码'
'HTML'
'WC_Document'
CHANGING gd_error
gd_reciever.
* Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
ENDIF.
ENDFORM. " SEND_EMAIL
*& Form BUILD_XLS_DATA_TABLE
* text
* --> p1 text
* <-- p2 text
FORM BUILD_XLS_DATA_TABLE .
CONCATENATE '<' 'HTML' '>' INTO it_attach .
APPEND it_attach.
CONCATENATE '<' 'HEAD' '>' INTO it_attach .
APPEND it_attach.
CONCATENATE
'<meta http-equiv=Content-Type content=' '"' 'text/html; charset= GB2312
''"' '>' INTO it_attach.
APPEND it_attach.
CONCATENATE '<' '/HEAD' '>' INTO it_attach .
APPEND it_attach.
CONCATENATE '<P style=''font-size:12.0PT''><B> 批次:' pa_zbat
'</B></P>' INTO it_attach SEPARATED BY
CL_ABAP_CHAR_UTILITIES=>horizontal_tab.
APPEND it_attach.
CONCATENATE '<P style=''font-size:12.0pt''><B> 日期:' sy-datum
'</B></P>' INTO it_attach SEPARATED BY
CL_ABAP_CHAR_UTILITIES=>horizontal_tab.
APPEND it_attach.
CONCATENATE '<P style=''font-size:12.0pt''><B>' '硫化未上传的条码有: '
'</B></P>' INTO it_attach SEPARATED BY
CL_ABAP_CHAR_UTILITIES=>horizontal_tab.
APPEND it_attach.
*CONCATENATE '<P style=''font-size:12.0pt''><B>' ' ' ' </B></P>' INTO
*it_attach.
*APPEND it_attach.
LOOP AT TA_YP043D .
*CONCATENATE '< style=''font-size:12.0pt''><B> ' TAB-ZBARCD '</B>'
CONCATENATE '<B> ' TA_YP043D-ZBARCD ' </B>' INTO
it_attach .
APPEND it_attach.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form POPULATE_EMAIL_MESSAGE_BODY
* text
* --> p1 text
* <-- p2 text
FORM POPULATE_EMAIL_MESSAGE_BODY .
DATA: TP_TEST0(255) TYPE C,
TP_TEST3(255) TYPE C,
TP_TEST(255) TYPE C.
TP_TEST = '当轮胎进行X光机数据上传时,有些条码在硫化阶段不存在资料'.
TP_TEST0 = '请您查看并尽快解决.'.
CONCATENATE TP_TEST TP_TEST0 INTO TP_TEST3 SEPARATED BY ' , '.
APPEND '尊敬的先生/女士,' TO it_message.
APPEND ' ' TO it_message.
APPEND TP_TEST3 TO it_message.
APPEND '具体问题请查看附件.' TO it_message.
APPEND ' ' TO it_message.
APPEND '谢谢.' TO it_message.
APPEND ' ' TO it_message.
APPEND '来自,' TO it_message.
APPEND SY-UNAME TO it_message.
ENDFORM. " POPULATE_EMAIL_MESSAGE_BODY
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT *
*& Send email *
FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES pit_message
pit_attach
USING p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
CHANGING p_error
p_reciever.
DATA:
ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_email2 LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver value
'[email protected]',
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
data: TMP_MAIL(40) TYPE C.
DATA: MAIN_EMAIL(40) TYPE C.
DATA: TMP_POS TYPE I .
DATA: ADD_EMAIL(40) TYPE C.
DATA: L_POS TYPE I, R_POS TYPE I, MAIL_LEN TYPE I.
ld_email = p_email.
ld_email2 = p_email2.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
* Fill the document data.
w_doc_data-doc_size = 1.
* Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
* Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = pit_attach[].
* Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
* Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
* Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
TP_MAIL_MAIN = PA_MAIL.
TP_MAIL = PA_MAIL1.
if sy-subrc = 0 .
t_receivers-receiver = TP_MAIL_MAIN.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
ENDIF.
*READ FROM TP_MAIL LIST
TP_MAIL_TMP = TP_MAIL .
WHILE SY-SUBRC = 0 .
SEARCH TP_MAIL_TMP FOR ', ' .
MAIL_LEN = STRLEN( TP_MAIL_TMP ) .
IF SY-SUBRC = 0 .
TMP_POS = sy-fdpos .
ADD_EMAIL = TP_MAIL_TMP+0(TMP_POS) .
R_POS = TMP_POS + 2 .
L_POS = MAIL_LEN - TMP_POS .
TP_MAIL_TMP = TP_MAIL_TMP+R_POS(L_POS) .
ELSE.
ADD_EMAIL = TP_MAIL_TMP .
ENDIF.
t_receivers-receiver = ADD_EMAIL.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
t_receivers-COPY = 'X' .
APPEND t_receivers.
ENDWHILE.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
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.
* Populate zerror return code
ld_error = sy-subrc.
* Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM. " SEND_FILE_AS_EMAIL_ATTACHMENT
*& Form INITIATE_MAIL_EXECUTE_PROGRAM *
*& Instructs mail send program for SAPCONNECT to send email *
FORM INITIATE_MAIL_EXECUTE_PROGRAM.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
Message was edited by:
shanjing du
Message was edited by:
shanjing duTry the following.
You may need to add language parameter to "CALL METHOD cl_document_bcs=>create_document", or perhaps replace it with a call to the ADD_ATTACHMENT method or some other method of this class - there are public methods for text, MIME, office documents.
==================
*& Report ZLOCAL_EMAIL_TEST
Test of ECC Send email using class CL_BCS
REPORT zlocal_email_test.
DATA:
l_obj TYPE REF TO cl_bcs,
l_recip TYPE REF TO if_recipient_bcs,
l_rec TYPE REF TO cl_cam_address_bcs,
sender TYPE REF TO if_sender_bcs,
note TYPE bcsy_text,
line TYPE soli,
l_address TYPE adr6-smtp_addr,
l_result TYPE os_boolean,
l_sub TYPE string,
text TYPE bcsy_text,
document TYPE REF TO cl_document_bcs.
parameters: p_email like ADR6-SMTP_ADDR visible length 70,
p_uname like sy-uname default sy-uname.
START-OF-SELECTION.
Create email instance
l_obj = cl_bcs=>create_persistent( ).
Build text of message
APPEND 'Hello World' TO text.
APPEND 'Hello World 2' TO text.
APPEND 'Hello World 3' TO text.
APPEND 'Hello World 4' TO text.
Create the email document
CALL METHOD cl_document_bcs=>create_document
EXPORTING
i_type = 'RAW'
i_subject = 'subject line'
I_LENGTH =
I_LANGUAGE = SPACE
I_IMPORTANCE =
I_SENSITIVITY =
i_text = text
I_HEX =
I_HEADER =
I_SENDER =
RECEIVING
result = document.
Add document to email object
CALL METHOD l_obj->set_document
EXPORTING
i_document = document.
Short form version
CALL METHOD l_obj->set_document( document ).
Build long subject line
CONCATENATE 'Long subject' sy-abcde 'with still more'
'Long subject' sy-abcde 'with still more'
'Long subject' sy-abcde 'with still more'
INTO l_sub SEPARATED BY space.
Add long subject to the email
CALL METHOD l_obj->set_message_subject
EXPORTING
ip_subject = l_sub.
Get recipient address in correct format
CALL METHOD cl_cam_address_bcs=>create_internet_address
EXPORTING
i_address_string = p_email
RECEIVING
result = l_rec.
Add recipient address to the email
CALL METHOD l_obj->add_recipient
EXPORTING
i_recipient = l_rec
i_express = 'X'.
Get Sender address in correct format
CALL METHOD cl_sapuser_bcs=>create
EXPORTING
i_user = p_uname
RECEIVING
result = sender.
Short form version of this method call
sender = cl_sapuser_bcs=>create( sy-uname ).
Add sender to the email
CALL METHOD l_obj->set_sender
EXPORTING
i_sender = sender.
Send the email
CALL METHOD l_obj->send
EXPORTING
I_WITH_ERROR_SCREEN = SPACE
RECEIVING
result = l_result.
Required commit work.
COMMIT WORK. -
Sending email and alert notifcation using function module
Hi All,
I am trying to send email and alert notification messages using function modules in CRM. I am unable to send mail using 'SO_DOCUMENT_SEND_API1'. Getting a short dump message "dictionary mismatch". If anyone knows any FM which can be used for sending mails, please let me know. I also want to send alert messages using some FM. Please let me know any FM in this case as well.
All help appreciated. This is urgent and please get back to me soon.
Thanks
DenoHi Ranjit,
Thanks a lot for the reply. I already tried these FMs and getting the error message
Trigger Location of Runtime Error
Program SAPLBUPA_INTERFACE_TDTRANS
Include LBUPA_INTERFACE_TDTRANSTOP
Row 4
I dont know the reason behind the error. The SO_document_send FM is used inside all these FMs. So It wont work.
Thanks
Deno -
Send Email & JavaScript integration in Applets
Hi there folks,
I have a Java Applet which is having the following things.
1. Send Email to a Friend about this.
2. Next (>) and Previous (<) buttons.
now my question is, on click of option 1, a pop-up must be displayed (asking To & From) & i've an URL, it needs to be sent to a friend via an email on click of the option 1 as i mentioned above.. how can i accomplish this to send an email on Java & Applets? more over is it possible??
is it possible to integrate Javascript on Applets?? i need to make my option 2 as javascript enabled & these < & > buttons must take me to Previous or Next topic.
any Idea on the above??? your help would be really appreciated. it's very urgent for me.
thanks in advance for reading my forum.
Cheers,
Satya>
i hope you got an idea on what i'm actually trying to do?>The impression I get from your two posts on the subject is that you have no idea what you you are trying to do!
The first post mentions applets and JavaScript several times, yet your later post claims this is a "stand alone desktop swing application". The process of sending an email from within a web page (well described in the first reply) is very different than from a stand-alone application.
Then you bring up 'next' and 'previous' topics like we should know what you are referring to. And you are still wondering whether to 'integrate JS' into you app. WTF for? What 'ability' do you see the JS as providing?
If you hope to get meaningful help, you need to lift your game and spend more time describing the problem domain and constraints of the functionality you wish to offer to the end user. -
Have just updated from OS 10.3.9 to 10.4.3. via install DVD - Everything OK
I then updated to 10.4.8 Via Apples Sopftware Update. Everything else appears to be OK except that I cannot compose or send eMail (V2.1)
ie. On "New Mail", can insert To and Subject info, but cannot enter anything after first word in text message. Clicking on "send" on icon or in menu will not send message.
Am receiving incoming eMail OK, and Safari works. (So Connection to SP must be OK. Have checked account info. etc.)
I feel it must be corrupted "Mail" software.
How Can I or Should I, reinstall Mail 2.1 by itself.
Whats the next step?
Urgent - can anyone help please ? Note: I do have a second Mac with which I can reply to emails.
Benrobe
Power Mac G4 Quick Silver 800 Mac OS X (10.4.8) Reasonable/Good Mac Experience
Power Mac G4 Quick Silver 800 Mac OS X (10.4.8) Reasonable/Good Mac ExperienceThis problem in Mail is usually caused by some Launch Services cache or preferences corruption. The following article describes how to manually reset Launch Services -- the notes at the bottom of the article also provide information about the side effects of deleting each of the files involved:
Resetting Launch Services
If you prefer using a cache cleaning utility instead of following the manual procedure described in the previous article, this other article provides links to some utilities that can be used for troubleshooting and cache cleaning:
Resolving Disk, Permission, and Cache Corruption
It seems that the most appropriate utility for solving this particular problem is Tiger Cache Cleaner, but you may also want to consider other utilities, such as OnyX, or Cache Out X, which are free. Whatever utility you choose, be sure to read this first:
Side effects of System cache cleaning
As an example, this is how you should proceed with OnyX:
1. Quit all applications.
2. Launch OnyX and enter your administrator password.
3. Click Maintenance. In the Reset section, check LaunchServices database.
4. You may uncheck any other pre-checked options if you wish.
5. Click the Execute button.
6. Restart the computer. -
i am having internal table contains values.
i want that output should be send as an email attachment
to email id given in selection screen.
but chinese can't diaplay rightly in attachment .
the code is this:
data: begin of TAB,
X(1) type x value '09',
end of tab,
C(10) type c.
class cl_abap_char_utilities definition load.
c+5(1) = cl_abap_char_utilities=>horizontal_tab.
*& Form SEND_EMAIL
text
--> p1 text
<-- p2 text
FORM SEND_EMAIL.
READ TABLE TA_YP043D INDEX 1.
IF SY-SUBRC = 0 .
Retrieve sample data from table ekpo
PERFORM DATA_RETRIEVAL.
Populate table with detaisl to be entered into .htm file
PERFORM BUILD_XLS_DATA_TABLE.
Populate message body text
PERFORM POPULATE_EMAIL_MESSAGE_BODY.
Send file by email attached as .htm file
PERFORM SEND_FILE_AS_EMAIL_ATTACHMENT
TABLES it_message
it_attach
USING p_email
'条码系统出库有问题的条码'
'HTML'
'WC_Document'
CHANGING gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM INITIATE_MAIL_EXECUTE_PROGRAM.
ENDIF.
ENDFORM. " SEND_EMAIL
*& Form BUILD_XLS_DATA_TABLE
text
--> p1 text
<-- p2 text
FORM BUILD_XLS_DATA_TABLE .
CONCATENATE '<' 'HTML' '>' INTO it_attach .
APPEND it_attach.
CONCATENATE '<' 'HEAD' '>' INTO it_attach .
APPEND it_attach.
CONCATENATE
'<meta http-equiv=Content-Type content=' '"' 'text/html; charset= GB2312
''"' '>' INTO it_attach.
APPEND it_attach.
CONCATENATE '<' '/HEAD' '>' INTO it_attach .
APPEND it_attach.
CONCATENATE '<P style=''font-size:12.0PT''><B> 批次:' pa_zbat
'</B></P>' INTO it_attach SEPARATED BY
CL_ABAP_CHAR_UTILITIES=>horizontal_tab.
APPEND it_attach.
CONCATENATE '<P style=''font-size:12.0pt''><B> 日期:' sy-datum
'</B></P>' INTO it_attach SEPARATED BY
CL_ABAP_CHAR_UTILITIES=>horizontal_tab.
APPEND it_attach.
CONCATENATE '<P style=''font-size:12.0pt''><B>' '硫化未上传的条码有: '
'</B></P>' INTO it_attach SEPARATED BY
CL_ABAP_CHAR_UTILITIES=>horizontal_tab.
APPEND it_attach.
*CONCATENATE '<P style=''font-size:12.0pt''><B>' ' ' ' </B></P>' INTO
*it_attach.
*APPEND it_attach.
LOOP AT TA_YP043D .
*CONCATENATE '< style=''font-size:12.0pt''><B> ' TAB-ZBARCD '</B>'
CONCATENATE '<B> ' TA_YP043D-ZBARCD ' </B>' INTO
it_attach .
APPEND it_attach.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
*& Form POPULATE_EMAIL_MESSAGE_BODY
text
--> p1 text
<-- p2 text
FORM POPULATE_EMAIL_MESSAGE_BODY .
DATA: TP_TEST0(255) TYPE C,
TP_TEST3(255) TYPE C,
TP_TEST(255) TYPE C.
TP_TEST = '当轮胎进行X光机数据上传时,有些条码在硫化阶段不存在资料'.
TP_TEST0 = '请您查看并尽快解决.'.
CONCATENATE TP_TEST TP_TEST0 INTO TP_TEST3 SEPARATED BY ' , '.
APPEND '尊敬的先生/女士,' TO it_message.
APPEND ' ' TO it_message.
APPEND TP_TEST3 TO it_message.
APPEND '具体问题请查看附件.' TO it_message.
APPEND ' ' TO it_message.
APPEND '谢谢.' TO it_message.
APPEND ' ' TO it_message.
APPEND '来自,' TO it_message.
APPEND SY-UNAME TO it_message.
ENDFORM. " POPULATE_EMAIL_MESSAGE_BODY
*& Form D_FILE_AS_EMAIL_ATTACHMENT *
*& Send *
FORM SEND_FILE_AS_EMAIL_ATTACHMENT TABLES pit_message
pit_attach
USING p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
CHANGING p_error
p_reciever.
DATA:
ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_email2 LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver value
'[email protected]',
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
data: TMP_MAIL(40) TYPE C.
DATA: MAIN_EMAIL(40) TYPE C.
DATA: TMP_POS TYPE I .
DATA: ADD_EMAIL(40) TYPE C.
DATA: L_POS TYPE I, R_POS TYPE I, MAIL_LEN TYPE I.
ld_email = p_email.
ld_email2 = p_email2.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = pit_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
TP_MAIL_MAIN = PA_MAIL.
TP_MAIL = PA_MAIL1.
if sy-subrc = 0 .
t_receivers-receiver = TP_MAIL_MAIN.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
ENDIF.
*READ FROM TP_MAIL LIST
TP_MAIL_TMP = TP_MAIL .
WHILE SY-SUBRC = 0 .
SEARCH TP_MAIL_TMP FOR ', ' .
MAIL_LEN = STRLEN( TP_MAIL_TMP ) .
IF SY-SUBRC = 0 .
TMP_POS = sy-fdpos .
ADD_EMAIL = TP_MAIL_TMP+0(TMP_POS) .
R_POS = TMP_POS + 2 .
L_POS = MAIL_LEN - TMP_POS .
TP_MAIL_TMP = TP_MAIL_TMP+R_POS(L_POS) .
ELSE.
ADD_EMAIL = TP_MAIL_TMP .
ENDIF.
t_receivers-receiver = ADD_EMAIL.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
t_receivers-COPY = 'X' .
APPEND t_receivers.
ENDWHILE.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
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.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM. " SEND_FILE_AS_EMAIL_ATTACHMENT
*& Form INITIATE_MAIL_EXECUTE_PROGRAM *
*& Instructs mail send program for SAPCONNECT to send email *
FORM INITIATE_MAIL_EXECUTE_PROGRAM.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
please help me its urgent.thank you.
Message was edited by:
shanjing du
Message was edited by:
shanjing duhi,
chkout this code...
1..intab to CSV
tYPE-POOLS: truxs.
TYPES:
BEGIN OF ty_Line,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
END OF ty_Line.
ty_Lines TYPE STANDARD TABLE of ty_Line WITH DEFAULT KEY.
DATA: itab TYPE ty_Lines.
DATA: itab1 TYPE truxs_t_text_data.
SELECT
vbeln
posnr
UP TO 10 ROWS
FROM vbap
INTO TABLE itab.
CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'
EXPORTING
i_field_seperator = ';'
TABLES
i_tab_sap_data = itab
CHANGING
i_tab_converted_data = itab1
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:TEMP est.txt'
TABLES
data_tab = itab1
EXCEPTIONS
OTHERS = 1.
2) to send email
*& Report ZEMAIL
REPORT ZEMAIL.
data: itcpo like itcpo,
tab_lines like sy-tabix.
Variables for EMAIL functionality
data: maildata like sodocchgi1.
data: mailpack like sopcklsti1 occurs 2 with header line.
data: mailhead like solisti1 occurs 1 with header line.
data: mailbin like solisti1 occurs 10 with header line.
data: mailtxt like solisti1 occurs 10 with header line.
data: mailrec like somlrec90 occurs 0 with header line.
data: solisti1 like solisti1 occurs 0 with header line.
perform send_form_via_email.
FORM SEND_FORM_VIA_EMAIL *
form send_form_via_email.
clear: maildata, mailtxt, mailbin, mailpack, mailhead, mailrec.
refresh: mailtxt, mailbin, mailpack, mailhead, mailrec.
Creation of the document to be sent File Name
maildata-obj_name = 'TEST'.
Mail Subject
maildata-obj_descr = 'Subject'.
Mail Contents
mailtxt-line = 'Here is your file'.
append mailtxt.
Prepare Packing List
perform prepare_packing_list.
Set recipient - email address here!!!
mailrec-receiver = '[email protected]'.
mailrec-rec_type = 'U'.
append mailrec.
Sending the document
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = maildata
put_in_outbox = ' '
tables
packing_list = mailpack
object_header = mailhead
contents_bin = mailbin
contents_txt = mailtxt
receivers = mailrec
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.
endform.
Form PREPARE_PACKING_LIST
form prepare_packing_list.
clear: mailpack, mailbin, mailhead.
refresh: mailpack, mailbin, mailhead.
describe table mailtxt lines tab_lines.
read table mailtxt index tab_lines.
maildata-doc_size = ( tab_lines - 1 ) * 255 + strlen( mailtxt ).
Creation of the entry for the compressed document
clear mailpack-transf_bin.
mailpack-head_start = 1.
mailpack-head_num = 0.
mailpack-body_start = 1.
mailpack-body_num = tab_lines.
mailpack-doc_type = 'RAW'.
append mailpack.
mailhead = 'TEST.TXT'.
append mailhead.
File 1
mailbin = 'This is file 1'.
append mailbin.
describe table mailbin lines tab_lines.
mailpack-transf_bin = 'X'.
mailpack-head_start = 1.
mailpack-head_num = 1.
mailpack-body_start = 1.
mailpack-body_num = tab_lines.
mailpack-doc_type = 'TXT'.
mailpack-obj_name = 'TEST1'.
mailpack-obj_descr = 'Subject'.
mailpack-doc_size = tab_lines * 255.
append mailpack.
*File 2
mailbin = 'This is file 2'.
append mailbin.
data: start type i.
data: end type i.
start = tab_lines + 1.
describe table mailbin lines end.
mailpack-transf_bin = 'X'.
mailpack-head_start = 1.
mailpack-head_num = 1.
mailpack-body_start = start.
mailpack-body_num = end.
mailpack-doc_type = 'TXT'.
mailpack-obj_name = 'TEST2'.
mailpack-obj_descr = 'Subject'.
mailpack-doc_size = tab_lines * 255.
append mailpack.
With PDF Attachment:
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Z_TEST'
IMPORTING
fm_name = v_fname.
CALL FUNCTION v_fname
EXPORTING
control_parameters = x_ctrl_p
IMPORTING
job_output_info = x_output_data.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 134
IMPORTING
bin_filesize = v_size
TABLES
otf = x_output_data-otfdata
lines = it_lines
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
EXPORTING
line_width_dst = 255
TABLES
content_in = it_lines
content_out = it_soli
EXCEPTIONS
err_line_width_src_too_long = 1
err_line_width_dst_too_long = 2
err_conv_failed = 3
OTHERS = 4.
CALL FUNCTION 'FUNC_CONVERT_DATA_ODC01'
EXPORTING
iv_byte_mode = 'X'
TABLES
it_data = it_lines
et_data = it_table.
*-----To caluculate total number of lines of internal table
DESCRIBE TABLE it_table LINES v_lines.
*-----Create Message Body and Title and Description
it_mess = 'successfully converted smartform from otf format to pdf' .
APPEND it_mess.
wa_doc_data-obj_name = 'smartform'.
wa_doc_data-expiry_dat = sy-datum + 10.
wa_doc_data-obj_descr = 'smartform'.
wa_doc_data-sensitivty = 'F'.
wa_doc_data-doc_size = v_lines * 255.
APPEND it_pcklist.
*-----PDF Attachment
it_pcklist-transf_bin = 'X'.
it_pcklist-head_start = 1.
it_pcklist-head_num = 0.
it_pcklist-body_start = 1.
it_pcklist-doc_size = v_lines_bin * 255 .
it_pcklist-body_num = v_lines.
it_pcklist-doc_type = 'PDF'.
it_pcklist-obj_name = 'smartform'.
it_pcklist-obj_descr = 'smart_desc'.
it_pcklist-obj_langu = 'E'.
it_pcklist-doc_size = v_lines * 255.
APPEND it_pcklist.
*-----Giving the receiver email-id
CLEAR it_receivers.
it_receivers-receiver = [email protected]'.
it_receivers-rec_type = 'U'.
APPEND it_receivers.
*-----Calling the function module to sending email
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_data
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_pcklist
contents_txt = it_mess
contents_hex = it_table
receivers = it_receivers
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.
also chk these links..
https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=sendingmailsfrominternaltable&adv=false&sortby=cm_rnd_rankvalue
thanks
jaideep
*reward points if useful... -
Can recieve but not send emails, although outgoing server settings look ok.
I am able to receive email, but I am not able to send email. I have run the connection doctor - My email connects to the internet; I connect to the incoming mail server, but I am not able to connect to the Outgoing Mail Server.
I have looked at the settings on the outgoing server 'edit server list' and they appear fine. The smtp address is ok, as is the username and password. I have selected 'Use Default Ports 25, 465, 587', as usual. Still it won't connect to the Outgoing Mail Server. It was working fine 24 hours ago, and I haven't changed anything... It now says that both of my outgoing servers are offline, although my colleagues can all send emails from these servers, the problem is only with my laptop.
Any ideas? I have emails that urgently need to be sent.
Thanks in advance!I am in an identical boat! Except that in my case it is a result of having re-installed OS10.5.8 (archive install) over 10.6.2 (as the latter was causing more trouble than advantage).
In another thread, procedure for re-set included erasing "com.apple.mail.plist", but I don't have one
The 'network diagnostics' button is greyed out in 'connection doctor'; maybe irrelevent since internet and incoming emails to one of 2 accounts are working. But also Connection Doctor shows doubled-up accounts, probably 1 set originating from connection protocol during OS10.5.4 installation when I was guessing at the settings and the other from editing the preference panes to those I have working fine on my G4 powerbook (not identical as that is in 10.4.11 & Mail 2.1) -
Help needed! How to send Email if user created in a specific organization
Hello experts.
I have edited the Create User workflow to include the Email notiifcation. I follow the example in the manual under Example workflow customization.
What I have discovered is that it will send email no matter which Organization a user is created in. e.g. Top or Top:MyOrg or Top:Disabled
I only want Email sent if user is created in Top:MyOrg
What data is available during the workflow?
Currently the transition to Email User in the Notify activity doesnt have a condition... it will always branch to Email User.
What I want is a conditional branch only doing the Email User if the organization=Top:MyOrg
What does this condition look like?
I guess I also need to include a branch to end in the Notify if necessary.
I am new to customizing workflow but this is urgent request.sorry.
trial and error have shown me that
<eq>
<ref>user.waveset.organization</ref>
<s>Top:MyOrg</s>
</eq>
is the condition for me to use. -
Servlet for sending email error
i working for send email using servlet and html. when i run i got this error..
what cause this problem.
please someone help me. urgent!!!
thank you in advance
servlet error........
ENCOUNTERED EXCEPTION: java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
at EmailSMSServlet.doPost(EmailSMSServlet.java:123)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at filters.ExampleFilter.doFilter(ExampleFilter.java:149)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
at java.lang.Thread.run(Thread.java:536)here is my code...actually my program send email from SMS. i parser SMS to email format. My SMS part is working but when i combine it,i got error as above. I tried run without servlet (using command prompt) it working properly and i can send email.
public class EmailSMSServlet extends HttpServlet
CService srv;
int status;
LinkedList msgList;
public void init(ServletConfig config) throws ServletException {
super.init(config);
srv = new CService("com4", 9600);
msgList = new LinkedList();
srv.initialize();
srv.setCacheDir(".\\");
public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException
PrintWriter writer = response.getWriter();
response.setContentType("text/html");
writer.println("<html>");
writer.println("<head>");
writer.println("<title>SMS TO EMAIL</title>");
writer.println("</head>");
writer.println("<body bgcolor=\"blue\">");
writer.println("test");
try
status = srv.connect();
if (status == CService.ERR_OK)
srv.setOperationMode(CService.MODE_PDU);
if(srv.readMessages(msgList,CIncomingMessage.CLASS_ALL)==CService.ERR_OK)
for (int i = 0; i < msgList.size(); i ++)
CIncomingMessage msg =(CIncomingMessage)msgList.get(i);
String s=msg.getText();
String from1=msg.getOriginator()+"@mysite.bla.bla";
writer.println(s);
writer.println("<p>");
writer.println(from1);
writer.println("<p>");
// parser sms to email ...
String delim = "#";
StringTokenizer st= new StringTokenizer(s,delim);
String str[] = new String[st.countTokens()];
int j=0;
while (st.hasMoreTokens())
str[j++] = st.nextToken();
writer.println("<p>");
writer.println("Kepada:");
writer.println(str[0]);
for(int k = 0; k < str.length; k++)
writer.println(str[k]);
// Send mail using javamail.....
Properties props=new Properties();
props.put("mail.transport.default",blah");
props.put("mail.smtp.host","blah");
try{
Properties props=new Properties();
props.put("mail.transport.default","smtp");
props.put("mail.smtp.host","host");
Session mailSession=Session.getInstance(props,null);
Message mssg=new MimeMessage(mailSession);
mssg.setSubject(str[1]);
mssg.setContent(str[2],"text/plain");
Address to =new InternetAddress(str[0]);
mssg.setRecipient(Message.RecipientType.TO,to);
Address from=new InternetAddress(from1);
mssg.setFrom(from);
Transport.send(mssg);
writer.println("Succes");
} catch (Throwable t) {
writer.println("<font color=\"red\">");
writer.println("ENCOUNTERED EXCEPTION: " + t);
writer.println("<pre>");
t.printStackTrace(writer);
writer.println("</pre>");
writer.println("</font>");
srv.disconnect();
else
writer.println("Connection to mobile failed, error: " + status);
catch (Exception e)
e.printStackTrace();
writer.println("<br><br>");
writer.println("</body>");
writer.println("</html>");
thanks
Maybe you are looking for
-
Quick Time Won't Open in Vista
Quicktime Quicktime Pro won't open in Vista: I can't open Quicktime by starting the application. After starting Quicktime a button appears in the Vista system toolbar, but no window opens. If I mouse over the Quicktime button in the toolbar, a previe
-
G-mail screen too large, no controls like file bookmarks show
Downloaded new Firefox e-mail, now screen is too large to show file, or any tabs on top, can not get to controls to shut down, browser information etc
-
Does anyone know how to configure james mail server to run on windows 2000 ? I followed the steps from documentation without any results !!! Thanks !!!
-
HI.. Im using ip5 with the latest veraion update.. My problem is, i brought the 20gb storage plan which will cost me $0.99 montlhy. Now,i dont want it anymore. I dont want to use it anymore. How do i stop the plan? I did follow the instruction but it
-
Problem loading certain websites
For the past year or so, my iMac has (running Mac OS X 10.5.8) has been giving me trouble when it comes to loading certain websites. The reason why I think it's my computer as opposed to my browser or my internet connection is because these websites