Email attachment for text file using ABAP with funny format output
Hi All,
I am developing an ABAP program to generate an email to an external email address by using Function Module FUNCTION 'SO_DOCUMENT_SEND_API1. There is an attachment included in this program. The attachment is generated by reading through a data file from an Application Server and place it in the internal table before attaching it to the function module.
Currently when I download the data file through SO01, I found that the data file looks a bit funny as below. It seems that all the letters are separated with an additional space in between.
Funny Output:
A B C D 1 2 3 A B C
Suppose Output:
ABCD 123 ABC
I am not too sure if there is any output format that I need to set in order to make it works?
hi Sree Ram,
Thanks for your quick reply. The following is my code. I am not too sure if your reply will help to change the format of my data file or attachment sent through email.
Thanks.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_add
sender_address_type = ld_sender_add_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.
Similar Messages
-
I was given an assingment, but have no idea where to begin. The assingment is to create a text file using notepad with all of my digital inputs and some how make those imputs show up on my digital indicators on my control pannel.
When it was explained to me it didn't sound to hard of a task, I have no LabVIEW experience and the tutortial sucks.StevenD: FYI, I did NOT give you the one star rating. I would never do that!
StevenD wrote:
Ow. Someone is grumpy today.
Well, this is an assignment, so it is probably homework.
Why else would anyone give HIM such an assigment, after all he has no LabVIEW experience and the tutorials are too hard for him?
This would make no sense unless all of it was just covered in class!
This is not a free homework service with instant gratification.
OK! Let's do it step by step. I assume you already have a VI with the digital indicators.
"...but have no idea where to begin".
open notepad.
decide on a format, possibly one line per indicator.
type the document.
close notepad.
open LabVIEW.
Open the existing VI with all the indicators.
(are you still following?)
look at the diagram.
Who made the program?
Does the code make sense so far?
Is it a statemachine or just a bunch of crisscrossed wires?
Where do you want to add the file read?
How should the file be read (after pressing a read button, at the start of the program ,etc.)
See how far you get!
Message Edited by altenbach on 06-24-2008 11:23 AM
LabVIEW Champion . Do more with less code and in less time . -
Nokia e63 save email attachment as text file
When I receive email with text document attached and select save, it is always saved in office notes. While this is probably a reasonable thing to do, the problem is that I cannot find the saved file using file manager. So this text document becomes unavailable for other installed programs. Answers to following questions would help mightily:
1. How to save email attachment to specified folder (any attachment)?
2. How to save note from Menu->Office->Notes to some specified folder?
3. Where Menu->Office->Notes stores the notes? (Active Notes stores them in folder called ActiveNotes in root folder)
4. Is it possible to remove this program, since its features are completely covered by Active notes?The email client saves attachments to the folder Others if you choose 'save' from the menu. Notes cannot be individually accessed, they're a some kind of database hidden deep into your phone. To save your note to some folder the only thing you can do is copy and paste it to Quick Office and save it from there.
You can't remove the Notes program. I've moved all my notes to Active Notes and use the memory card to store them. As you said, Active Notes does all that Notes does, and more. Notes just starts up a few milliseconds faster
Message Edited by kvirtanen on 13-Mar-2009 01:57 PM
kvirtanen.deviantart.com -
Removing extra spaces from email attachment of text file
Hi All,
I am having a question in opening email attachment file in text mode.
Whenever I am trying to open a CSV file in text mode after each row it adds blank spaces. These blank spaces are to complete the 255 characters on each row I guess.
My client doesn't want these space. So can anybody tell how to remove those spaces?
<removed by moderator> response would be helpful.
Thanks and Regards
Nishad
Edited by: Thomas Zloch on Apr 28, 2011 4:02 PM - priority normalizedHi,
There is no solution for this as u know that the data which you r sending in csv its actually getting populated from an internal table.
You cannot make your internel table dynamic for this requirment.
It should have a fixed length. Now if the data is less then also the length.
So u have identified correct that because of 255 the blank space is population, nothing is in your hand.
U have to convince the client, to make them understand where is the limitation.
Thanks & Regards
Prasenjit -
Display text file in servlet with preserved formatting(newlines, etc)
how do i display a text file in servlet, but all the blanks and newlines are preserved.
this is what i did:
RandomAccessFile text = new RandomAccessFile("D:/FYP/tempMessage.txt","r");
long length = text.length();
byte[] bytes = new byte[(int)length];
//Read in the bytes
int offset = 0;
int numRead = 0;
while (offset < bytes.length
&& (numRead=deCiphered.read(bytes, offset, bytes.length-offset)) >= 0) {
offset += numRead;
// Close the input stream and return bytes
text.close();
String plainText=new String(bytes);
//display in servlet
pw.println("<center>Plain text: " + plainText + "</center>");
the problem here is the newlines are seem to be omitted when they're displayed in a web browser, rendering the displayed text in a mess.
any help are greatly appreciated. thanks in advance :)display text in between <pre></pre> tags.
or display it inside a text area,dont worry abt the text area border, u can change that using style sheets. -
Sending an email attachment for xls file
Hi all,
I am executing the reports in background, i am getting spool after executing. Just i need to convert the spool to xls format and email through attachment and mail to the user.The xls file should not be saved on local system.
I need your help.
Regards
Vinay.see this link
to send xls as attachment.
http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm -
How to print a text file using Java
How can I print a text file using Java without converting the output to an image format. Is there anyway I can send the characters in the text file as it is for a print job? I did get a listing doing this ... but that converted the text to an image format before printing....
THanks,.Hi I had to write a print api from scratch, and I did not convert the output to image. Go and read up on the following code. I know there is a Tutorial on Sun about the differant sections of the snippet.
private void printReport()
Frame tempFrame = new Frame(getName());
PrintJob printerJob = Toolkit.getDefaultToolkit().getPrintJob(tempFrame, "Liesltext", null);
Graphics g = printerJob.getGraphics();
//I wrote the method below for calculations
printBasics(g);
g.dispose();
printerJob.end();
}This alone wont print it you have to do all the calculations in the printBasics method. And as I said I wrote this from scratch and all I did was research first the tutorial and the white papers
Ciao -
How to call text file using Script in Data Integrator
Dear All,
Can any one assit me in how to call a text file using script with the help of Data Integrator.
and one question ?
M having 32 csv files i want to club thos 32 csv files into one table with the help of Data Integrator, can
any one assist me.mary,
since you knew the file name ,when clicked in name send to server,read the file and write to servlet outputstream.
I think this would help you.
If anything wrong in mycode ..forums will help you further
BufferedInputStream bis=null;
BufferedOutputStream bos=null;
int bytesRead=0;
byte buff[]=new byte[1024];
File f=new File(test.txt);
try{
bis= new BufferedInputStream(new FileInputStream(f));
bytesRead=bis.read(buff,0,buff.length);
if(bytesRead!=-1){
// create a BufferedOutputStream from ServletOutputStream
bos=new BufferedInputStream(response.getOutputStream());
do{
bos.write(buff,0,bytesRead);
}while((bytesRead=bis.read(buff,0,buff.length))!=-1)
}catch(Exception e){
////error handling
} -
How to attach and email a text file using UTL_MAIL.SEND_ATTACH_VARCHAR2
Hi im trying to attach a text file 'sample.txt' located in '\Test_Loc\New_Folder'
Here is my code and my OS is Solaris and im using 10g R2
CREATE OR REPLACE
procedure test_v2 as
Begin
UTL_MAIL.SEND_ATTACH_VARCHAR2(
sender => '[email protected]',
recipients => '[email protected]',
cc => null,
bcc => NULL,
subject => 'RE: Testing Attachment',
message => 'TEST',
mime_type => 'text/plain; charset=us-ascii',
priority => 1,
attachment =>'\Test_Loc\New_Folder\sample.txt',
att_inline => TRUE,
att_mime_type => 'application/octet' ,
att_filename => 'demo.txt'
end;
Where am i going wrong? Please help me out
Regards
VibhutiHi,
i can´t belive that no one is helping you out until now.
If you found a Solution, let me know.
I´m in search of the same Problem...
Regards
Lone -
How to attach a text file as an attachment to email message?
Hello Everybody,
I have a .csv file, in which details about emp-id, emp-name, e-expenses for Reimbursement and email address are stored.
My application reads this .csv file, and sends a mail to each employee with his id, salary details in text format. (by changing content type to "text/plain") The code is working fine. But,
My problem is:
The message is sent as message body to the end user.
The end user / the person who receives this mail will not be a technical person. So,
1) If he trys to take a print out of this e-mail, He get only half of it.(as no. of colums will be more than paper size).
2) I am finding alignment problem. IF employee name is too big, other columns will shift to right and data will not be exactly under column header. (it is going in zig zag way)
So, I thought sending text file with all the details as an attachment might do well.
But, I don't know how to attach a text file to email-message body.
code
try
{ String s1="";
File f1 = new File(the path);
FileInputStream fstream = new FileInputStream(f1); //new
BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
int count=0;
while((s1=br.readLine())!=null )
count++;
//out.println("within while loop "+count);
StringTokenizer st = new StringTokenizer(s1,",");
if ((st.hasMoreTokens())&&(count>1))
String a=st.nextToken().trim();
String b=st.nextToken();
String c=st.nextToken();
String d=st.nextToken();
String e=st.nextToken();
String f=st.nextToken();
String g=st.nextToken();
String h=st.nextToken();
String i=st.nextToken();
String j=st.nextToken();
String k=st.nextToken();
String l=st.nextToken();
String m=st.nextToken();
String n=st.nextToken();
String o=st.nextToken();
String p=st.nextToken();
String q=st.nextToken();
String mail=st.nextToken();
String s=st.nextToken();
//out.println("b="+b+"c="+c+"d="+d+"e="+e+"f="+f+"mail="+mail);
%>
<%
String to =mail;
String from =request.getParameter("fromadd");
String subject ="Statement of Expenses";
String smtp ="mail.xxxxxxxxxx.com";
String message="";
message=message.concat("EMP ID");
message=message.concat(" ");
message=message.concat("Name");
message=message.concat(" ");
message=message.concat("Dept No.");
message=message.concat(" ");
message=message.concat("Acc No.");
message=message.concat(" ");
message=message.concat("*****************************************************************************************");
message=message.concat(a);
message=message.concat(" ");
message=message.concat(b);
message=message.concat(" ");
message=message.concat(c);
message=message.concat(" ");
message=message.concat(d);
Properties props = System.getProperties();
// Puts the SMTP server name to properties object
props.put("mail.smtp.host", smtp);
// Get the default Session using Properties Object
Session session1 = Session.getDefaultInstance(props, null);
// Create a New message
MimeMessage msg = new MimeMessage(session1);
// Set the From address
msg.setFrom(new InternetAddress(from));
// Setting the "To recipients" addresses
msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse(to, false));
/* // Setting the "cc recipients" addresses
msg.setRecipients(Message.RecipientType.CC,InternetAddress.parse(cc, false));
// Setting the "Bcc recipients" addresses
msg.setRecipients(Message.RecipientType.BCC,InternetAddress.parse(bcc, false)); */
// Sets the Subject
msg.setSubject(subject);
// set the meaasge in HTML format
msg.setContent(message,"text/plain");
// Set the Date: header
msg.setSentDate(new java.util.Date());
// Send the message
Transport.send(msg);
// Display Success message
result =result.concat("<tr><td>"+b+"</td>"+"<td>"+to+"</td></tr>");
}//end of if of hasmore element
}// end of while loop
out.println(result);
}catch(Exception e)
// If here, then error in sending Mail. Display Error message.
result="Unable to send your message";
out.println("e="+e);
Any help will be appreciated.
Thanks and regards.
Ashvini<html>
<p>
MimeBodyPart mbp1 = new MimeBodyPart();
mbp1.setText("Your Messages");
MimeBodyPart mbp2 = new MimeBodyPart();
FileDataSource fds = new FileDataSource("Your Attachments");
mbp2.setDataHandler(new DataHandler(fds));
mbp2.setFileName(fds.getName());
Multipart mp = new MimeMultipart();
mp.addBodyPart(mbp1);
mp.addBodyPart(mbp2);
msg.setContent(mp);
msg.saveChanges();
msg.writeTo(System.out);
msg.setSubject(subject);
Transport.send(msg);
</p>
<B><U>See you can add above code in your program and see the magic</U></B>
Bye
regards--
Ashish
</html> -
Attaching text file using SO_NEW_DOCUMENT_ATT_SEND_API1
hello guys, i'm a newbie here.
I'm having trouble attaching an existing text file using function 'SO_NEW_DOCUMENT_ATT_SEND_API1'. It seems i can't find the right combination of parameters that are being passed to this function.
first, i'm using WS_UPLOAD to upload the text file to an internal table then i'm creating all the neccessary internal tables that will be use by this function..
By the way, i'm trying to send mail w/ attachments to external mail and SAPids. Below is my code.
REPORT ZHR_TESTEMAIL .
TABLES: USR02, PA0105, SOSU, SOUC, RLGRAP, IBIPPARMS, DYNPREAD, RSCSEL.
DATA: FOLD_YR(2) TYPE C,
FOLD_TYPE(3) TYPE C,
G_HEADER LIKE SOOD2,
G_FOLMAM LIKE SOFM2,
METHOD1 LIKE SY-UCOMM,
G_DOCUMENT LIKE SOOD4,
G_USER LIKE SOUDNAMEI1,
FOLD_NUMBER(12) TYPE C,
G_NEW_PARENT LIKE SOODK,
G_OWNER LIKE SOUD-USRNAM,
G_REF_DOCUMENT LIKE SOOD4,
G_USER_DATA LIKE SOUDATAI1,
G_AUTHORITY LIKE SOFA-USRACC,
G_OBJCNT LIKE SOLI OCCURS 0 WITH HEADER LINE,
G_OBJHEAD LIKE SOLI OCCURS 0 WITH HEADER LINE,
G_OBJPARA LIKE SELC OCCURS 0 WITH HEADER LINE,
G_OBJPARB LIKE SOOP1 OCCURS 0 WITH HEADER LINE,
G_RECIPIENTS LIKE SOOS1 OCCURS 0 WITH HEADER LINE,
G_REFERENCES LIKE SOXRL OCCURS 0 WITH HEADER LINE,
G_ATTACHMENTS LIKE SOOD5 OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF G_FILES OCCURS 10 ,
TEXT(4096) TYPE C,
END OF G_FILES.
DATA: BEGIN OF IT_WS_FILE OCCURS 0,
WS_FILE LIKE RLGRAP-FILENAME,
END OF IT_WS_FILE.
DATA: BEGIN OF IT_SAPID OCCURS 0,
SAPID LIKE USR02-BNAME,
END OF IT_SAPID.
DATA: BEGIN OF IT_EMAIL OCCURS 0,
EMAILADD LIKE PA0105-USRID_LONG,
END OF IT_EMAIL.
DATA: BEGIN OF IT_TSP01 OCCURS 0.
INCLUDE STRUCTURE TSP01.
DATA: END OF IT_TSP01.
DATA: BEGIN OF TAB2 OCCURS 50,
TEXT(200) TYPE C,
END OF TAB2.
DATA: V_DOCDATA TYPE SODOCCHGI1,
V_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
V_OBJHEAD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
V_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
V_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
V_OBJHEX LIKE SOLIX OCCURS 0 WITH HEADER LINE,
IT_RECVRS TYPE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
IT_CONTNT TYPE SOLISTI1 OCCURS 0 WITH HEADER LINE,
IT_BODY LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE,
V_TLIN TYPE I,
V_LINE TYPE I.
DATA: BEGIN OF IT_TEXTLINE OCCURS 500,
TEXTLINE(5000),
END OF IT_TEXTLINE.
DATA: FYL LIKE RLGRAP-FILENAME,
GV_SUBNO LIKE SOSU-SUBNO,
GV_EMAIL LIKE PA0105-USRID_LONG,
GV_NEXTDAY LIKE SY-DATUM,
YEAR(4) TYPE C,
RECFLAG TYPE C.
SELECTION-SCREEN BEGIN OF BLOCK PARAM WITH FRAME TITLE TEXT-001.
PARAMETERS: SUBJ(254) TYPE C OBLIGATORY, "Subject
DESC(254) TYPE C. "Message
SELECT-OPTIONS: SAPID FOR USR02-BNAME NO INTERVALS. "Recipient's SAP ID
SELECT-OPTIONS: EMAILADD FOR PA0105-USRID_LONG NO INTERVALS.
SELECTION-SCREEN END OF BLOCK PARAM.
SELECTION-SCREEN BEGIN OF BLOCK PARAM2 WITH FRAME TITLE TEXT-002.
SELECT-OPTIONS: WS_FILE FOR DYNPREAD-FIELDNAME NO INTERVALS.
SELECTION-SCREEN END OF BLOCK PARAM2.
SELECTION-SCREEN BEGIN OF BLOCK PARAM3 WITH FRAME TITLE TEXT-003.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: RBUT1 RADIOBUTTON GROUP A USER-COMMAND BUT. "Local PC
SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: RBUT2 RADIOBUTTON GROUP A. "Server
SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: RBUT3 RADIOBUTTON GROUP A. "Spool
SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT3.
PARAMETERS: SPOOLNUM LIKE RSPOTYPE-RQNUMBER. "Spool Number
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK PARAM3.
SELECTION-SCREEN BEGIN OF BLOCK PROC WITH FRAME TITLE TEXT-004.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETER: BPROC AS CHECKBOX USER-COMMAND BCK. "Background Processing
SELECTION-SCREEN COMMENT 5(50) FOR FIELD BPROC.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK PROC.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR WS_FILE-LOW.
DATA: WS_FILE_TEMP TYPE IBIPPARMS-PATH.
CLEAR: WS_FILE_TEMP.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SY-REPID
DYNPRO_NUMBER = SY-DYNNR
FIELD_NAME = 'WS_FILE'
IMPORTING
FILE_NAME = WS_FILE_TEMP.
WS_FILE-LOW = WS_FILE_TEMP.
AT SELECTION-SCREEN.
SELECT SAPNAM FROM SOUC
INTO TABLE IT_SAPID
WHERE SAPNAM IN SAPID
AND DELETED = ''.
GV_NEXTDAY = SY-DATUM + 1.
LOOP AT EMAILADD.
IT_EMAIL-EMAILADD = EMAILADD-LOW.
APPEND IT_EMAIL.
CLEAR: IT_EMAIL.
ENDLOOP.
IF NOT BPROC IS INITIAL.
CLEAR: RBUT1, RBUT3.
RBUT2 = 'X'.
ELSE.
CLEAR: RBUT2.
ENDIF.
IF NOT RBUT3 IS INITIAL.
REFRESH: WS_FILE.
ENDIF.
IF SAPID IS INITIAL AND EMAILADD IS INITIAL.
MESSAGE E000(ZZ) WITH TEXT-201.
ELSEIF NOT SAPID IS INITIAL AND EMAILADD IS INITIAL.
CLEAR IT_SAPID.
READ TABLE IT_SAPID.
SELECT SINGLE SUBNO FROM SOSU
INTO GV_SUBNO
WHERE USRNO IN ( SELECT USRNO FROM SOUC
WHERE SAPNAM = IT_SAPID-SAPID ).
IF SY-SUBRC NE 0.
MESSAGE E000(ZZ) WITH TEXT-202.
ENDIF.
CLEAR: IT_SAPID.
ELSEIF NOT SAPID IS INITIAL AND NOT EMAILADD IS INITIAL.
CLEAR: IT_SAPID, IT_EMAIL.
READ TABLE IT_SAPID.
READ TABLE IT_EMAIL.
SELECT SINGLE SUBNO FROM SOSU
INTO GV_SUBNO
WHERE USRNO IN ( SELECT USRNO FROM SOUC
WHERE SAPNAM = IT_SAPID-SAPID ).
IF SY-SUBRC NE 0.
SUBMIT RSSOADM0 WITH USRNAM EQ IT_SAPID-SAPID
WITH NEW_SUBS EQ IT_EMAIL-EMAILADD
WITH SUB_ESC EQ 'U'
WITH EDAT EQ SY-DATUM
WITH BDAT EQ SY-DATUM
WITH BDAT EQ GV_NEXTDAY
WITH EDAT EQ '99991231'
WITH BTIM EQ SY-UZEIT
WITH ETIM EQ '240000'
WITH FORW_ALL EQ 'X'
WITH PSTHR2 EQ ''
AND RETURN.
ENDIF.
CLEAR: IT_SAPID.
ELSEIF NOT EMAILADD IS INITIAL AND SAPID IS INITIAL.
RECFLAG = 'X'.
ENDIF.
START-OF-SELECTION.
PERFORM B_SENDMAIL.
FORM B_SENDMAIL.
YEAR = SY-DATUM+0(4).
LOOP AT WS_FILE.
CLEAR: FYL.
FYL = WS_FILE-LOW.
REFRESH: TAB2.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = FYL
FILETYPE = 'BIN'
TABLES
DATA_TAB = TAB2.
IT_TEXTLINE[] = TAB2[].
DOCUMENT_DATA (SUBJECT OF MAIL)
V_DOCDATA-OBJ_NAME = DESC.
V_DOCDATA-OBJ_DESCR = SUBJ.
V_DOCDATA-OBJ_LANGU = SY-LANGU.
V_DOCDATA-SENSITIVTY = 'C'.
V_DOCDATA-OBJ_PRIO = '1'.
BODY OF MAIL
IT_BODY-LINE = 'Collection Report'.
APPEND IT_BODY.
CONTENTS_TXT (Attachments)
IT_CONTNT[] = IT_TEXTLINE[].
DESCRIBE TABLE IT_CONTNT LINES V_LINE.
READ TABLE IT_CONTNT INDEX V_LINE.
PACKING_LIST
V_OBJPACK-DOC_SIZE = ( V_LINE - 1 ) * 255 + STRLEN( IT_CONTNT ).
V_OBJPACK-TRANSF_BIN = 'X'.
V_OBJPACK-HEAD_START = 1.
V_OBJPACK-HEAD_NUM = 0.
V_OBJPACK-BODY_START = 1.
V_OBJPACK-BODY_NUM = V_LINE.
V_OBJPACK-DOC_TYPE = 'TXT'.
V_OBJPACK-OBJ_NAME = 'ATTACHMENT'.
V_OBJPACK-OBJ_DESCR = 'Attached Document'.
APPEND V_OBJPACK.
CLEAR V_OBJPACK.
RECEIVERS of mail
IF RECFLAG IS INITIAL.
LOOP AT IT_SAPID.
IT_RECVRS-RECEIVER = IT_SAPID-SAPID.
IT_RECVRS-REC_TYPE = 'B'.
IT_RECVRS-COM_TYPE = ''.
IT_RECVRS-EXPRESS = 'X'.
IT_RECVRS-NO_FORWARD = ''.
IT_RECVRS-NO_PRINT = ''.
APPEND IT_RECVRS.
CLEAR IT_RECVRS.
ENDLOOP.
ELSE.
LOOP AT EMAILADD.
IT_RECVRS-RECEIVER = EMAILADD-LOW.
IT_RECVRS-REC_TYPE = 'U'.
IT_RECVRS-COM_TYPE = 'INT'.
IT_RECVRS-EXPRESS = 'X'.
APPEND IT_RECVRS.
CLEAR IT_RECVRS.
ENDLOOP.
ENDIF.
OBJECT_HEADER (Filename)
CONCATENATE 'Collection Report' '_'
SY-DATUM+4(4) YEAR '.TXT'
INTO V_OBJHEAD-LINE.
V_OBJHEAD-LINE = FYL+16(25).
APPEND V_OBJHEAD.
CLEAR V_OBJHEAD.
Function Module For Sending Mail with Attachment
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = V_DOCDATA
TABLES
PACKING_LIST = V_OBJPACK
OBJECT_HEADER = V_OBJHEAD
CONTENTS_HEX = IT_CONTNT
CONTENTS_TXT = IT_BODY
RECEIVERS = IT_RECVRS
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 S000(ZZ) WITH TEXT-005.
ELSE.
MESSAGE S000(ZZ) WITH TEXT-006.
ENDIF.
ENDLOOP.
end of my code *
please help me guys... when i run this program, DOCUMENT_NOT_SENT is what i always get..
waiting for ur reply... thank you vey much and godbless.Hi,
Try this sample code.
FORM SEND_TO_EMAIL USING zFName.
DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
DATA: DOC_CHNG LIKE SODOCCHGI1.
DATA: TAB_LINES LIKE SY-TABIX.
DATA: ctmp(50) TYPE C.
Creation of the document to be sent
DOC_CHNG-OBJ_NAME = 'JOURNAL'.
CONCATENATE 'SAP Payroll Journal file Period' pybegda INTO ctmp
SEPARATED BY SPACE.
DOC_CHNG-OBJ_DESCR = cTmp.
OBJTXT = 'SAP Payroll Journal'.
APPEND OBJTXT.
CONCATENATE 'For Period' pybegda INTO ctmp
SEPARATED BY SPACE.
OBJTXT = ctmp.
APPEND OBJTXT.
CONCATENATE 'Attached File :' zFname INTO ctmp
SEPARATED BY SPACE.
OBJTXT = ctmp.
APPEND OBJTXT.
OBJTXT = 'Please find the attachment.'.
APPEND OBJTXT.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
Creation of the entry for the compressed document
CLEAR OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
Creation of the document attachment
<b>LOOP AT xMail.
CONDENSE xMail-aline.
OBJBIN = xMail-aline.
APPEND OBJBIN.
CLEAR OBJBIN.
ENDLOOP.</b>
DESCRIBE TABLE OBJBIN LINES TAB_LINES.
OBJHEAD = zFname. APPEND OBJHEAD.
Creation of the entry for the compressed attachment
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 1.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'RAW'.
OBJPACK-OBJ_NAME = 'DATA'.
OBJPACK-OBJ_DESCR = 'SAP Payroll File'.
OBJPACK-DOC_SIZE = TAB_LINES * 255.
APPEND OBJPACK.
Completing the recipient list
LOOP AT PENERIMA.
CONDENSE PENERIMA-PNRM.
RECLIST-RECEIVER = PENERIMA-PNRM.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
ENDLOOP.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = ' '
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.
CASE SY-SUBRC.
WHEN 0.
WRITE: / 'Result of the send process:'.
LOOP AT RECLIST.
WRITE: / RECLIST-RECEIVER(48), ':'.
IF RECLIST-RETRN_CODE = 0.
WRITE / 'The document was sent'.
ELSE.
WRITE / 'The document could not be sent'.
ENDIF.
ENDLOOP.
WHEN 1.
WRITE: / 'Too many receiver'.
WHEN 2.
WRITE: / 'Document could not be sent to any recipient'.
WHEN 4.
WRITE: / 'No send authorization'.
WHEN OTHERS.
WRITE: / 'Error occurred while sending'.
ENDCASE.
ENDFORM. -
I get two-sided option for normal printing, but
I can't get duplex print option for pdf files using Adobe ReaderXI 11.0.04, Mac 10.8.5 with HP Officejet Pro 8600. HP says it's an Adobe problem. I'm stuck.
Thanks in advance.
VOIt depends where the pdf is located. If in the Finder or in an attachment to
an email in Entourage, the message is ³You can¹t open the application
³Acrobat Reader 5.0² because PowerPC applications are no longer supported².
If an attachment in an email that has come via Safari, the message is
³Safari can¹t open the file because no available applications can open it².
In each case the menu bar is Finder or Entourage or Safari as the case may
be. -
How do you create a save as default folder for MP3 files used Captivate text to audio voices files?
Hi Ed
Thank you for contacting me, however I already know how to save text to
audio files via timeline using the Export feature.
So my question was not entirely clear and I apologize for that. To explain
further, whenever I save a text to audio file, captivate takes me to a
default save as folder where I then have browse back to my production
folder where I am keeping all my Txt to Aud files. This is very tedious
process when you have alot of files to save. So my question was is there a
way to configure captivate so I can make my production folder the default
file for whenever I save a Txt to Audio file through Export feature that
the system automatically takes me to that production folder, and I am
spared the long tedious process of saving the file manually to the
prodcution folder I want.
I have copy the pathway to the production folder in the URL filed in the
Save As dialoge box and that workaround as cut the work down but I still
have to paste that URL field to point the file to the right folder. So it
would be nice if I could do everything automatically. Microsoft makes this
capability in their MS Office applications, so I was thinking Adobe might
do the same thing. Your help with this would be appreicated,
Thanks
Merrill Roberts
Sr. Training Specialist
SunGard Availability Services
Direct 925-831-7730
Mobile:415-215-9280 -
Fm or class existing for fetching xml contents from a file using abap ?
Hi,
I need to fetch an xml file in a string of type xstring. I am using class cl_gui_frontend_services=>gui_upload.
This returns me content in table format, than i am planning to conver to xstring.
Is there any better approach or any existing function module any one know of ?
thanks
Regards
PoojaHi Pooja,
You can try out this program to read the XML file using abap.
*& Report ZXMLTOITAB *
REPORT ZXMLTOITAB .
TYPE-POOLS: ixml.
TYPES: BEGIN OF t_xml_line,
data(256) TYPE x,
END OF t_xml_line.
DATA: l_ixml TYPE REF TO if_ixml,
l_streamfactory TYPE REF TO if_ixml_stream_factory,
l_parser TYPE REF TO if_ixml_parser,
l_istream TYPE REF TO if_ixml_istream,
l_document TYPE REF TO if_ixml_document,
l_node TYPE REF TO if_ixml_node,
l_xmldata TYPE string.
DATA: l_elem TYPE REF TO if_ixml_element,
l_root_node TYPE REF TO if_ixml_node,
l_next_node TYPE REF TO if_ixml_node,
l_name TYPE string,
l_iterator TYPE REF TO if_ixml_node_iterator.
DATA: l_xml_table TYPE TABLE OF t_xml_line,
l_xml_line TYPE t_xml_line,
l_xml_table_size TYPE i.
DATA: l_filename TYPE string.
PARAMETERS: pa_file TYPE char1024 DEFAULT 'c:\temp\orders_dtd.xml'.
* Validation of XML file: Only DTD included in xml document is supported
PARAMETERS: pa_val TYPE char1 AS CHECKBOX.
START-OF-SELECTION.
* Creating the main iXML factory
l_ixml = cl_ixml=>create( ).
* Creating a stream factory
l_streamfactory = l_ixml->create_stream_factory( ).
PERFORM get_xml_table CHANGING l_xml_table_size l_xml_table.
* wrap the table containing the file into a stream
l_istream = l_streamfactory->create_istream_itable( table =
l_xml_table
size =
l_xml_table_size ).
* Creating a document
l_document = l_ixml->create_document( ).
* Create a Parser
l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
istream = l_istream
document = l_document ).
* Validate a document
IF pa_val EQ 'X'.
l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
ENDIF.
* Parse the stream
IF l_parser->parse( ) NE 0.
IF l_parser->num_errors( ) NE 0.
DATA: parseerror TYPE REF TO if_ixml_parse_error,
str TYPE string,
i TYPE i,
count TYPE i,
index TYPE i.
count = l_parser->num_errors( ).
WRITE: count, ' parse errors have occured:'.
index = 0.
WHILE index < count.
parseerror = l_parser->get_error( index = index ).
i = parseerror->get_line( ).
WRITE: 'line: ', i.
i = parseerror->get_column( ).
WRITE: 'column: ', i.
str = parseerror->get_reason( ).
WRITE: str.
index = index + 1.
ENDWHILE.
ENDIF.
ENDIF.
* Process the document
IF l_parser->is_dom_generating( ) EQ 'X'.
PERFORM process_dom USING l_document.
ENDIF.
*& Form get_xml_table
FORM get_xml_table CHANGING l_xml_table_size TYPE i
l_xml_table TYPE STANDARD TABLE.
* Local variable declaration
DATA: l_len TYPE i,
l_len2 TYPE i,
l_tab TYPE tsfixml,
l_content TYPE string,
l_str1 TYPE string,
c_conv TYPE REF TO cl_abap_conv_in_ce,
l_itab TYPE TABLE OF string.
l_filename = pa_file.
* upload a file from the client's workstation
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_filename
filetype = 'BIN'
IMPORTING
filelength = l_xml_table_size
CHANGING
data_tab = l_xml_table
EXCEPTIONS
OTHERS = 19.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Writing the XML document to the screen
CLEAR l_str1.
LOOP AT l_xml_table INTO l_xml_line.
c_conv = cl_abap_conv_in_ce=>create( input = l_xml_line-data
replacement = space ).
c_conv->read( IMPORTING data = l_content len = l_len ).
CONCATENATE l_str1 l_content INTO l_str1.
ENDLOOP.
l_str1 = l_str1+0(l_xml_table_size).
SPLIT l_str1 AT cl_abap_char_utilities=>cr_lf INTO TABLE l_itab.
WRITE: /.
WRITE: /' XML File'.
WRITE: /.
LOOP AT l_itab INTO l_str1.
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>horizontal_tab
IN
l_str1 WITH space.
WRITE: / l_str1.
ENDLOOP.
WRITE: /.
ENDFORM. "get_xml_table
*& Form process_dom
FORM process_dom USING document TYPE REF TO if_ixml_document.
DATA: node TYPE REF TO if_ixml_node,
iterator TYPE REF TO if_ixml_node_iterator,
nodemap TYPE REF TO if_ixml_named_node_map,
attr TYPE REF TO if_ixml_node,
name TYPE string,
prefix TYPE string,
value TYPE string,
indent TYPE i,
count TYPE i,
index TYPE i.
node ?= document.
CHECK NOT node IS INITIAL.
ULINE.
WRITE: /.
WRITE: /' DOM-TREE'.
WRITE: /.
IF node IS INITIAL. EXIT. ENDIF.
* create a node iterator
iterator = node->create_iterator( ).
* get current node
node = iterator->get_next( ).
* loop over all nodes
WHILE NOT node IS INITIAL.
indent = node->get_height( ) * 2.
indent = indent + 20.
CASE node->get_type( ).
WHEN if_ixml_node=>co_node_element.
* element node
name = node->get_name( ).
nodemap = node->get_attributes( ).
WRITE: / 'ELEMENT :'.
WRITE: AT indent name COLOR COL_POSITIVE INVERSE.
IF NOT nodemap IS INITIAL.
* attributes
count = nodemap->get_length( ).
DO count TIMES.
index = sy-index - 1.
attr = nodemap->get_item( index ).
name = attr->get_name( ).
prefix = attr->get_namespace_prefix( ).
value = attr->get_value( ).
WRITE: / 'ATTRIBUTE:'.
WRITE: AT indent name COLOR COL_HEADING INVERSE, '=',
value COLOR COL_TOTAL INVERSE.
ENDDO.
ENDIF.
WHEN if_ixml_node=>co_node_text OR
if_ixml_node=>co_node_cdata_section.
* text node
value = node->get_value( ).
WRITE: / 'VALUE :'.
WRITE: AT indent value COLOR COL_GROUP INVERSE.
ENDCASE.
* advance to next node
node = iterator->get_next( ).
ENDWHILE.
ENDFORM. "process_dom
Regards,
Samson Rodrigues. -
Report the size of all SharePoint Databases in a text file using PowerShell?
I am new to Powershell. please help me for following question with step by step process.
How to report the size of all SharePoint Databases in a text file using PowerShell?Hi Paul,
Here is the changed script, which will also include the size for the Config DB.
Please let me know if it worked:
#Get SharePoint Content database sizes
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$date = Get-Date -Format "dd-MM-yyyy"
#Variables that you can change to fit your environment
$TXTFile = "D:\Reports\SPContentDatabase_$date.txt"
$SMTPServer = "yourmailserver"
$emailFrom = "[email protected]"
$emailTo = "[email protected]"
$subject = "Content & Config Database size reports"
$emailBody = "Daily/Weekly/Monthly report on Content & Config databases"
$webapps = Get-SPWebApplication
$configDB = Get-SPDatabase | ?{$_.Name -eq ((Get-SPFarm).Name)}
$ConfigDBSize = [Math]::Round(($configDB.disksizerequired/1GB),2)
Add-Content -Path $TXTFile -Value "Config Database size: $($ConfigDBSize)GB"
Add-Content -Path $TXTFile -Value ""
foreach($webapp in $webapps)
$ContentDatabases = $webapp.ContentDatabases
Add-Content -Path $TXTFile -Value "Content databases for $($webapp.url)"
foreach($ContentDatabase in $ContentDatabases)
$ContentDatabaseSize = [Math]::Round(($ContentDatabase.disksizerequired/1GB),2)
Add-Content -Path $TXTFile -Value "- $($ContentDatabase.Name): $($ContentDatabaseSize)GB"
if(!($SMTPServer) -OR !($emailFrom) -OR !($emailTo))
Write-Host "No e-mail being sent, if you do want to send an e-mail, please enter the values for the following variables: $SMTPServer, $emailFrom and $emailTo."
else
Send-MailMessage -SmtpServer $SMTPServer -From $emailFrom -To $emailTo -Subject $subject -Body $emailBody -Attachment $TXTFile
Nico Martens - MCTS, MCITP
SharePoint 2010 Infrastructure Consultant / Trainer
Maybe you are looking for
-
How can I combine my DVD files into one file for editing?
Paul LS offers this excellent solution: Go to Start>All Programs>Accessories>Command Prompt... the Command Prompt window will open. Assuming C: is your hard drive and D: is your DVD drive type the following commands... type: "d:" and press Enter, the
-
Is there a way to create a template table, somewhat akin to an OO class?
Hi everyone, Here is my novice question of the day. Say I would like to create a table which will describe the attributes of a set of tables. Each table in the set will have exactly the same field names, datatypes, etc..., but each table will represe
-
Degeneration of bulit-in HP netbook screen protectors
I've been through about a dozen HP netbooks, and while I have found them very good I have come across a very troublesome development in many of the newer ones. At some point HP deceded to extend the bezel into a transparent screen protector. This is
-
Hello, We have a scenario where, sometimes for a given PO we receive the invoice from the vendor before we receive the GR. Then, after we receive the invoice, if someone decides to cancel the order they go ahead and delete all the PO line items. And
-
Adobe won't work and cannot uninstall
adobe won't work and cnnot uninstall