Problen when Sending the text file as attachment to the external mail
HI,
I am sending the text file as an attachment to a aexternal mai. mailing is going with text file attachment, but text file is empty. No information in the file is going, only empty text file is going. I am sending the code iam using. Please suggest, if I need to change any passing parameters orany other other solution.
tables: knb1,kna1,adr6,ITEMSET,bsid,TSP01.
INTERNAL TABLES
DATA: BEGIN OF it_kna1 occurs 0,
KUNNR LIKE KNA1-KUNNR,
ADRNR LIKE KNA1-ADRNR,
END OF it_kna1.
DATA: BEGIN OF it_email occurs 0,
ADDRNUMBER LIKE ADR6-ADDRNUMBER,
SMTP_ADDR LIKE ADR6-SMTP_ADDR,
END OF it_email.
DATA: BEGIN OF it_bsid occurs 0,
KUNNR LIKE BSID-KUNNR,
BUKRS LIKE BSID-BUKRS,
END OF it_bsid.
DATA: BEGIN OF it_final occurs 0,
KUNNR LIKE KNA1-KUNNR,
ADRNR LIKE ADR6-ADDRNUMBER,
EMAIL LIKE ADR6-SMTP_ADDR,
END OF it_final.
DATA: BEGIN OF BUFFER OCCURS 10000,
TEXT(255) TYPE C,
END OF BUFFER.
data:xtext type solix_tab." occurs 0 with header line."line.
data:xi_pdf type soli_tab.
DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE,
OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE,
OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE,
RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE,
DOC_CHNG LIKE SODOCCHGI1,
PARAMS LIKE PRI_PARAMS,
ARPARAMS LIKE ARC_PARAMS,
DAYS(1) TYPE N VALUE 8,
COUNT(3) TYPE N VALUE 1,
VALID TYPE C,
RECEIVER(30),
STR(256).
data: spoolid type tsp01-rqident,
pdf_table like tline occurs 0 with header line,
v_bytecount type i,
itab_pdf like tline occurs 10 with header line,
xi_pdf like tline occurs 0 with header line,
xi_pdf like buffer occurs 0 with header line,
xi_pdf_1 like xi_pdf,
v_length(2) type p,
html like solisti1 occurs 0 with header line,
xi_temp like bapiqcmime occurs 0 with header line,
xi_mime(255) type c occurs 0 with header line.
VARIABLES
data: g_email type adr6-smtp_addr,
TAB_LINES LIKE SY-TABIX,
G_FLAG(1) TYPE C.
g_norm(1) TYPE C,
g_shbv(1) TYPE C,
g_merk(1) TYPE C,
g_park(1) TYPE C,
g_apar(1) TYPE C.
data: l_lines type i,
line1 type i,
l_temp(500) type c,
l_offset type p,
l_lineslen(2) type p,
l_mimelen(2) type p,
v_spono like tsp01-rqident,
l_tabix like sy-tabix.
*****VIA SELECTION-SCREEN
ENDFORM. " SEND_TO_SPOOL
*& Form GET_SPOOL_ID
*& Form CONVERT_SPOOL_TO_PDF
*& Form SEND_MAIL
FORM SEND_MAIL .
data:l_lin like sy-tabix,
l_lint like sy-tabix,
it_list like abaplist occurs 0,
l_newline(2) type x value '0D0A'.
*--Data for the status output after sending
data: user_address like sousradri1 occurs 1 with header line,
sent_to_all like sonv-flag.
clear: reclist, reclist[],
objtxt , objtxt[],
objpack, objpack[],
objbin , objbin[],
doc_chng.
*--move list to office table objbin
*--Start of Changes to support PDF attachments - UB20030116
loop at html.
objbin-line = html-line.
append objbin.
clear objbin.
endloop.
loop at xi_pdf.
objbin-line = xi_pdf-text.
append objbin.
clear objbin.
endloop.
*--We may write additional text to the main document
*--For faxing this will be the cover page. Like sending from SAPoffice
*--the layout set Office-Telefax will be used.
objtxt-line = 'NOTE : Please Consider the below Headers'.
append objtxt.
clear objtxt.
objtxt-line = 'Assignment --> Purchase order number '.
append objtxt.
clear objtxt.
objtxt-line = 'Document --> Invoice No '.
append objtxt.
clear objtxt.
objtxt-line = 'Amount In DC --> Amount Due '.
append objtxt.
clear objtxt.
objtxt-line = ' '.
append objtxt.
clear objtxt.
objtxt-line = ' '.
append objtxt.
clear objtxt.
objtxt-line = 'Please find attached statement for this week'.
append objtxt.
clear objtxt.
objtxt-line = ' '.
append objtxt.
clear objtxt.
objtxt-line = 'This is an AUTO GENERATED MAIL'.
concatenate objtxt-line 'Please Do not reply to this mail' into
objtxt-line separated by ' '.
append objtxt.
clear objtxt.
describe table objtxt lines tab_lines.
read table objtxt index tab_lines.
*--Create the document which is to be sent
doc_chng-obj_name = 'List'.
doc_chng-obj_name = 'SAPRPT'.
doc_chng-obj_descr = 'Customer statement for the week'.
concatenate 'Customer statement for '
sy-datum into
doc_chng-obj_descr
separated by ' '.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + strlen( objtxt ).
*--Fill the fields of the packing_list for the main document:
*--It is a text document
clear objpack-transf_bin.
*--The document needs no header (head_num = 0)
objpack-head_start = 1.
objpack-head_num = 0.
*--but it has a body
objpack-body_start = 1.
objpack-body_num = tab_lines.
*--of type RAW
objpack-doc_type = 'RAW'.
append objpack.
*--Create the attachment (the list itself)
describe table objbin lines tab_lines.
*--Fill the fields of the packing_list for the attachment:
*--It is binary document
objpack-transf_bin = 'X'.
*--we need no header
objpack-head_start = 1.
objpack-head_num = 0.
*--but a body
objpack-body_start = 1.
objpack-body_num = tab_lines.
*--of type G_DOC_TYPE
objpack-doc_type = 'PDF'. "commented on 12/13/2007
objpack-doc_type = 'TXT'. "commented on 12/13/2007
objpack-obj_name = 'Attachment'.
objpack-obj_descr = 'Customer Statement'.
concatenate 'Customer Statement' sy-datum into objpack-obj_descr.
objpack-doc_size = tab_lines * 255.
append objpack.
reclist-receiver = g_email.
reclist-rec_type = 'U'.
reclist-com_type = 'FAX'.
append reclist.
data:xi type soli.
xi-line = 'haisdgsfsdf'.
append xi to xi_pdf.
xi-line = 'haisdfdsfd'.
append xi to xi_pdf.
xi-line = 'haisfgsdfsd'.
append xi to xi_pdf.
xi-line = 'haisdfsgfsdgg'.
append xi to xi_pdf.
*xi_pdf-text = 'hai'.
*append xi_pdf.
*xi_pdf-text = 'hai'.
*append xi_pdf.
*xi_pdf-text = 'hai'.
*append xi_pdf.
*xi_pdf-text = 'hai'.
*append xi_pdf.
CALL FUNCTION 'SO_SOLITAB_TO_SOLIXTAB'
EXPORTING
ip_solitab = xi_pdf[]
IMPORTING
EP_SOLIXTAB = xtext[].
**--Send the document by calling the SAPoffice API1 module for sending
**--documents with attachments
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
IMPORTING
sent_to_all = sent_to_all
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
contents_hex = xtext
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
others = 99.
HI,
There are lots of bugs.
Please refer this sample program to fix it.
http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
Best regards,
Prashant
Similar Messages
-
Strange character appear when writing to text file.
Hello, I am facing some problem when I read some data from and binary file (.dat) and then saving them into text file.
When I convert those data into string and then write to a text file. Some strange characters were found in the file when I opened it with excel. Could anybody tell me how these strange characters( ) are generated and how to eliminate them?
The VI , .dat file and the text file are attached as below.(use the "open file" in the menu to open .dat file and then use the "export file" in menu to export to text file)
Thank you very much......
The .dat and text file are attached in the next post.
Attachments:
test2.xls 1 KB
VPSDataViewer_vac_temp2.vi 111 KB
Sel_File.vi 20 KBraw data file.
Thank you very much.
the vpsxxxx.ini is the raw data(file with .dat extension cannot be attached).
viewer.vi is the menu file. (please change the file name to viewer.rtm, also for attaching file purpose. ^_^)
Attachments:
VPS20070107_152605.ini 2 KB
Viewer.vi 1 KB -
Formatting lost in the text file, got after zipping.
Hello ABAP gurus,
A text file has to be zipped .I have used the class method CL_ABAP_ZIP-SAVE() to create a zip file in the application server. The zip file is double clicked and the text file is opened.
The formatting is lost in the text file, got after zipping.
Please let me know how I maintain the formatting in the zip file.
Thanks.
Edited by: GVVisweswara . on May 5, 2011 5:17 PMHi.,
Check this link: [Zip text file using Cl Zip|http://www.saptutor.org/?p=59]
also this wiki., http://wiki.sdn.sap.com/wiki/display/ABAP/CL_ABAP_ZIPusage-ZippingABAPreportoutput
hope this helps u.,
Thanks & Regards
Kiran -
How do i split content from the text file using tab and spaces...?
Hi.. Just want to ask help to all the experts. Im new in java and i have this problem on how to split the contents of the text file. ill show you the contents in order to let you see what i mean.
FileName: COL.txt
AcctNo AcctName Primary Secondary Status Opendate
121244 IPI Company Noel Jose Active 12/05/2007
As you can see the content i want to split it per column.. Please help meJose_Noel wrote:
Hi prometheuzz,
What do you mean by one thread...?You created two threads* with the same question in it. That way, people might end up giving you an answer that has already been posted in your other thread: thus wasting that person's time.
Just don't create multiple threads with the same question please.
* a thread is a post here at the forum -
Placing the text file in application server
Hi all,
I am uploading the text file into application server.
the line length is 1028 characters.But in application server i am not able to see whole line.it is showing only some data and reamaining data is not coming.
Please let em know how can we increase the line length in application server.
Regards,
ShobanSE38 is the ABAP Editor transaction.
Use function module GUI_UPLOAD to create an upload the data.
*Use function module GUI_UPLOAD to create an upload the data.
Example Code >>>
REPORT zuploadtab .
PARAMETERS: p_infile LIKE rlgrap-filename
OBLIGATORY DEFAULT '/usr/sap/'..
*DATA: ld_file LIKE rlgrap-filename.
DATA: gd_file type string.
*Internal tabe to store upload data
TYPES: BEGIN OF t_record,
name1 LIKE pa0002-vorna,
name2 LIKE pa0002-name2,
age TYPE i,
END OF t_record.
DATA: it_record TYPE STANDARD TABLE OF t_record INITIAL SIZE 0,
wa_record TYPE t_record.
*Internal table to upload data into
DATA: BEGIN OF it_datatab OCCURS 0,
row(500) TYPE c,
END OF it_datatab.
*Text version of data table
TYPES: BEGIN OF t_uploadtxt,
name1(10) TYPE c,
name2(15) TYPE c,
age(5) TYPE c,
END OF t_uploadtxt.
DATA: wa_uploadtxt TYPE t_uploadtxt.
*String value to data in initially.
DATA: wa_string(255) TYPE c.
CONSTANTS: con_tab TYPE x VALUE '09'.
*If you have Unicode check active in program attributes then 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.
*AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_INFILE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_infile.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = p_infile
mask = ',*.txt.'
mode = 'O'
title = 'Upload File'(078)
IMPORTING
filename = p_infile
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
*START-OF-SELECTION
START-OF-SELECTION.
gd_file = p_infile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gd_file
has_field_separator = 'X' "file is TAB delimited
TABLES
data_tab = it_record
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.
IF sy-subrc NE 0.
write: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.
skip.
endif.
Alternative method, where by you split fields at each TAB after you
have returned the data. No point unless you dont have access to
GUI_UPLOAD but just included for information
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gd_file
filetype = 'ASC'
TABLES
data_tab = it_datatab "ITBL_IN_RECORD[]
EXCEPTIONS
file_open_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
ELSE.
LOOP AT it_datatab.
CLEAR: wa_string, wa_uploadtxt.
wa_string = it_datatab.
SPLIT wa_string AT con_tab INTO wa_uploadtxt-name1
wa_uploadtxt-name2
wa_uploadtxt-age.
MOVE-CORRESPONDING wa_uploadtxt TO wa_record.
APPEND wa_record TO it_record.
ENDLOOP.
ENDIF.
*END-OF-SELECTION
END-OF-SELECTION.
*!! Text data is now contained within the internal table IT_RECORD
Display report data for illustration purposes
LOOP AT it_record INTO wa_record.
WRITE:/ sy-vline,
(10) wa_record-name1, sy-vline,
(10) wa_record-name2, sy-vline,
(10) wa_record-age, sy-vline.
ENDLOOP.
Edited by: Nikhil Jathar on Jan 9, 2008 7:38 AM -
Search for a word and return all the lines (row) from the text file..
Hi all,
I need a help on how to search a string from the text file and returns all the lines (rows) where the searched string are found. I have included the code, it finds the indexof the string but it does not return the entire line. I would appreciate your any help.
public class SearchWord
public static void main(String[] args){
//Search String
String searchText = "man";
//File to search (in same directory as .class file)
String fileName = "C:\\Workspace\\MyFile.txt";
//StringBuilder allows to create a string by concatinating
//multiple strings efficiently.
StringBuilder sb =
new StringBuilder();
try {
//Create the buffered input stream, which reads
//from a file input stream
BufferedInputStream bIn =
new BufferedInputStream(
new FileInputStream(fileName));
//Holds the position of the last byte we have read
int pos = 0;
//Holds #of available bytes in our stream
//(which is the file)
int avl = bIn.available();
//Read as long as we have something
while ( avl != 0 ) {
//Holds the bytes which we read
byte[] buffer = new byte[avl];
//Read from the file to the buffer
// starting from <pos>, <avl> bytes.
bIn.read(buffer, pos, avl);
//Update the last read byte position
pos += avl;
//Create a new string from byte[] we read
String strTemp =
new String(buffer);
//Append the string to the string builder
sb.append(strTemp);
//Get the next available set of bytes
avl = bIn.available();
catch(IOException ex) {
ex.printStackTrace();
//Get the concatinated string from string builder
String fileText = sb.toString();
int indexVal = fileText.indexOf(searchText);
//Displays the index location in the file for a given text.
// -1 if not found
if (indexVal == -1)
System.out.println("No values found");
else
System.out.println("Search for: " + searchText); }
}Hi, you can use servlet class and use this method to get the whole line of searched string. You can override the HttpServlet to treat that class as servlet.
public class ReportAction extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//write your whole logic.
BufferedReader br = new BufferedReader(new FileReader("your file name"));
String line = "";
while(line = br.readLine() != null) {
if(line.contains("your search string")) {
System.out.println("The whole line, row is :"+line);
} -
Skip a column when importing a text file into Excel 2010
Hi,
I have a formatted Excel 2010 spreadsheet that I want to import data from a .txt file located on my local drive. The third column of the spreadsheet is a concantenate formula that converts the second column from a Hex formatted value to a Dec formatted value.
I want the first two columns of the text file to import into the first two columns of the spreadsheet and skip the third column then import the remaining columns from the text file to the spreadsheet. Is there an easy way to do this or do I need a VBA code
and if so can you provide that to me?
Thank you,
JenniferHi Tony,
I am sorry if I didn't express my issue more clearly. Where I need to skip a column is in the Excel spreadsheet. I want to import all the columns from the text file. I want the first two columns from the text to import to the first two columns in the Excel
sheet A and B, skip the third column C in the spreadsheet, where I have a formula to convert the second column B values from a Hex format (imported data) to a Dec format, then continue to import columns 3, 4, and 5 from the text to spreadsheet columns D, E,
and F. I would think the function would be in the Excel spreadsheet maybe some type of protection setting or something similar, if it can even be done.
Thank you for taking the time to help me out with this.
Jennifer -
I am trying to make a signature in MS Word (2007) which includes a jpg image, but when I save it as a HTML file and attach it the text appers OK but the image doesn't. I have tried various formats but still no luck. Can anyone help? edit
C'mon! Anyone???? I'm desperate!
-
Error while sending a text file to client as attachment
I want to download a file on clicking a button. Here is my button code
<input type="button" onClick="showdownloadwindow()" value="Download My file">
The java script showdownloadwindow() should invoke a jsp that has code to construct the text file to be downloaded
Here is the javascript function
<script>
function showdownloadwindow()
var url = 'http://<%=request.getServerName()%>'+':'+<%=request.getServerPort()%>+'/downloadtextfile.jsp';
window.open(url,"","");
</script>
the downloadtextfile.jsp looks something like this
<%
response.setContentType("text/plain");
response.setHeader("Content-disposition","attachment; filename=myfile.txt" );
BufferedOutputStream bos = new BufferedOutputStream(response.getOutputStream());
String temp="Put some text string for now";
bos.write(temp.getBytes());
bos.flush();
bos.close();
response.flushBuffer();
%>
i have two problems
1. when the button "Download My file" is clicked a separate window is opened and then the save file dialog box appears. How can I change my code
so that it only shows download window only ( not another browser window)
2. myfile.txt contains some error in addition to the temp string
Here is the error from myfile.txt
<BR><H3>Original Exception: </H3>
<B>Error Message: </B>SRVE0199E: OutputStream already obtained<BR>
<B>Error Code: </B>500<BR>
<B>Target Servlet: </B>/downloadtextfile.jsp<BR>
<B>Error Stack: </B><BR>
java.lang.IllegalStateException: SRVE0199E: OutputStream already obtained
<BR>
at com.ibm.ws.webcontainer.srt.SRTServletResponse.getWriter(SRTServletResponse.java:467)
<BR>
at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:170)
<BR>
at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:163)
<BR>
at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:217)
<BR>
at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:149)
<BR>
at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:117)
<BR>
at com.ibm._jsp._downloadtextfile._jspService(_downloadtextfile.java:93)
<BR>
at com.ibm.ws.jsp.runtime.HttpJspBase.service(HttpJspBase.java:88)
<BR>> Channel FILE_TLE_Sender_SalesOrder_CC: Empty document found - proceed without sending message.
> Can someone tell me why this error is happening?
Maybe your source file is empty?
This is exact what the error message says. -
How to send a text file attachment through mail in ECC 6.0
Hi Friends,
As per the requirement, I need to send a ALV report result as text file attachment to user in ECC 6.0 . I know how to do in 4.6C version. But the same code is not working here in ECC 6.0.
Generally to get the data in new row in the text file we use below code in 4.6c.
data: c_value type x value ' 0D '.
concatenate c_value itab-line into itab-line.
By using above code, we get each row of the itab in a new line in text file.
Same code is not working in ECC6.0 as it is not supporting to concatenate bytes with characters. Getting the error like " field c_value should be diclared as type C or I or N or T or P"
Even I have used function module NLS_STRING_CONVERT_TO_SYS to convert hexa to char. It is converting the value' 0D' to ' # '. But it is not working.
Could you please suggest me that how can get each row of itab as a new line in text file in ECC 6.0.
Itab value:
abcdefdfldjfñlkdsjfñldsjfdsñljñla
fdsljfñldskjfldsñkjfñldsjfñldsajñld
vcxusfcxusfcusafcxusafcusafcdsauc
Actual result currently coming in text file:
abcdefdfldjfñlkdsjfñldsjfdsñljñlafdsljfñldskjfldsñkjfñldsjfñldsajñldvcxusfcxusfcusafcxusafcusafcdsauc
Expected result in text file:
abcdefdfldjfñlkdsjfñldsjfdsñljñla
fdsljfñldskjfldsñkjfñldsjfñldsajñld
vcxusfcxusfcusafcxusafcusafcdsauc
Please do the needful.
Thanks
Kumarhi,
Try this function Module
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1 '
*example code
******* Create Message Body Title and Description****************
i_objtxt = 'test with pdf-Attachment!'.
append i_objtxt.
describe table i_objtxt lines v_lines_txt.
read table i_objtxt index v_lines_txt.
wa_doc_chng-obj_name = 'smartform'.
wa_doc_chng-expiry_dat = sy-datum + 10.
wa_doc_chng-obj_descr = 'smartform'.
wa_doc_chng-sensitivty = 'F'.
wa_doc_chng-doc_size = v_lines_txt * 255.
**** Main Text*****************************
clear i_objpack-transf_bin.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_txt.
i_objpack-doc_type = 'RAW'.
append i_objpack.
**** Attachment (pdf-Attachment)*************
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 1.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'smartform'.
concatenate i_objpack-obj_name i_objpack-doc_type into
i_objpack-obj_descr separated by '.'.
* I_OBJPACK-OBJ_DESCR = 'test'.
i_objpack-doc_size = v_lines_bin * 255 .
append i_objpack.
* Länge des Attachment ermitteln
clear i_reclist.
i_reclist-receiver = 'email address'.
i_reclist-rec_type = 'U'.
i_reclist-express = 'X'.
data: tab_lines like sy-tabix.
describe table i_objbin lines tab_lines.
append i_reclist.
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = wa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
tables
packing_list = i_objpack
object_header = wa_objhead
contents_bin = i_objbin
contents_txt = i_objtxt
receivers = i_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.
write:/ 'Error When Sending the File', sy-subrc.
else.
write:/ 'Mail sent'.
endif. -
Mail the local files as attachment and some body text
hello Exprests
I have a requirement where i have to mail the local files as attachment and some body text also...
I am using the following code, and the problem is that i am getting a blank TXT as an attachment.
Please help me solve this issue, if u change the spool request no., client & put ur mail id and execute it u will find that apart from the pdf we get an un wanted attachment also..
Please suggest me the solution..
WORK TABLE AREAS
TABLES: tsp01.
INTERNAL TABLES
DATA: lt_rec_tab LIKE STANDARD TABLE OF soos1 WITH HEADER LINE,
lt_note_text LIKE STANDARD TABLE OF soli WITH HEADER LINE,
lt_attachments LIKE STANDARD TABLE OF sood5 WITH HEADER LINE.
DATA: lt_objcont LIKE STANDARD TABLE OF soli WITH HEADER LINE,
lt_objhead LIKE STANDARD TABLE OF soli WITH HEADER LINE.
DATA: pdf_format LIKE STANDARD TABLE OF tline WITH HEADER LINE.
TYPES: BEGIN OF y_files,
file(60) TYPE c,
END OF y_files.
DATA: lt_files TYPE STANDARD TABLE OF y_files WITH HEADER LINE.
DATA: l_objcont LIKE soli OCCURS 0 WITH HEADER LINE.
DATA: l_objhead LIKE soli OCCURS 0 WITH HEADER LINE.
STRUCTURES
DATA: folder_id LIKE soodk,
object_id LIKE soodk,
link_folder_id LIKE soodk,
g_document LIKE sood4,
g_header_data LIKE sood2,
g_folmem_data LIKE sofm2,
g_header_data LIKE sood2,
g_receive_data LIKE soos6,
g_ref_document LIKE sood4,
g_new_parent LIKE soodk,
l_folder_id LIKE sofdk,
v_email(50).
DATA: hd_dat LIKE sood1.
VARIABLES
DATA: client LIKE tst01-dclient,
name LIKE tst01-dname,
objtype LIKE rststype-type,
type LIKE rststype-type.
DATA: numbytes TYPE i,
arc_idx LIKE toa_dara,
pdfspoolid LIKE tsp01-rqident,
jobname LIKE tbtcjob-jobname,
jobcount LIKE tbtcjob-jobcount,
is_otf.
DATA: outbox_flag LIKE sonv-flag VALUE 'X',
store_flag LIKE sonv-flag,
delete_flag LIKE sonv-flag,
owner LIKE soud-usrnam,
on LIKE sonv-flag VALUE 'X',
sent_to_all LIKE sonv-flag,
g_authority LIKE sofa-usracc,
w_objdes LIKE sood4-objdes.
DATA: c_file LIKE rlgrap-filename,
n_spool(6) TYPE n.
DATA: cancel.
DATA: desired_type LIKE sood-objtp,
real_type LIKE sood-objtp,
attach_type LIKE sood-objtp,
otf LIKE sood-objtp VALUE 'OTF', " SAPscript Ausgabeformat
ali LIKE sood-objtp VALUE 'ALI'. " ABAP lists
CONSTANTS
CONSTANTS: ou_fol LIKE sofh-folrg VALUE 'O',
c_objtp LIKE g_document-objtp VALUE 'RAW',
c_file_ext LIKE g_document-file_ext VALUE 'TXT'.
*=======================================================================
*=
*=========
*z_send_email_fax2
*function z_faian_mail_fax2.
""Interface local:
*" IMPORTING
*" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
*" REFERENCE(FAX_MAIL_NUMBER) TYPE SO_NAME
*" REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
*" REFERENCE(OBJECT_TYPE) TYPE SO_ESCAPE
*" TABLES
*" LT_BODY_EMAIL STRUCTURE SOLI
*" EXCEPTIONS
*" ERR_NO_ABAP_SPOOLJOB
Fist part: Verify if the spool really exists
*select single * from tsp01 where rqident = src_spoolid.
DATA src_spoolid TYPE tsp01-rqident VALUE '23242'.
DATA header_mail TYPE so_obj_des.
DATA lt_body_email TYPE STANDARD TABLE OF soli WITH HEADER LINE.
DATA l_t VALUE '1'.
header_mail = 'Subject line of mail'.
IF l_t = '1' .
RAISE err_no_abap_spooljob. "doesn't exist
*ELSE.
client = '200'."tsp01-rqclient.
name = 'SPOOL0000023242'."tsp01-rqo1name.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = client
name = name
part = 1
IMPORTING
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4
OTHERS = 5.
IF objtype(3) = 'OTF'.
desired_type = otf.
ELSE.
desired_type = ali.
ENDIF.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = src_spoolid
desired_type = desired_type
IMPORTING
real_type = real_type
TABLES
buffer = l_objcont
EXCEPTIONS
no_such_job = 14
type_no_match = 94
job_contains_no_data = 54
no_permission = 21
can_not_access = 21
read_error = 54.
IF sy-subrc EQ 0.
attach_type = real_type.
ENDIF.
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
owner = sy-uname
region = ou_fol
IMPORTING
folder_id = l_folder_id
EXCEPTIONS
OTHERS = 5.
fill out informations about the header of the email
CLEAR: g_document.
g_document-foltp = l_folder_id-foltp.
g_document-folyr = l_folder_id-folyr.
g_document-folno = l_folder_id-folno.
g_document-objtp = c_objtp.
g_document-objdes = header_mail.
g_document-file_ext = c_file_ext.
g_header_data-objdes = header_mail.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
method = 'SAVE'
office_user = sy-uname
IMPORTING
authority = g_authority
TABLES
objcont = lt_body_email
attachments = lt_attachments
CHANGING
document = g_document
header_data = g_header_data
EXCEPTIONS
OTHERS = 1.
folder_id-objtp = l_folder_id-foltp.
folder_id-objyr = l_folder_id-folyr.
folder_id-objno = l_folder_id-folno.
object_id-objtp = c_objtp.
object_id-objyr = g_document-objyr.
object_id-objno = g_document-objno.
link_folder_id-objtp = l_folder_id-foltp.
link_folder_id-objyr = l_folder_id-folyr.
link_folder_id-objno = l_folder_id-folno.
REFRESH lt_rec_tab.
CLEAR lt_rec_tab.
lt_rec_tab-sel = 'X'.
lt_rec_tab-recesc = object_type. "This field for FAX/MAIL
lt_rec_tab-recnam = 'U-'.
lt_rec_tab-deliver = 'X'.
lt_rec_tab-not_deli = 'X'.
lt_rec_tab-read = 'X'.
lt_rec_tab-mailstatus = 'E'.
lt_rec_tab-adr_name = fax_mail_number.
lt_rec_tab-sortfield = fax_mail_number.
lt_rec_tab-recextnam = fax_mail_number.
lt_rec_tab-sortclass = '5'.
APPEND lt_rec_tab.
lt_rec_tab-recextnam = ."Email id .
lt_rec_tab-recesc = 'U'. "object_type.
lt_rec_tab-sndart = 'INT'.
lt_rec_tab-sndpri = 1.
APPEND lt_rec_tab.
c_file = 'C:\Documents and Settings\abgupta\Desktop\Abhinav\zpk.txt'.
lt_files-file = c_file.
APPEND lt_files.
begin of insertion by faianf01
hd_dat-objdes = header_mail.
CALL FUNCTION 'SO_ATTACHMENT_INSERT'
EXPORTING
object_id = object_id
attach_type = attach_type
object_hd_change = hd_dat
owner = sy-uname
TABLES
objcont = l_objcont
objhead = l_objhead
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
object_type_not_exist = 17
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
x_error = 1000.
IF sy-subrc > 0.
ENDIF.
end of insertion by faianf01
lt_note_text-line = 'test prgram for email'.
APPEND lt_note_text.
send email from SAPOFFICE
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
folder_id = folder_id
object_id = object_id
outbox_flag = outbox_flag
link_folder_id = link_folder_id
owner = sy-uname
check_send_authority = 'X'
TABLES
receivers = lt_rec_tab
note_text = lt_note_text
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
component_not_available = 1
folder_no_authorization = 5
folder_not_exist = 6
forwarder_not_exist = 8
object_no_authorization = 13
object_not_exist = 14
object_not_sent = 15
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
too_much_receivers = 73
user_not_exist = 35.
ENDIF.
COMMIT WORK AND WAIT.Hi!
Add the actual body right after the line, you have created the Multipart object.
// create and fill the first message part
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText(this.text); //body of message
Multipart mp = new MimeMultipart();
// Adding the body
mp.addBodyPart(mbp1);
//adding attachments
//... and so on...-Raine- -
Help Please - having difficulties creating af link from the text to an attached file i acrobat
I have been reading the help, but it just wonn't work when I try.
I have tried as followed (I am working with a danish version, and hope to matched the same word as in the english version of Acrobat Xpro):
1. From the toolbox i choose content and then 'hyperlink'
2. I mark the text from which i wish to make a link
3. Acrobat respond with an popup picture 'create a link'
4. From the popup I mark 'Open a side' and push 'next'
5. Acrobat respond with a new popup picture 'create / go to a side'
6. I go to the navigator and open the list with attached file's that I have embedded in my acrobat file.
7. I mark the to which i wish to make a link to
8. In the popup 'create / go to a side' that stilll is open, i push 'Mark hyperlink'
Then I hoped that I have created a link from the acrobat text to the attached file. In stead Acrobat has made a link to the same sidenumber that respond to the text from which i wish to make a link . F.ex. the linktext is on side 10 - then the link goes to side 10.
How do i do it right?
Please help.Hello Bernd
Thanks for a quick respond.
This corresponds to the text I have tried myself, but apparently I do something wrong
1. Open a PDF that contains a PDF file attachment – done
2. Go to where you want to create a link. If that location is in the file attachment, click the Attachments button in the navigation pane, select the file attachment, and click open.
Here I go to side number 10 from which I wish to make a link from (I am not open the attachment file at this moment, as the location not is inside the file attachment).
(I earlier also tried to mark the attachment file and click open, and It result that the attached file just opened normally without creating a link to the file).
3. Choose Tools > Content > link, and select the area for the link
Here I mark the text on side 10 from which I wish to make a link to a attached file
4. In the Create Link dialog box, set the link appearance, select Go To A Page View, and then click Next
Here I have selected ‘Go to a page view’ as told and I click Next
5. Set the page number and view magnification you want, either in the parent PDF document or in the file attachment, and then click set link.
Here I go to the navigation pane and mark the attached file from the file list (the files in the list hasn’t any side number in the list) and then I click Set Link.
Then I hoped that I have created a link from the acrobat text to the attached file. In stead Acrobat has made a link to the same sidenumber that respond to the text from which i wish to make a link . F.ex. the linktext is on side 10 - then the link goes to side 10.
What do I do wrong.?
Med venlig hilsen
Mogens Pedersen
Specialkonsulent
T 33 63 13 07
F 33 63 10 11
[email protected]<mailto:[email protected]>
Fra: Bernd Alheit [email protected]
Sendt: 2. marts 2012 13:11
Til: Mogens Pedersen
Emne: Help Please - having difficulties creating af link from the text to an attached file i acrobat
Re: Help Please - having difficulties creating af link from the text to an attached file i acrobat
created by Bernd Alheit<http://forums.adobe.com/people/Bernd+Alheit> in Creating, Editing & Exporting PDFs - View the full discussion<http://forums.adobe.com/message/4241290#4241290 -
Sending the text file in ECC 6.0
Hi All ,
Note: I searched the so many forums about this but didnt not get the correct solution so I am posting this.
In 4.7 version i used the FM SO_NEW_DOCUMENT_ATT_SEND_API1 to generate the Text file, and it is working good. but now after the upgrdation to ECC 6.0 version , same program with this FM is not working same like 4.7 version.
Is there any thing need to add or remove or Any SAP NOTE related to this?
Thanks in advance.
Regards,
BharaniBharani,
I am using the same FM in ECC 6.0. Check your data declarations. There may be a change there.
Regards
MPersson
* data declarations for sending Email
DATA: w_text(100) TYPE c.
DATA w_date(10) TYPE c.
DATA w_url(25) TYPE c.
DATA: w_subject(50) TYPE c.
DATA: it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
it_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
it_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_cnt TYPE i,
gd_sent_all(1) TYPE c,
gd_doc_data LIKE sodocchgi1,
gd_error TYPE sy-subrc.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
* ~~~~~~~~~~~~~~ further along in your program ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CLEAR w_url.
* (SENDS Copy TO USER - confirms email )
it_receivers-receiver = w_url.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = 'X'.
it_receivers-notif_ndel = 'X'.
APPEND it_receivers.
CLEAR gd_error.
* Call the FM to post the message to SAPMAIL
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = gd_doc_data
put_in_outbox = 'X'
commit_work = 'X'
IMPORTING
sent_to_all = gd_sent_all
TABLES
packing_list = it_packing_list
contents_txt = it_message
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.
* Store function module return code
gd_error = sy-subrc. -
Need to send the text file using webservice
Hi,
I want to send the text file with contains data through oracle pl/sql using webservice. How can i handle this program?
Kindly share with your details.
Thanks in advance,
Maranuser8732035 wrote:
I want to send the text file with contains data through oracle pl/sql using webservice. How can i handle this program?Web services supply XML structured data. Not text files.
PL/SQL supports web services (XML output) and web procedures (text and binary output).
You need to clarify your requirements. -
when i try to send a text msg or get on the internet it says could not acticvate cellular data network? why
Under "settings / general / network" is your "Cellular Data" button set to "ON"?
Maybe you are looking for
-
How to take Input from the callers telephone keypad into oracle database
My client requires to automate a registration task for his customers by telephone. The requirement is the Oracle database should take numeric input from the callers telephone keypad eg 1 or 2 or 3 and the oracle must store this input inside its datab
-
How to use jspx deployed in different managed server from bpm work space
Hi, I have created and deployed my view project having all the jspx files and managed beans into a different managed server(created a new server,not into the soa server). I have created a bpm process and now I want to use the jspx page(deployed into
-
How can I import multiple PDF pages into ID?
I am putting together a catalog which consists of over 400 pages. We had the products on our website exported into a PDF format and I need to add a header and footer to each page via a master page in ID. I don't need to edit the actual PDF but I need
-
Hello Experts, In transaction such as IW21, VA01, etc when we attach documents ( Excel, word, PDf's) in GOS ( Generic Services Objects) the document is stored in the Content repository and has a SAP Archive Link for e.g '&SO_KProObjectID=SOFFLOIO 4A
-
Can't access SLIDESHOW module.
When attempting to access the SLIDESHOW module I get the error message "an error occurred when attempting to change modules. This occurrs when using either the main task bar at the very top of the page under "WINDOW" or the horizontal list of module