How To Send A Text Attachment Through MAIL Adapter
Hi Experts,
I Did A Scenario that is By using file adapter at the sender side and PI as a middle ware i have sent one text file to database
Now here my question is
I have to send the same text file which i have sent database... my using Mail Adapter
Simply File to Mail Scenario
FILE PI MAIL
But I have to send the same text file which i sent to database... by using mail adapter... Here all the configuration are done ... And the channels are working properly... only thing here is..to send same text file using mail adapter..
It will be good if any one can explain step by step..
Regards
aravindh
Hi Rajendra,
Tanq for connecting me ... This Blog helped me a lot ....And it is a useful answer to me..
For this file to mail scenario we have got .txt as an attachment ... Its fine ... But her my Client is asking me to add CONTENT in the mail... Content in the sense..
Example of content...
Hi,
Please find the attachment
Regards,
sap pi,
They need in the form of like this... To add content in the mail What i have to do...DO i need to add more configurations if it is what are they...
Please solve the issue.. It is appreciated some one can explain me step by step or .. By sending me screen charts..
Thanks in advance....
Regards
vinay
Similar Messages
-
How to send a smartform result through mail?
How to send a smartform result through mail?
HI,
YOu can convert the output of Smartform into a attachment say PDF file & then send it across through mail.
Refer following program:
<a href="http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm">http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm</a>
Best regards,
Prashant -
How to sending simple text in the mail body
Hi friends,
How to send simple text in the mail body through ABAP code
plz send me the related code and setting for that mail.
Thanks&Regards,
Srinivastry this...
FORM send_file_as_email_attachment .
DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
DATA: objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA : i_body TYPE soli_tab WITH HEADER LINE.
DATA: it_attach LIKE it_display1 OCCURS 0 WITH HEADER LINE.
DATA: doc_chng LIKE sodocchgi1.
DATA: tab_lines LIKE sy-tabix.
DATA: att_lines TYPE i.
DATA: lv_lines TYPE i.
DATA: file TYPE string.
data: g_datum like sy-datum.
data: g_datum1(10) type c.
DATA: len TYPE n.
LOOP AT it_email.
CLEAR : objpack,
objhead,
objbin,
objtxt,
reclist.
REFRESH: objpack,
objhead,
objbin,
objtxt,
reclist.
g_datum = sy-datum - 1.
concatenate g_datum6(2) '.' g_datum4(2) '.' g_datum+0(4) into
g_datum1.
doc_chng-obj_descr = 'Aged Stock more than 45 Days'.
CONCATENATE 'Aged Stock more than 45 Days' '-' it_email-vkbur INTO
doc_chng-obj_descr.
CONCATENATE 'Please find enclosed Aged Stock Details ( >45days ) report as on'
g_datum1
INTO objtxt-line SEPARATED BY space.
APPEND objtxt.
objtxt-line = ' '.
APPEND objtxt.
objtxt-line = 'Regards'.
APPEND objtxt.
objtxt-line = 'LIS SAP Projects'.
APPEND objtxt.
objtxt-line =
'PS: Pls send feedback for futher improvements to SAP office.'.
APPEND objtxt.
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
objpack-obj_name = 'Run_prog'.
objpack-obj_descr = 'Agestock.txt'.
lv_lines = tab_lines.
APPEND objpack.
*CONCATENATE 'Plant' 'Material Number' 'Qty(More than 45days)'
*'Amount' INTO
it_display SEPARATED BY space.
append objbin.
clear: objbin.
CLEAR:it_display2.
REFRESH it_display2.
it_display2-werks = 'Plant|'.
it_display2-matnr = 'Material Number'.
it_display2-qty = '|Qty > 45 days'.
it_display2-amount = ' |Amount'.
APPEND it_display2.
it_display2-werks = ''.
it_display2-matnr = ''.
it_display2-qty = ''.
it_display2-amount = ''.
APPEND it_display2.
CLEAR : it_display2.
sort it_display1 by amount descending.
LOOP AT it_display1 WHERE werks = it_email-vkbur.
AT FIRST.
*CONCATENATE 'Plant ' 'Material Number' 'Qty(More than 45days)'
*'Amount' INTO
objbin-line SEPARATED BY space.
append objbin.
clear: objbin.
ENDAT.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = it_display1-matnr
IMPORTING
output = it_display1-matnr.
it_display1-qty = TRUNC( it_display1-qty ).
MOVE-CORRESPONDING it_display1 TO it_display2.
APPEND it_display2.
CLEAR:it_display1,it_display2,objbin.
CLEAR:it_display1.
ENDLOOP.
objbin[] = it_display2[].
DESCRIBE TABLE objbin LINES tab_lines.
objhead = 'Suug'.
APPEND objhead.
objpack-transf_bin = 'X'.
objpack-head_start = 3.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
objpack-obj_name = 'Run_prog'.
objpack-obj_descr = 'Agestock.txt'.
APPEND objpack.
reclist-receiver = '[email protected]'.
reclist-rec_type = 'U'.
APPEND reclist.
=====================================================================
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = doc_chng
commit_work = 'X'
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
CLEAR : it_email.
ENDLOOP.
ENDFORM. "send_mail
Message was edited by:
Sugumar Ganesan -
How to send Dynamic Interactive Forms through mail?
Hi all,
I'm trying to sent Interactive Forms as attachment through mails.
Everything works fine as long as the Content of this Interactive Form stays static.
When I add dynamic elements and test this in SFP, they work.
However when they get sent by mail, the dynamic content is lost and gets back Static.
Does anyone has ABAP code or any other solutions so that the PDF gets send as an Dynamic Form?
Thanks in advance.
Kind Regards,
MaartenHi,
I'm working from the Web UI. This is BSP. Here I add 2 Methods (GET_PDF and SEND_MAIL).
The GET_PDF gets all data for the form and then sends the FORMOUTPUT to the SEND_MAIL method.
Here I add the PDF as following:
First I convert it to BINARY and then I add it as attachment.
Do I need to add it as another TYPE or ....
+ CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = ip_formoutput-PDF "PDF file from function module
APPEND_TO_TABLE = ' '
IMPORTING
OUTPUT_LENGTH =
TABLES
BINARY_TAB = lt_att_content_hex
lo_document->add_attachment(
EXPORTING
i_attachment_type = 'PDF'
i_attachment_subject = 'Your appointment Details'
i_att_content_hex = lt_att_content_hex ).+
Kind Regards,
Maarten -
How to send a text attachment by using jdbc to mail scenario Using single stack 7.31
Hi Experts...
We are currently Single Stack SAP 7.31
I have a Scenario that is "JDBC to MAIL" ...here i need to pick a data from data base and i have to sent that data as a .txt attachment to mail by using mail adapter...
here i have created DT, MT SI, MM,OP > ESR PART
when coming to ID > BC,CC,ICO
Were all the channels are running... MESSAGE ID is generated ... But I was not getting any MAIL to my Email ID...
While i was configuring the RECIEVER mail communication channel i have seen the tab that is "MODULE CONFIGURATION"
DO we have to do any MODULE CONFIGURATION.. If it is needed please let me know how to do....?
It would be appreciated can some one explain me step by step Of this MODULE CONFIGURATION ... Are send me some SCREEN CHARTS OR LINKS to under stand......
Thanks in Advance ...!!!!!!!!!!!!
Thanks,
vinayHi Experts...
We are currently Single Stack SAP 7.31
I have a Scenario that is "JDBC to MAIL" ...here i need to pick a data from data base and i have to sent that data as a .txt attachment to mail by using mail adapter...
here i have created DT, MT SI, MM,OP > ESR PART
when coming to ID > BC,CC,ICO
Were all the channels are running... MESSAGE ID is generated ... But I was not getting any MAIL to my Email ID...
While i was configuring the RECIEVER mail communication channel i have seen the tab that is "MODULE CONFIGURATION"
DO we have to do any MODULE CONFIGURATION.. If it is needed please let me know how to do....?
It would be appreciated can some one explain me step by step Of this MODULE CONFIGURATION ... Are send me some SCREEN CHARTS OR LINKS to under stand......
Thanks in Advance ...!!!!!!!!!!!!
Thanks,
vinay -
Urgent ...how to send output of sap through mail
Could you please guide me how to send output of SAP Script through mail in PDF format.
Thanks in Advance....
Regards,
Kumar.*& Report ZSPOOLTOPDF *
*& Converts spool request into PDF document and emails it to *
*& recipicant. *
*& Execution *
*& This program must be run as a background job in-order for the write *
*& commands to create a Spool request rather than be displayed on *
*& screen *
REPORT zspooltopdf.
PARAMETER: p_email1 LIKE somlreci1-receiver,
p_sender LIKE somlreci1-receiver,
p_delspl AS CHECKBOX.
*DATA DECLARATION
DATA: gd_recsize TYPE i.
Spool IDs
TYPES: BEGIN OF t_tbtcp.
INCLUDE STRUCTURE tbtcp.
TYPES: END OF t_tbtcp.
DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
wa_tbtcp TYPE t_tbtcp.
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.
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.
CONSTANTS: c_dev LIKE sy-sysid VALUE 'DEV',
c_no(1) TYPE c VALUE ' ',
c_device(4) TYPE c VALUE 'LOCL'.
*START-OF-SELECTION.
START-OF-SELECTION.
Write statement to represent report output. Spool request is created
if write statement is executed in background. This could also be an
ALV grid which would be converted to PDF without any extra effort
WRITE 'Hello World'.
new-page.
commit work.
new-page print off.
IF sy-batch EQ 'X'.
PERFORM get_job_details.
PERFORM obtain_spool_id.
Alternative way could be to submit another program and store spool
id into memory, will be stored in sy-spono.
*submit ZSPOOLTOPDF2
to sap-spool
spool parameters %_print
archive parameters %_print
without spool dynpro
and return.
Get spool id from program called above
IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
PERFORM convert_spool_to_pdf.
PERFORM process_email.
if p_delspl EQ 'X'.
PERFORM delete_spool.
endif.
IF sy-sysid = c_dev.
wait up to 5 seconds.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDIF.
ELSE.
SKIP.
WRITE:/ 'Program must be executed in background in-order for spool',
'request to be created.'.
ENDIF.
FORM obtain_spool_id *
FORM obtain_spool_id.
CHECK NOT ( gd_jobname IS INITIAL ).
CHECK NOT ( gd_jobcount IS INITIAL ).
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> '0000000000'
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
message s004(zdd) with gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDFORM.
FORM get_job_details *
FORM get_job_details.
Get current job details
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
ENDFORM.
FORM convert_spool_to_pdf *
FORM convert_spool_to_pdf.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
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.
CHECK sy-subrc = 0.
Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output 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.
ENDFORM.
FORM process_email *
FORM process_email.
DESCRIBE TABLE it_mess_att LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email USING p_email1.
perform send_email using p_email2.
ENDFORM.
FORM send_email *
--> p_email *
FORM send_email USING p_email.
CHECK NOT ( p_email IS INITIAL ).
REFRESH it_mess_bod.
Default subject matter
gd_subject = 'Subject'.
gd_attachment_desc = 'Attachname'.
CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'Message Body text, line 1'.
APPEND it_mess_bod.
it_mess_bod = 'Message Body text, line 2...'.
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
'Example .xls documnet attachment'
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
changing gd_error
gd_reciever.
ENDFORM.
FORM delete_spool *
FORM delete_spool.
DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
ld_spool_nr = gd_spool_nr.
CHECK p_delspl <> c_no.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
spoolid = ld_spool_nr.
ENDFORM.
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
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_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[] = 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 = 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.
regards,
venkat -
How to send existing excel file through mail
Hello Friends,
I have to send mail with Excel File attachement. i have already exist Excel file and that file i hv to send through mail. so pl help me out for sending existing excel file .
i.e. user pickup the exist excel file and that file would be sent to particular mail id.
thank you,
MarmikHi marmik,
1. There is some trick involved
in the binary files.
2. I have made a program (and it works fantastic)
ONLY 6 LINES FOR EMAILING
BELIEVE ME
ITS A FANTASTIC PROGRAM.
IT WILL WORK LIKE OUTLOOK EXPRESS !
3. The user is provided with
a) file name
b) email address to send mail
and it sends ANY FILE (.xls,.pdf .xyz..)
Instantaneously !
4. Make two things first :
1. Include with the name : ZAMI_INCLFOR_MAIL
2. Report with the name : ZAM_TEMP147 (any name will do)
3. Activate both and execute (2)
4. After providing filename, email adress
5. Code for Include :
10.08.2005 Amit M - Created
Include For Mail (First Req F16)
Modification Log
Data
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.
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
CODE FOR PROGRAM
5.
REPORT zam_temp147 .
INCLUDE zami_inclfor_mail.
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
regards,
amit m. -
Sending Text File through Mail Adapter
Hi Group,
I need to send my Target as Mail attachment in the Text File?Can any body SuggestHi swabap,
You need to use PayloadSwapBean module in the Mail receiver adapter. This module will send the payload as an attchment to the mail server.
Check the following link
<a href="/people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure:///people/prasad.ulagappan2/blog/2005/06/07/mail-adapter-scenarios-150-sap-exchange-infrastructure
Regards,
Akshay -
How to send internal table data through mail from report in foreground
hi all,
iam trying to convert the internal table data into excel format and sending it through mail by runnning the report in foreground.
mail is going sucessfully with excel format,but iam facing the problem in the excel format of the material column as follows:
the matrno shows the wrong format -2.63E+11 instead of displaying correct format-263215000000.
Pls suggest the alternative process for the above mentioned problem.
Thanks,
Sivagopal R.Hi Siva,
Try to copy 263215000000 in one of the cells of excel sheet and press enter.It will automatically convert into -2.63E+11 .
This means the default formatting of the excel sheet makes this happen.If you convert the format of the cell to "NUMBER" then u will get the required result.
But I doubt whether or not it is possible through ABAP programming.
Regards,
Vimal. -
Sending File as attachment using Mail adapter with naming convention
Dear All,
I am working on a scenario in which my sender file adapter is sending one file named 'ABC.ok' in one of the folders in application server. I have to send the same file with the same name to one of the folders at FTP and also to my customer at his email id.
I have used File Content onversion at the receiver side and has selected adapter specific attributes due to which the required file is getting generated at FTP folder with the same name as that of the source. But how to send the same file using the mail adapter by keeping same name as "ABC.ok". Kindly guide me out in this.
Regards,
NJwhat you need to do:
1) Select ASMA in Sender and receiver File CC...already done
2) Using the Dynamic Config UDF get the sender file name in the field Content-Type...for this you need to have a return statement in your UDF
3) now before pushing this file name to the Content-Type you have to append (concat)the actual type of the file content (xml, txt)
so your entire Content-Type node will have something like text/plain; name="abc.ok"
SAP Note has reference on how to do this:
https://service.sap.com/sap/support/notes/856599
From the note:
Q: How can I set the file name of a mail attachment?
Regards,
Abhishek. -
Text Attachment in Mail Adapter
Hi, I have Proxy-XI-Mail scenario.
I want to send the mail as TEXT attachment.But the Text is coming as Mail content.
I have having following config
Processing Sequence
localejbs/CreateAttachment Local Enterprise Bean XML2Plain
localejbs/sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean Local Enterprise Bean mail
Module Configuration
XML2Plain Transform.Class com.sap.aii.messaging.adapter.Conversion
XML2Plain Transform.ContentType text/plain;charset=utf-8
XML2Plain xml.Header1000.fieldFixedLengths 100,10,10,30,30,80,80,20,10,10,20,20,30,10,18,240,10,30,18,10
XML2Plain xml.Header2000.fieldFixedLengths 100,30,40,240
XML2Plain xml.addHeaderLine 0
XML2Plain xml.conversionType StructXML2Plain
XML2Plain xml.recordsetStructure Header1000,Header2000
Please suggest some solution.
Thanks.
RushikeshHi,
Refer these blogs
http://www.sapag.co.in/SAP-XI-Mail-Adaptor-FAQ'S.html
The specified item was not found.
The specified item was not found.
eMail Report as Attachment (Excel/Word)
https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1685 [original link is broken] [original link is broken] [original link is broken]
XI Mail Adapter: An approach for sending emails with attachment with help of Java mapping
and also refer these links
http://www.riyaz.net/blog/index.php/2008/02/27/xipi-configuring-the-sender-mail-adapter/
http://help.sap.com/saphelp_nw04/helpdata/en/23/c093409c663228e10000000a1550b0/content.htm
Regards,
Suryanarayana -
How to send ALV report Output through mail in background !
Hi ,
I had an ALV Report. I want to send this report output to patricular email id every day ! Presenty i do this manually. I run the report and send the output to the particular email address. Now i want to schecule the report daily in background and the out put of the report should be mailed to particular email ids in background itself. How can i do this ?
Is there and method or setting through which we can do this ?
RegardsHi Nau,
For this requirement you will have to write another program.
This program will convert the spool requests into PDF document and sends an email to the recipients that you specify.
These are the threads which are already posted in The SDN.
*http://wiki.sdn.sap.com/wiki/display/Snippets/Converts+spool+request+into+PDF+document+and+emails*
*<a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="353650"></a>*
*<a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="902985"></a>*
You need to use the Function module :
-- Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
I will provide you with the code to get this functionality.
*& Form SEND_EMAIL
form SEND_EMAIL .
DATA: t_mailpack TYPE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_mailhead TYPE solisti1 OCCURS 0 WITH HEADER LINE,
t_mailbin TYPE solisti1 OCCURS 0 WITH HEADER LINE,
t_mailtxt TYPE solisti1 OCCURS 0 WITH HEADER LINE,
t_mailrec TYPE somlreci1 OCCURS 0 WITH HEADER LINE.
DATA: wa_maildata TYPE sodocchgi1,
l_filename(50) TYPE c,
l_fldname(30) TYPE c,
l_fldval(100) TYPE c,
l_lines TYPE i,
l_text TYPE text128 .
DATA: w_email_subrc TYPE i.
DATA: w_ship like vbfa-vbeln.
CLEAR: wa_maildata,
t_mailtxt,
t_mailbin,
t_mailpack,
t_mailhead,
t_mailrec.
REFRESH: t_mailtxt,
t_mailbin,
t_mailpack,
t_mailhead,
t_mailrec.
*-- Fill output file
*- Fill header
CLEAR: t_mailbin.
* t_mailbin[] = pdf_tab[].
t_mailbin[] = it_att[]. "Uthaman
*This line is added to get the shipment no in Subject Line
SELECT SINGLE * FROM vbfa WHERE vbelv EQ nast-objky
AND vbtyp_v EQ c_vbtyp_v_j
AND vbtyp_n EQ c_vbtyp_n_8.
w_ship = vbfa-vbeln.
shift w_ship left deleting leading '0'.
*-- File name
if nast-kschl EQ 'ZFPL'.
CLEAR l_filename.
CONCATENATE 'Packing List -'
sy-datum+4(2) sy-datum+6(2) sy-datum(4) '.PDF' INTO l_filename.
*-- Creation of the document to be sent File Name
wa_maildata-obj_name = 'Packing List'.
*-- Mail Subject
CONCATENATE l_filename '-' 'Shipment No -' w_ship INTO wa_maildata-obj_descr SEPARATED BY space.
*-- Mail Contents
t_mailtxt-line = 'Packing List'.
APPEND t_mailtxt.
ENDIF.
if nast-kschl EQ 'ZFBA'.
CLEAR l_filename.
CONCATENATE 'Booking Advice -'
sy-datum+4(2) sy-datum+6(2) sy-datum(4) '.PDF'
INTO l_filename.
*-- Creation of the document to be sent File Name
wa_maildata-obj_name = 'Booking Advice'.
*-- Mail Subject
CONCATENATE l_filename '-' 'Shipment No -' w_ship INTO wa_maildata-obj_descr SEPARATED BY space.
*-- Mail Contents
t_mailtxt-line = 'Packing List'.
APPEND t_mailtxt.
ENDIF.
*-- Prepare Packing List
*-- Write Packing List (Main Subject)
CLEAR: l_lines, t_mailpack.
DESCRIBE TABLE t_mailtxt LINES l_lines.
* READ TABLE t_mailtxt INDEX l_lines.
t_mailpack-doc_size = ( l_lines - 1 ) * 255 + STRLEN( t_mailtxt ).
* CLEAR t_mailpack-transf_bin.
t_mailpack-transf_bin = ' '.
t_mailpack-head_start = 1.
t_mailpack-head_num = 0.
t_mailpack-body_start = 1.
t_mailpack-body_num = l_lines.
t_mailpack-doc_type = 'RAW'.
APPEND t_mailpack.
t_mailhead = l_filename.
APPEND t_mailhead.
*-- Write Packing List (Attachment)
CLEAR: l_lines, t_mailpack.
DESCRIBE TABLE pdf_tab[] LINES l_lines.
* READ TABLE pdf_tab INDEX l_lines.
t_mailpack-doc_size = ( l_lines - 1 ) * 255 + STRLEN( t_mailbin ).
t_mailpack-transf_bin = 'X'.
t_mailpack-head_start = 1.
t_mailpack-head_num = 1.
t_mailpack-body_start = 1.
t_mailpack-body_num = l_lines.
t_mailpack-doc_type = 'PDF'.
t_mailpack-obj_name = l_filename.
t_mailpack-obj_descr = l_filename.
t_mailpack-obj_langu = 'E'.
APPEND t_mailpack.
*-- Set recipients
tables : ztotcemail.
SELECT SINGLE * FROM vbfa WHERE vbelv EQ nast-objky
AND vbtyp_v EQ c_vbtyp_v_j
AND vbtyp_n EQ c_vbtyp_n_8.
CLEAR vttk.
SELECT SINGLE * FROM vttk WHERE tknum EQ vbfa-vbeln.
SELECT SINGLE * FROM ztotcemail WHERE tplst = vttk-tplst
AND lifnr = vttk-tdlnr.
IF SY-SUBRC EQ 0.
t_mailrec-receiver = ztotcemail-smtp_addr. "'Here you will give the email address'.
t_mailrec-rec_type = 'U'.
APPEND t_mailrec.
ENDIF.
**-- Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_maildata
put_in_outbox = 'X'
* commit_work = 'X' " N-16
TABLES
packing_list = t_mailpack
object_header = t_mailhead
contents_bin = t_mailbin[]
contents_txt = t_mailtxt[]
receivers = t_mailrec
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
OTHERS = 99.
w_email_subrc = sy-subrc.
IF sy-subrc EQ 0.
MESSAGE s000(zotc) WITH 'Email output sent successfully'.
ELSE.
MESSAGE s000(zotc) WITH 'Can not send email output'.
ENDIF.
endform. " SEND_EMAIL
Hope the above information will be helpful.
Regards,
Kittu -
Hi All,
In my BSp application user can enter long text ( can be more than 300 char ) in TextEdit.
problem is as below:
1) i am getting all the text in oninput processing ...
2) using the FM READ_TEXT to get mail template built in SO10.
3) Replacing all dynamic variables in mail template with user enterd text.
4) then passing the data to FM SO_NEW_DOCUMENT_SEND_API1. this FM has table parameter with 255 char ( please check once )
i am able to send the data in mail. But long text more than 256 char is not comming as single paragraph.
For expamle ...user enter the following text in text edit.
Responsible for the development, implementation, and maintenance of human resource information systems (HRIS) associated with the collection, retrieval, accessibility, and usage of employee information for Human Resource department planning and activities. Maintains internal database files and tables, and develops custom reports to meet the requirements of Human Resource management and staff.
in inbox i am getting as below:
Job Description for : Responsible for the development, implementation, and maintenance of human resource information systems (HRIS) associated with the collection, retrieval, accessibility, and usage of employee information for Human Resource depa
Maintains internal database files and tables, and develops custom reports to meet the requirements of Human Resource management and staff.
Job Description for is fixed text from SO10 templete. and remainning text is user text.
some data is missing in mail.
SO10 template is as below :
Job Description for : &INSTRUC1&
&INSTRUC2&
help to solve the above issue.
Regads,
Kishan
Edited by: kishanrao.sap on Oct 11, 2010 3:12 PMHi Krishna,
Please use the object_type parameter of tthe FM as 'HTM'.
Then divide the text by append them into the lines of the object_content. In the begining and end make sure you have
<p> -- in the begining
</p>-- in the end
if i want to type the text in one para " My name is Imran and i am an ABAP developer".
CLEAR: WA_OBJECT_CONTENT.
WA_OBJECT_CONTENT-line = '<html>'<body><p> My name is Imran.
APPEND WA_OBJECT_CONTENT TO T_OBJECT_CONTENT.
CLEAR WA_OBJECT_CONTENT.
WA_OBJECT_CONTENT-line = ' and i am an ABAP developer</p></body><html;>'.
APPEND WA_OBJECT_CONTENT TO T_OBJECT_CONTENT.
Hope this helps you.
Regards
Imran. -
Report output sending as an attachement through mail
we are facing one problem while sending report output as an attachement to specific mail-ids.
Every thing is working fine.But for each row upto 255 characteers only it is printig.
Remaining is not comming.
We are using Function Module SO_DOCUMENT_SEND_API1.
Please help us to solve this.
Regards,
Phanicheck this code sample
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/5931ff64-0a01-0010-2bb7-ff2f9a6165a0">E-mail ABAP Report List output in HTML format</a>
Regards
Raja -
How to send the form data through mail with pdf format?
forms 6i
Hi to all,
i am developed one master detail form.example is based on the dept number emp details will be displayed.here my requirment is whatever displayed on the form
the data ,these data send to mail with any format.is it possible? if is possible any one give a proper solution.
Regards,
Stevie
Edited by: 994418 on 6 May, 2013 11:15 PMHello,
you can create a Report that accepts the search parameters from the Forms mask and generates a PDF. You also have the option to send the report via mail.
Personally I would generate the report with a tool like as_pdf
http://technology.amis.nl/2012/04/11/generating-a-pdf-document-with-some-plsql-as_pdf_mini-as_pdf3/
Then you can send the mail using utl_mail or utl_smtp.
www.google.com/search?q=site:forums.oracle.com+utl_mail+utl_smtp
Regards
Marcus
Maybe you are looking for
-
How to upload XML file from Application server.
Hi, How to upload XML file from Application server.Please tell me as early as possible. Regards, Sagar.
-
Messages from Adapter framework to IS disappear
During processing of interfaces, it happens some times that the sending of messages from Adapter Framework to Integration Server is broken but no status message is traced. Before this break, the messages state is correctly visible on integration ser
-
Flex char 100% with negative values.
Hello. I have in my app a chart (cartessianchart) with a columnset of 100% columseries. All is fine until negative values appear in the series. For those negative values, the representation dissapears. I have ported my app to use "stacked" series ins
-
Do all MacBook Pro computers (without retina display) come with a CD/DVD drive?
-
Photoshop only crashes when bridge is open (cs4 mac)
Hi folks, is anybody experiencing crashes when bridge is open. I close it now, and it almost never crashes. A bit frustrating as I like to leave bridge open. I am using 8 core 3.0, 16gb RAM, 10.5.6, CS4 thanks,