Convert Script output data to Text(.txt) file & send mail with attachment.
Hi All,
Requirement: I shulb be able to conver th Script output data to Text(.text) file & send a maill with attachment with this text file. Formant of text file should be like output of Print priview.
Plese sugget with Function modules to cover as Text file.
I am able to converting the Script output data to PDF and sending mail with attachment. So I don't want PDF file now.
Thanks in advance.
Hi, Thanks for responst.
We can convert the Scirpt output to PDF file by using OTF function module and the PDF file looks like Print Privew output.
Same like this I want Script out in NOTEPAD (.txt). Is that possible, Plz sugget with relavent Function Modules.
Thanks.
Similar Messages
-
Convert Screen(spool) to PDF file sending mail with attach file
Hi :
I'd like convert spool list to pdf and sending file...
so, I read thread about spool convert to PDF before,
and know how to convert Spool to PDF file and send mail with attach file.
but I have a problem.
my solution as:
step 1. Call function: "CONVERT_ABAPSPOOLJOB_2_PDF"
step 2. Call function: "SO_NEW_DOCUMENT_ATT_SEND_API1"
then, I got a mail with attached PDF file, but the PDF file display limited 255 line.( SO_NEW_DOCUMENT_ATT_SEND_API1 limited)
I want to showing word is wider that 255.
and then I find a manual method as:
After program finished.
Function Menu -> system -> List -> Send
use Prog: "Create Document and Send"
I use this prog sending mail and attached file ,
PDF file do <b>NOT</b> have 255 word limit !
finally. my question is, If I want sending mail as Prog: "Create Document and Send", how to do?
which Function I have to use?...
Please help me, Thanks!Hi,
Check this sample code of sending spool as attachment to an email address..
Parameters.
PARAMETERS: p_email(50) LOWER CASE.
PARAMETERS: p_spool LIKE tsp01-rqident.
Data declarations.
DATA: plist LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: document_data LIKE sodocchgi1.
DATA: so_ali LIKE soli OCCURS 100 WITH HEADER LINE.
DATA: real_type LIKE soodk-objtp.
DATA: sp_lang LIKE tst01-dlang.
DATA: line_size TYPE i VALUE 255.
DATA: v_name LIKE soextreci1-receiver.
DATA rec_tab LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
Get the spool data.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = p_spool
first_line = 1
last_line = 0
desired_type = ' '
IMPORTING
real_type = real_type
sp_lang = sp_lang
TABLES
buffer = so_ali
EXCEPTIONS
no_such_job = 1
job_contains_no_data = 2
selection_empty = 3
no_permission = 4
can_not_access = 5
read_error = 6
type_no_match = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE s208(00) WITH 'Error'.
LEAVE LIST-PROCESSING.
ENDIF.
Prepare the data.
plist-transf_bin = 'X'.
plist-head_start = 0.
plist-head_num = 0.
plist-body_start = 0.
plist-body_num = 0.
plist-doc_type = 'RAW'.
plist-obj_descr = 'Test ALV'.
APPEND plist.
plist-transf_bin = 'X'.
plist-head_start = 0.
plist-head_num = 0.
plist-body_start = 1.
DESCRIBE TABLE so_ali LINES plist-body_num.
plist-doc_type = real_type.
Get the size.
READ TABLE so_ali INDEX plist-body_num.
plist-doc_size = ( plist-body_num - 1 ) * line_size
+ STRLEN( so_ali ).
APPEND plist.
Move the receiver address.
MOVE: p_email TO rec_tab-receiver,
'U' TO rec_tab-rec_type.
APPEND rec_tab.
IF NOT sp_lang IS INITIAL.
document_data-obj_langu = sp_lang.
ELSE.
document_data-obj_langu = sy-langu.
ENDIF.
v_name = sy-uname.
Send the email.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = document_data
sender_address = v_name
sender_address_type = 'B'
TABLES
packing_list = plist
contents_bin = so_ali
receivers = rec_tab
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 e208(00) WITH 'Error'.
ENDIF.
COMMIT WORK.
Send the email immediately.
SUBMIT rsconn01
WITH mode = 'INT'
AND RETURN.
Thanks,
Naren -
Convert internal table data to pdf format and send mail to Users
Hi all ,
I want to convert the data available in internal table to pdf format and then send it to mail .
Please tell me wht are the fn modules available to convert the data from internal table to pdf and then send it mail .
regards
santosh .Hi Santosh
Sending mail with attachment report in Background
Content Author: Fernando Faian
I have read the hint about "Sending mail with attachment report".
It's great, but how can I make this function work in background??
I had that needed last year too. See attachment a function group with two functions. The second one has that functionality to send email or fax (SAP office) with attachment objects in background job using SO_ATTACHMENT_INSERT function.
Pay attention because its working with output list from spool converted to pdf.
=================================================================================
z_send_email_fax_global
FUNCTION-POOL z_gfaian_mail_fax. "MESSAGE-ID ..
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.
IF sy-subrc NE 0.
RAISE err_no_abap_spooljob. "doesn't exist
ELSE.
client = tsp01-rqclient.
name = 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 = fax_mail_number.
lt_rec_tab-recesc = object_type.
lt_rec_tab-sndart = 'INT'.
lt_rec_tab-sndpri = 1.
APPEND lt_rec_tab.
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
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.
ENDFUNCTION.
=================================================================================
z_send_email_fax
FUNCTION ZCBFS_SEND_MAIL.
""Interface local:
*" IMPORTING
*" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
*" REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
*" TABLES
*" LIST_FAX_MAIL_NUMBER STRUCTURE SOLI
*" EXCEPTIONS
*" ERR_NO_ABAP_SPOOLJOB
DATA: vg_achou(1) TYPE n.
Fist part: Verify if the spool really exists
vg_achou = 1.
DO 60 TIMES.
SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
IF sy-subrc IS INITIAL.
CLEAR vg_achou.
EXIT.
ELSE.
WAIT UP TO 1 SECONDS.
ENDIF.
ENDDO.
IF vg_achou = 1.
RAISE err_no_abap_spooljob. "doesn't exist
ENDIF.
client = tsp01-rqclient.
name = 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
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.
LOOP AT LIST_FAX_MAIL_NUMBER.
lt_rec_tab-recextnam = LIST_FAX_MAIL_NUMBER-LINE.
lt_rec_tab-recesc = 'U'.
lt_rec_tab-sndart = 'INT'.
lt_rec_tab-sndpri = 1.
APPEND lt_rec_tab.
ENDLOOP.
lt_files-file = c_file.
APPEND lt_files.
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.
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
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.
ENDFUNCTION.
Regards,
Sree -
Send mail with attachment from the uploaded file
hi,
From a form thread i got the following code to send mail with attachment with the file uploaded from the file upload ui element.
public void onActionLoadFile(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionLoadFile(ServerEvent)
WDWebResourceType FileType = null;
String FileName = new String();
//get attribute info for context attribute 'FileUpload'
IWDAttributeInfo attributeInfo =
wdContext.getNodeInfo().getAttribute(
IPrivateEmailView.IContextElement.FILE_UPLOAD);
//get modifiable binary type from the attribute info,requires type cast.
IWDModifiableBinaryType binaryType =
(IWDModifiableBinaryType) attributeInfo.getModifiableSimpleType();
IPrivateEmailView.IContextElement element =
wdContext.currentContextElement();
//if a file in the 'FileResource' attribute exists
if (element.getFileUpload() != null) {
try {
String mimeType = binaryType.getMimeType().toString();
byte[] file = element.getFileUpload();
//get the size of the uploaded file
element.setFileSize(this.getFileSize(file));
//get the extension of the uploaded file
element.setFileExtension(binaryType.getMimeType().getFileExtension());
//NOTE: context attribute 'FileName' must not be set
//because the FileUpload-UI-element property 'fileName'
//is bound to it. Consequently the fileName is automatically
//written to the context after file upload.
//report success message
wdComponentAPI.getMessageManager().reportMessage(
IMessageEmailComp.SF_UPLOAD,
new Object[] { binaryType.getFileName()},
false);
FileType = binaryType.getMimeType();
FileName = binaryType.getFileName();
} catch (Exception e) {
throw new WDRuntimeException(e);
//if no file in the 'FileResource' attribute exists
else {
//report error message
IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
msgMgr.reportContextAttributeMessage(
element,
attributeInfo,
IMessageEmailComp.NO_FILE,
new Object[] { "" },
true);
//clear the FileResource context value attribute
//element.setFileUpload(null);
String URL;
URL = this.CreateAndGetPathFileUpload(
wdContext.currentContextElement().getFileUpload(),
FileName);
// if (URL.length() == 1){
// //ERRORE
wdContext.currentContextElement().setPATHFileUploaded(URL);
//@@end
public boolean send( java.lang.String subj, java.lang.String mess, java.lang.String dest, java.lang.String attach, java.lang.String FileName )
//@@begin send()
InitialContext ctx = null;
Address[] address = null;
Message msg = null;
Session sess = null;
MimeBodyPart bodyPart = null;
Multipart mp = null;
// "141.29.193.71" == milvl2ja.icn.siemens.it (SMTP di Siemens)
try {
Properties props = new Properties();
props.put("domain","true");
ctx = new InitialContext(props);
sess = (Session) ctx.lookup("java:comp/env/mail/MailSession");
msg = new MimeMessage(sess);
IWDClientUser utente = WDClientUser.getCurrentUser();
String senderEmail = utente.getSAPUser().getEmail();
InternetAddress addressFrom = new InternetAddress(senderEmail);
msg.setFrom(addressFrom);
String EmailDEST = dest;
InternetAddress addressTo = new InternetAddress(EmailDEST);
msg.setRecipient(Message.RecipientType.TO, addressTo);
msg.setSubject(subj);
// if ((mess != null) && (mess.length()>0)) {
// msg.setContent(mess, "text/plain");
// } else {
// msg.setContent("", "text/plain");
//Gestione ATTACHMENT...
String attachedFileName = new String(wdContext.currentContextElement().getFileName());
boolean hasAttachment = (attachedFileName != null) && (attachedFileName.length() > 0);
boolean isMultiPart = (mess != null) && (mess.length() > 1);
//adding an attachment makes the message multipart
if (isMultiPart || hasAttachment) {
mp = new MimeMultipart();
// add text parts
if (mess != null) {
for (int i = 0; i < mess.length(); i++) {
bodyPart = new MimeBodyPart();
bodyPart.setContent(mess,"text/plain");
mp.addBodyPart(bodyPart);
//attach the file to the message if needed
if (hasAttachment) { // avoid the case with no text parts
bodyPart = new MimeBodyPart();
bodyPart.setContent("Allegato incluso nel messaggio.","text/plain");
mp.addBodyPart(bodyPart);
// the part with the file
FileDataSource fds = new FileDataSource(attach);
MimeBodyPart attachmentBodyPart = new MimeBodyPart();
attachmentBodyPart.setDataHandler(new DataHandler(fds));
//URL URLattachedFileName = new URL(attach);
//attachmentBodyPart.setDataHandler(new DataHandler(URLattachedFileName));
attachmentBodyPart.setFileName(FileName);
mp.addBodyPart(attachmentBodyPart);
msg.setContent(mp);
} else {
if ((mess != null) && (mess.length() > 0)) {
msg.setContent(mess, "text/plain");
} else {
msg.setContent("", "text/plain");
//fine ATTACHMENT
msg.setSentDate(new GregorianCalendar().getTime());
msg.saveChanges();
address = msg.getAllRecipients();
Transport.send(msg, address);
} catch (Exception e) {
e.printStackTrace();
return false;
return true;
//@@end
When i used the same code in my application i am gett ing error in many places..
1)FileDataSource fds = new FileDataSource(<b>attach</b>);
attach cannot be resolved
2)attachmentBodyPart.setFileName(<b>FileName</b>);
fliename cannot be resolved
3)byte[] file = element.getFileUpload();
type mismatch cannot convert sting to byte[]
4)element.setFileSize(this.getFileSize(file));
method getFileSize() is undefined
5)element.setFileExtension(binaryType.getMimeType().getFileExtension());
method getFilExtension() is undefined
6)URL = this.CreateAndGetPathFileUpload(wdContext.currentContextElement().getFileUpload(),FileName);
method CreateAndGetPathFileUpload() is undefined.
7)wdContext.currentContextElement().setPATHFileUploaded(URL);
from the above error i can understand that only i have got the part of the code.
Please send me the complete coding.
some method definitions are missing....
Please help me to send the mail with attachment from the file uploaded from the file upload ui element.
Thanks in advance,
shami.hi,
I got this from the following link
Re: Attaching an excel file
plz help me ...
I am using 2004s with nwds 7.0.06.
also tell me what should be the type of the context variable FileUpload
Thanks in advance,
shami. -
Send mail with attached file without using Repository
Hello,
I want to know if have a way to Send mail with attached file without using Repository.
Regards
EladElad,
Check this article where a image has been picked by the file adapter and sent as an attachment to the mail adapter.
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6d967fbc-0a01-0010-4fb4-91c6d38c5816">Sending an Image File Through XI in a File-to-Mail Scenario</a>
For how to proceed without integration repository content look into this blog,
<a href="/people/william.li/blog/2006/09/08/how-to-send-any-data-even-binary-through-xi-without-using-the-integration-repository">How to send any data (even binary) through XI, without using the Integration Repository</a>
Combining these 2 you have the solution.
Regards
Bhavesh -
How to extract data from a .txt file & send it to a serial port automatically
Hi all
I'm a final yr B.Tech student. I am new to the entire LABVIEW thing. But i hear its really good. My dept. in collge has purchased labview & i'm tryng to use it
As i'm new to labview , i need help plz
" I want to open a .txt file (in my PC) & transmit all the contents of the file via serial (COM) port to an 89%! microcontroller. Also i want to read the feedback messages from the microcontroller thru the serial port & save it to the same file in the PC.All this must be done automatically. ie, no manual intervention after execution starts"
Kindly help me as i'm stuck here & unable to proceed further with my projecthere is my 20min try without debugging (needs a rs232 and loopback connector )
use the probe and highlight the dataflow to see how it works.
as always: there are many ways to solve your problem
Greetings from Germany
Henrik
LV since v3.1
“ground” is a convenient fantasy
'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'
Attachments:
read write file to RS232.vi 69 KB -
Outlook 2010 - sending mail with attachment - "The system cannot find the file specified"
Hi forum Fellows,
I have the following failure scenario:
1. A user receives an e-mail with an attachment.
2. The user opens the attachment --> Forwards the mail and writes something in the body of the e-mail
3. For whatever reason the user leaves the e-mail and works on something else --> the user comes back to the e-mail an hour or more later.
4. The user then wants to send the e-mail but gets the following error message: "The system cannot find the file specified"
5. The effect is that the user cannot send the e-mail.....
------------------------------ TROUBLESHOOTING -----------------------
- I can see that when the user opens an attachment this attachment is saved in the OutlookTemp folder. Actually, there is a difference between opening the attachment before or after clicking forward on the e-mail.
---- Before: Two files is written to the OutlookTemp folder. For example if the attachment name is FileX.pdf - there will be a FileX.pdf but also a FileX (2).pdf in the folder (if OutlookTemp is empty/do not contain a file with the name FileX.pdf already)
---- After: Only one file is written to OutlookTemp. That is FileX.pdf
- Running Process Monitor when trying to forward the e-mail I can see that Outlook is calling a file that is not in the OutlookTemp folder anymore.
**** To me this is the heart of the issue. For some reason, when a user has an e-mail with an attachment open for an extended period of time (not sure on exactly how long is necessary), files in the OutlookTemp folder is deleted - files that Outlook is depending
on to be there.
- Going with a totally clean OutlookTemp folder does not help.
------------------ NOW WHAT ---------------
- The question now is: Is this by design? Can it be fixed by some Outlook 2010 patch? Or perhaps a group policy/registry setting as a workaround.
------------------------------ TECH. INFO -----------------------
Outlook 2010 v14.0.7132.5000
Outlook bit depth: x86
Running on a 2008R2 SP1 TS environment.
No antivirus on the TS
Looking forward to hear from you.
Regards The Red Baron
Red BaronHello Red Baron,
Although not a complete answer, the way to treat attachments in emails require some discipline:
1. Never open an attachment directly from the email (and NEVER edit it from there). Always save it in a known location as the desktop or (better) in a designated document folder. Then you can proceed as usual, like editing the contents, printing, forwarding
the new version etc.
2. Directly forwarding the attachment is ok, along with additional text in the body of the email.
3. Having any (unsaved) document open for several hours should
never occur. What if there is a power outage?
Bottom line is thus Discipline. This is regardless of Operating System (which might handle temporary files differently).
These are the rules I teach my customers and they never leave any document unsaved for hours ...
Best regards George -
Sending mail with attachment file through plsql
Hi,
Now i send the mail using utl_smtp and utl_tcp.
How can i send a mail with a attachment file. That file is in the local directory. Can any one know just send me to the following mail id [email protected]
Regards
SureshHi,
Now i send the mail using utl_smtp and utl_tcp.
How can i send a mail with a attachment file. That file is in the local directory. Can any one know just send me to the following mail id [email protected].
Regards
Suresh -
I use Adobe Photoshop CS4_Bridge _Photo Downloader to import images from CF Cards into my 11" Mac Book Air. I have an issue with the Text files
that seem to accompany each and every image that I do not need. How do I stop Apple Script (which I assume is the culprit in this case) from interferring with this process.Your iWeb Site is stored not on your iDisk, but on a file named Domain.sites in your ~/Home/Library/Application Support/iWeb/ Folder.
If , for whatever reason, you wipe your HD and/or lose this file (Get a new computer, Re-Install your OS, Stolen Laptop, Crashed HD, Etc.) without backing-up your Domain.sites file then you will have to re-build your iWeb sites from scratch again.
Of course you can edit your Published HTML files in a different program such as Dreamweaver or even Text Edit. You just can't edit Published HTML files in iWeb. Not at this time at least.
Use iWebBackup to backup your Domain file to a Blank CD or DVD. Backing up your Domain file to another folder on your computer is not fully backing it up. If your computer gets stolen you still lost the file but if you have your Domain file burned onto a CD you have a backup!
Download iWebBackup Here
You can use iWebExtender to automatically consolidate your files into one folder and delete multiple images.
http://iWebFAQ.com -
Attach file to mail with "unusual" characters
Hi
I have made a procedure that can send mail with attached file/files. But when I attach a text file that contains characters like (Å, Ä or Ö) these characters gets like (A, A and ?) when I recieve the mail to my mail client. When I look at the file on the disk before I attach it the characters is OK but when I attach the file and mails it the characters get replaced. So why does the charaters get messed up when I attach the file to a mail??
My procedure looks like this:
procedure mail_files(from_name varchar2,
to_name varchar2,
subject varchar2,
message varchar2,
max_size number default 9999999999,
filename1 varchar2 default null,
filename2 varchar2 default null,
filename3 varchar2 default null,
debug number default 0) is
mottagare VARCHAR2(2048) := to_name;
v_smtp_server varchar2(32) := 'mail.telia.se';
v_smtp_server_port number := 25;
v_directory_name varchar2(100);
v_file_name varchar2(100);
v_line varchar2(1000);
crlf varchar2(2) := chr(13) || chr(10);
mesg varchar2(32767);
conn UTL_SMTP.CONNECTION;
type varchar2_table is table of varchar2(200) index by binary_integer;
file_array varchar2_table;
i binary_integer;
v_file_handle utl_file.file_type;
v_slash_pos number;
mesg_len number;
mesg_too_long exception;
invalid_path exception;
mesg_length_exceeded boolean := false;
begin
-- first load the three filenames into an array for easier handling later ...
file_array(1) := filename1;
file_array(2) := filename2;
file_array(3) := filename3;
-- Open the SMTP connection ...
conn := utl_smtp.open_connection(v_smtp_server, v_smtp_server_port);
-- Initial handshaking ...
utl_smtp.helo(conn, v_smtp_server);
utl_smtp.mail(conn, from_name);
WHILE (mottagare IS NOT NULL) LOOP
utl_smtp.rcpt(conn, get_element(mottagare));
END LOOP;
--utl_smtp.rcpt( conn, to_name );
utl_smtp.open_data(conn);
-- build the start of the mail message ...
mesg := 'Date: ' || TO_CHAR(SYSDATE, 'dd Mon yy hh24:mi:ss') || crlf ||
'From: ' || from_name || crlf || 'Subject: ' || subject || crlf ||
'To: ' || to_name || crlf || 'Mime-Version: 1.0' || crlf ||
'Content-Type: multipart/mixed; boundary="DMW.Boundary.605592468"' || crlf || '' || crlf ||
'This is a Mime message, which your current mail reader may not' || crlf ||
'understand. Parts of the message will appear as text. If the remainder' || crlf ||
'appears as random characters in the message body, instead of as' || crlf ||
'attachments, then you''ll have to extract these parts and decode them' || crlf ||
'manually.' || crlf || '' || crlf ||
'--DMW.Boundary.605592468' || crlf ||
'Content-Type: text/html; charset=8859-1' || crlf ||
'Content-Disposition: inline;' || crlf ||
'Content-Transfer-Encoding: 8bit' || crlf || '' || crlf ||
message || crlf;
mesg_len := length(mesg);
if mesg_len > max_size then
mesg_length_exceeded := true;
end if;
utl_smtp.write_data(conn, mesg);
--utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(mesg));
-- Append the files ...
for i in 1 .. 3 loop
-- Exit if message length already exceeded ...
exit when mesg_length_exceeded;
-- If the filename has been supplied ...
if file_array(i) is not null then
begin
-- locate the final '/' or '\' in the pathname ...
v_slash_pos := instr(file_array(i), '/', -1);
if v_slash_pos = 0 then
v_slash_pos := instr(file_array(i), '\', -1);
end if;
-- separate the filename from the directory name ...
v_directory_name := substr(file_array(i), 1, v_slash_pos - 1);
v_file_name := substr(file_array(i), v_slash_pos + 1);
-- open the file ...
v_file_handle := utl_file.fopen(v_directory_name, v_file_name, 'r');
-- generate the MIME boundary line ...
mesg := crlf || '--DMW.Boundary.605592468' || crlf ||
'Content-Type: application/octet-stream; name="' ||
v_file_name || '"' || crlf ||
'Content-Disposition: attachment; filename="' ||
v_file_name || '"' || crlf ||
'Content-Transfer-Encoding: 8bit' || crlf || crlf;
mesg_len := mesg_len + length(mesg);
utl_smtp.write_data(conn, mesg);
-- and append the file contents to the end of the message ...
loop
utl_file.get_line(v_file_handle, v_line);
if mesg_len + length(v_line) > max_size then
mesg := '*** truncated ***' || crlf;
utl_smtp.write_data(conn, mesg);
mesg_length_exceeded := true;
raise mesg_too_long;
end if;
mesg := v_line || crlf;
utl_smtp.write_data(conn, mesg);
mesg_len := mesg_len + length(mesg);
end loop;
exception
when utl_file.invalid_path then
-- All other exceptions are ignored ....
when others then
null;
end;
mesg := crlf;
utl_smtp.write_data(conn, mesg);
-- close the file ...
utl_file.fclose(v_file_handle);
end if;
end loop;
-- append the final boundary line ...
mesg := crlf || '--DMW.Boundary.605592468--' || crlf;
utl_smtp.write_data(conn, mesg);
-- and close the SMTP connection ...
utl_smtp.close_data(conn);
utl_smtp.quit(conn);
end;
Any help is highly appreciated.
Regards
NilsHi Madhu,
Using the default modules PayloadSwapBean and MessageTransformBean you can able to send multiple attachments.
swap.keyName :payload-name or payload-description or content-type, content-description. swap.keyValue: If you have a multiple attachments then give the multiple key value.
Like you have payload name
Attachment1, Attachment2 then
swap.keyName payload-name
swap.keyValue Attachment1, Attachment2
Using the MessageTransformBean you can able to change the file name.
PayloadSwapBean:
[http://help.sap.com/saphelp_nw70/helpdata/EN/2e/bf37423cf7ab04e10000000a1550b0/content.htm]
MessageTransformBean:
[http://help.sap.com/saphelp_nw70/helpdata/EN/57/0b2c4142aef623e10000000a155106/content.htm]
Regards,
Prakasu -
Sending mail without attachment file
Hi Sapfans:
I would like to send mail without attachment file, just a notice,
needing multiple receiver, can change the mail title,
Which function shoud I use?
I just found out sending mail with attachment file there,
Thanks a lot!Hi Alchie,
Please take a look at my example below. It sens e-mail to multiple recipients without attachments.
FUNCTION-POOL zts0001 MESSAGE-ID sv.
INCLUDE lsvimdat . "general data decl.
INCLUDE lzts0001t00 . "view rel. data dcl.
*/ Author: Aris Hidalgo
*/ Created on: September 7, 2006
*/ Purpose of program: This will send out e-mails to specified users in
*/ custom table ZSHIPTO_EMAIL whenever records have been deleted or
*/ modified via the maintenance view of ZTS0001. The changes will also
*/ be reflected in custom table ZTS_STPGEOLOC.
TABLES: zts_stpgeoloc,
zshipto_email,
kna1.
FIELD-SYMBOLS: <fs_old_total> TYPE ANY.
* CLASS lcl_main DEFINITION ABSTRACT
CLASS lcl_main DEFINITION ABSTRACT.
PUBLIC SECTION.
TYPES: BEGIN OF t_zts0001_old,
kunnr TYPE zts0001-kunnr,
cdseq TYPE zts0001-cdseq,
zaddress TYPE zts0001-zaddress,
zcperson TYPE zts0001-zcperson,
zcnumber TYPE zts0001-zcnumber,
END OF t_zts0001_old.
TYPES: BEGIN OF t_zts0001_new,
kunnr TYPE zts0001-kunnr,
cdseq TYPE zts0001-cdseq,
zaddress TYPE zts0001-zaddress,
zcperson TYPE zts0001-zcperson,
zcnumber TYPE zts0001-zcnumber,
END OF t_zts0001_new.
TYPES: BEGIN OF t_zts_stpgeoloc,
kunnr TYPE zts_stpgeoloc-kunnr,
cdseq TYPE zts_stpgeoloc-cdseq,
zaddress TYPE zts_stpgeoloc-zaddress,
zcperson TYPE zts_stpgeoloc-zcperson,
zcnumber TYPE zts_stpgeoloc-zcnumber,
END OF t_zts_stpgeoloc.
TYPES: BEGIN OF t_del_entries,
kunnr TYPE zts0001-kunnr,
cdseq TYPE zts0001-cdseq,
zaddress TYPE zts0001-zaddress,
zcperson TYPE zts0001-zcperson,
zcnumber TYPE zts0001-zcnumber,
name1 TYPE kna1-name1,
END OF t_del_entries.
TYPES: BEGIN OF t_modified_entries,
kunnr TYPE zts0001-kunnr,
cdseq TYPE zts0001-cdseq,
old_address TYPE zts0001-zaddress,
new_address TYPE zts0001-zaddress,
old_person TYPE zts0001-zcperson,
new_person TYPE zts0001-zcperson,
old_number TYPE zts0001-zcnumber,
new_number TYPE zts0001-zcnumber,
name1 TYPE kna1-name1,
END OF t_modified_entries.
DATA: gt_zts0001_old TYPE STANDARD TABLE OF t_zts0001_old,
gt_zts0001_new TYPE HASHED TABLE OF t_zts0001_new
WITH UNIQUE KEY kunnr cdseq,
gt_zts_stpgeoloc TYPE STANDARD TABLE OF t_zts_stpgeoloc,
gt_del_entries TYPE STANDARD TABLE OF t_del_entries,
gt_modified_entries TYPE STANDARD TABLE OF t_modified_entries,
gt_zshipto_email TYPE STANDARD TABLE OF zshipto_email,
t_maildata TYPE sodocchgi1,
gt_mailtxt TYPE STANDARD TABLE OF solisti1,
gt_mailrec TYPE STANDARD TABLE OF somlreci1.
DATA: v_old_total TYPE i,
v_new_total TYPE i,
v_flag(1) TYPE c,
v_counter(1) TYPE c,
v_contents(255) TYPE c.
ENDCLASS.
* CLASS lcl_get_old_recs DEFINITION
CLASS lcl_get_old_recs DEFINITION INHERITING FROM lcl_main.
PUBLIC SECTION.
METHODS: export_old_recs.
ENDCLASS.
* CLASS lcl_get_old_recs IMPLEMENTATION
CLASS lcl_get_old_recs IMPLEMENTATION.
METHOD export_old_recs.
SELECT kunnr cdseq zaddress zcperson zcnumber
FROM zts0001
INTO TABLE gt_zts0001_old.
v_old_total = sy-dbcnt.
ASSIGN v_old_total TO <fs_old_total>.
EXPORT gt_zts0001_old = gt_zts0001_old TO MEMORY ID 'AVH'.
CLEAR gt_zts0001_old. REFRESH gt_zts0001_old.
ENDMETHOD.
ENDCLASS.
* CLASS lcl_old_and_new DEFINITION
CLASS lcl_old_and_new DEFINITION INHERITING FROM lcl_main.
PUBLIC SECTION.
METHODS: compare_old_and_new.
ENDCLASS.
* CLASS lcl_old_and_new IMPLEMENTATION
CLASS lcl_old_and_new IMPLEMENTATION.
METHOD compare_old_and_new.
DATA: wa_del_entries LIKE LINE OF gt_del_entries.
FIELD-SYMBOLS: <fs_old> LIKE LINE OF gt_zts0001_old,
<fs_new> LIKE LINE OF gt_zts0001_new.
SELECT kunnr cdseq zaddress zcperson zcnumber
FROM zts0001
INTO TABLE gt_zts0001_new.
v_new_total = sy-dbcnt.
IF v_new_total <> <fs_old_total>.
IMPORT gt_zts0001_old = gt_zts0001_old FROM MEMORY ID 'AVH'.
LOOP AT gt_zts0001_old ASSIGNING <fs_old>.
READ TABLE gt_zts0001_new WITH TABLE KEY kunnr = <fs_old>-kunnr
cdseq = <fs_old>-cdseq
ASSIGNING <fs_new>.
IF sy-subrc <> 0.
MOVE-CORRESPONDING <fs_old> TO wa_del_entries.
APPEND wa_del_entries TO gt_del_entries.
CLEAR wa_del_entries.
DELETE FROM zts_stpgeoloc
WHERE kunnr = <fs_old>-kunnr
AND cdseq = <fs_old>-cdseq.
ENDIF.
ENDLOOP.
IF NOT gt_del_entries[] IS INITIAL.
EXPORT gt_del_entries = gt_del_entries TO MEMORY ID 'DEL'.
ENDIF.
REFRESH gt_zts0001_old.
ENDIF.
ENDMETHOD.
ENDCLASS.
* CLASS lcl_check_changes DEFINITION
CLASS lcl_check_changes DEFINITION INHERITING FROM lcl_main.
PUBLIC SECTION.
METHODS: check_for_changes.
ENDCLASS.
* CLASS lcl_check_changes IMPLEMENTATION
CLASS lcl_check_changes IMPLEMENTATION.
METHOD check_for_changes.
TYPES: BEGIN OF t_zts_stpgeoloc,
mandt TYPE zts_stpgeoloc-mandt,
kunnr TYPE zts_stpgeoloc-kunnr,
cdseq TYPE zts_stpgeoloc-cdseq,
zcgeoloc TYPE zts_stpgeoloc-zcgeoloc,
zaddress TYPE zts_stpgeoloc-zaddress,
zcperson TYPE zts_stpgeoloc-zcperson,
zcnumber TYPE zts_stpgeoloc-zcnumber,
END OF t_zts_stpgeoloc.
DATA: wa_modified_entries LIKE LINE OF gt_modified_entries,
lt_zts_stpgeoloc TYPE HASHED TABLE OF t_zts_stpgeoloc
WITH UNIQUE KEY kunnr cdseq,
wa_zts_stpgeoloc LIKE LINE OF lt_zts_stpgeoloc.
FIELD-SYMBOLS: <fs_zts0001_old> LIKE LINE OF gt_zts0001_old,
<fs_zts0001_new> LIKE LINE OF gt_zts0001_new.
IMPORT gt_zts0001_old = gt_zts0001_old FROM MEMORY ID 'AVH'.
SELECT kunnr cdseq zcgeoloc zaddress zcperson zcnumber
FROM zts_stpgeoloc
INTO CORRESPONDING FIELDS OF TABLE lt_zts_stpgeoloc.
SELECT kunnr cdseq zaddress zcperson zcnumber
FROM zts0001
INTO TABLE gt_zts0001_new.
LOOP AT gt_zts0001_old ASSIGNING <fs_zts0001_old>.
READ TABLE gt_zts0001_new WITH TABLE KEY
kunnr = <fs_zts0001_old>-kunnr
cdseq = <fs_zts0001_old>-cdseq
ASSIGNING <fs_zts0001_new>.
IF sy-subrc = 0.
READ TABLE lt_zts_stpgeoloc WITH TABLE KEY
kunnr = <fs_zts0001_new>-kunnr
cdseq = <fs_zts0001_new>-cdseq
INTO wa_zts_stpgeoloc.
IF sy-subrc = 0.
wa_zts_stpgeoloc-mandt = sy-mandt.
wa_zts_stpgeoloc-kunnr = <fs_zts0001_new>-kunnr.
wa_zts_stpgeoloc-cdseq = <fs_zts0001_new>-cdseq.
wa_zts_stpgeoloc-zcgeoloc = space.
wa_zts_stpgeoloc-zaddress = <fs_zts0001_new>-zaddress.
wa_zts_stpgeoloc-zcperson = <fs_zts0001_new>-zcperson.
wa_zts_stpgeoloc-zcnumber = <fs_zts0001_new>-zcnumber.
MODIFY zts_stpgeoloc FROM wa_zts_stpgeoloc.
COMMIT WORK AND WAIT.
ENDIF.
* address
IF <fs_zts0001_old>-zaddress <> <fs_zts0001_new>-zaddress.
MOVE: <fs_zts0001_new>-kunnr TO wa_modified_entries-kunnr,
<fs_zts0001_new>-cdseq TO wa_modified_entries-cdseq,
<fs_zts0001_old>-zaddress TO wa_modified_entries-old_address,
<fs_zts0001_new>-zaddress TO wa_modified_entries-new_address.
v_flag = 1.
ENDIF.
* person
IF <fs_zts0001_old>-zcperson <> <fs_zts0001_new>-zcperson.
MOVE: <fs_zts0001_new>-kunnr TO wa_modified_entries-kunnr,
<fs_zts0001_new>-cdseq TO wa_modified_entries-cdseq,
<fs_zts0001_old>-zcperson TO wa_modified_entries-old_person,
<fs_zts0001_new>-zcperson TO wa_modified_entries-new_person.
v_flag = 1.
ENDIF.
* number
IF <fs_zts0001_old>-zcnumber <> <fs_zts0001_new>-zcnumber.
MOVE: <fs_zts0001_new>-kunnr TO wa_modified_entries-kunnr,
<fs_zts0001_new>-cdseq TO wa_modified_entries-cdseq,
<fs_zts0001_old>-zcnumber TO wa_modified_entries-old_number,
<fs_zts0001_new>-zcnumber TO wa_modified_entries-new_number.
v_flag = 1.
ENDIF.
ENDIF.
IF v_flag = 1.
APPEND wa_modified_entries TO gt_modified_entries.
CLEAR wa_modified_entries.
ENDIF.
* update ZTS_STPGEOLOC based from the modified records in ZTS0001
IF v_flag = 1.
CLEAR v_flag.
UPDATE zts_stpgeoloc SET zaddress = <fs_zts0001_new>-zaddress
zcperson = <fs_zts0001_new>-zcperson
zcnumber = <fs_zts0001_new>-zcnumber
WHERE kunnr = <fs_zts0001_new>-kunnr
AND cdseq = <fs_zts0001_new>-cdseq.
ENDIF.
ENDLOOP.
IF NOT gt_modified_entries[] IS INITIAL.
EXPORT gt_modified_entries = gt_modified_entries TO MEMORY ID 'MOD'
ENDIF.
ENDMETHOD.
ENDCLASS.
* CLASS lcl_messages DEFINITION
CLASS lcl_messages DEFINITION INHERITING FROM lcl_main.
PUBLIC SECTION.
METHODS: create_message.
ENDCLASS.
* CLASS lcl_messages IMPLEMENTATION
CLASS lcl_messages IMPLEMENTATION.
METHOD create_message.
FIELD-SYMBOLS: <fs_email> LIKE LINE OF gt_zshipto_email,
<fs_del> LIKE LINE OF gt_del_entries,
<fs_mod> LIKE LINE OF gt_modified_entries.
DATA: wa_mailtxt LIKE LINE OF gt_mailtxt,
wa_mailrec LIKE LINE OF gt_mailrec.
IMPORT gt_modified_entries = gt_modified_entries
FROM MEMORY ID 'MOD'.
IMPORT gt_del_entries = gt_del_entries FROM MEMORY ID 'DEL'.
SELECT * FROM zshipto_email INTO TABLE gt_zshipto_email
WHERE zevent = '2'.
IF sy-dbcnt > 0.
*/ routine for records that were deleted
IF NOT gt_del_entries[] IS INITIAL.
t_maildata-obj_name = 'Record Deleted in table ZTS0001'.
t_maildata-obj_descr = 'Record Deleted in table ZTS0001'.
t_maildata-obj_langu = sy-langu.
CLEAR: v_flag, v_counter.
LOOP AT gt_zshipto_email ASSIGNING <fs_email>.
LOOP AT gt_del_entries ASSIGNING <fs_del>.
* get name of dealer
SELECT SINGLE name1 FROM kna1
INTO <fs_del>-name1
WHERE kunnr = <fs_del>-kunnr.
IF v_counter IS INITIAL.
CONCATENATE: 'FYI: The ff record/s were deleted in tables'
'ZTS0001 and ZTS_STPGEOLOC by user' sy-uname
INTO v_contents
SEPARATED BY space.
wa_mailtxt-line = v_contents.
APPEND wa_mailtxt TO gt_mailtxt.
CLEAR: wa_mailtxt, v_contents.
ENDIF.
APPEND wa_mailtxt TO gt_mailtxt. "Extra space for message
CONCATENATE: 'Dealer :' <fs_del>-kunnr '-'
<fs_del>-name1
INTO v_contents
SEPARATED BY space.
wa_mailtxt-line = v_contents.
APPEND wa_mailtxt TO gt_mailtxt.
CLEAR: wa_mailtxt, v_contents.
CONCATENATE: 'Ship-To:' <fs_del>-cdseq
INTO v_contents
SEPARATED BY space.
wa_mailtxt-line = v_contents.
APPEND wa_mailtxt TO gt_mailtxt.
CLEAR: wa_mailtxt, v_contents.
CONCATENATE: 'Address:' <fs_del>-zaddress
INTO v_contents
SEPARATED BY space.
wa_mailtxt-line = v_contents.
APPEND wa_mailtxt TO gt_mailtxt.
CLEAR: wa_mailtxt, v_contents.
CONCATENATE: 'Contact person:' <fs_del>-zcperson
INTO v_contents
SEPARATED BY space.
wa_mailtxt-line = v_contents.
APPEND wa_mailtxt TO gt_mailtxt.
CLEAR: wa_mailtxt, v_contents.
CONCATENATE: 'Contact number:' <fs_del>-zcnumber
INTO v_contents
SEPARATED BY space.
wa_mailtxt-line = v_contents.
APPEND wa_mailtxt TO gt_mailtxt.
CLEAR: wa_mailtxt, v_contents.
v_counter = 1.
ENDLOOP.
wa_mailrec-receiver = <fs_email>-zemail.
wa_mailrec-rec_type = 'U'.
APPEND wa_mailrec TO gt_mailrec.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = t_maildata
document_type = 'RAW'
put_in_outbox = 'X'
* commit_work = 'X'
TABLES
* object_header = mailtxt
object_content = gt_mailtxt
receivers = gt_mailrec
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CLEAR: wa_mailtxt, wa_mailrec.
REFRESH: gt_mailtxt, gt_mailrec.
ENDLOOP.
ENDIF.
CLEAR wa_mailtxt.
REFRESH gt_mailtxt.
*/ routine for records that were modified
IF NOT gt_modified_entries[] IS INITIAL.
CLEAR t_maildata.
t_maildata-obj_name = 'Record changed in table ZTS0001'.
t_maildata-obj_descr = 'Record changed in table ZTS0001'.
t_maildata-obj_langu = sy-langu.
CLEAR v_counter.
LOOP AT gt_zshipto_email ASSIGNING <fs_email>.
CONCATENATE: 'FYI: The ff records were changed in tables'
'ZTS0001 and ZTS_STPGEOLOC by user' sy-uname
INTO v_contents
SEPARATED BY space.
wa_mailtxt-line = v_contents.
APPEND wa_mailtxt TO gt_mailtxt.
CLEAR: wa_mailtxt, v_contents.
LOOP AT gt_modified_entries ASSIGNING <fs_mod>.
* get name of dealer
SELECT SINGLE name1 FROM kna1
INTO <fs_mod>-name1
WHERE kunnr = <fs_mod>-kunnr.
APPEND wa_mailtxt TO gt_mailtxt.
CONCATENATE: 'Dealer :' <fs_mod>-kunnr '-'
<fs_mod>-name1
INTO v_contents
SEPARATED BY space.
wa_mailtxt-line = v_contents.
APPEND wa_mailtxt TO gt_mailtxt.
CLEAR: wa_mailtxt, v_contents.
CONCATENATE: 'Ship-To:' <fs_mod>-cdseq
INTO v_contents
SEPARATED BY space.
wa_mailtxt-line = v_contents.
APPEND wa_mailtxt TO gt_mailtxt.
CLEAR: wa_mailtxt, v_contents.
* address
IF NOT <fs_mod>-old_address IS INITIAL AND
NOT <fs_mod>-new_address IS INITIAL.
CONCATENATE: 'Address from:' <fs_mod>-old_address
INTO v_contents
SEPARATED BY space.
wa_mailtxt-line = v_contents.
APPEND wa_mailtxt TO gt_mailtxt.
CLEAR: wa_mailtxt, v_contents.
CONCATENATE: 'Address to :' <fs_mod>-new_address
INTO v_contents
SEPARATED BY space.
wa_mailtxt-line = v_contents.
APPEND wa_mailtxt TO gt_mailtxt.
CLEAR: wa_mailtxt, v_contents.
ENDIF.
* person
IF NOT <fs_mod>-old_person IS INITIAL AND
NOT <fs_mod>-new_person IS INITIAL.
CONCATENATE: 'Contact person from:'
<fs_mod>-old_person
INTO v_contents
SEPARATED BY space.
wa_mailtxt-line = v_contents.
APPEND wa_mailtxt TO gt_mailtxt.
CLEAR: wa_mailtxt, v_contents.
CONCATENATE: 'Contact person to :'
<fs_mod>-new_person
INTO v_contents
SEPARATED BY space.
wa_mailtxt-line = v_contents.
APPEND wa_mailtxt TO gt_mailtxt.
CLEAR: wa_mailtxt, v_contents.
ENDIF.
* number
IF NOT <fs_mod>-old_number IS INITIAL AND
NOT <fs_mod>-new_number IS INITIAL.
CONCATENATE: 'Contact number from:'
<fs_mod>-old_number
INTO v_contents
SEPARATED BY space.
wa_mailtxt-line = v_contents.
APPEND wa_mailtxt TO gt_mailtxt.
CLEAR: wa_mailtxt, v_contents.
CONCATENATE: 'Contact number to :'
<fs_mod>-new_number
INTO v_contents
SEPARATED BY space.
wa_mailtxt-line = v_contents.
APPEND wa_mailtxt TO gt_mailtxt.
CLEAR: wa_mailtxt, v_contents.
ENDIF.
ENDLOOP.
wa_mailrec-receiver = <fs_email>-zemail.
wa_mailrec-rec_type = 'U'.
APPEND wa_mailrec TO gt_mailrec.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = t_maildata
document_type = 'RAW'
put_in_outbox = 'X'
* commit_work = 'X'
TABLES
* object_header = mailtxt
object_content = gt_mailtxt
receivers = gt_mailrec
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CLEAR: wa_mailtxt, wa_mailrec.
REFRESH: gt_mailtxt, gt_mailrec.
ENDLOOP.
ENDIF.
ENDIF.
FREE MEMORY ID 'AVH'.
FREE MEMORY ID 'DEL'.
FREE MEMORY ID 'MOD'.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
* FORM get_orig_contents_of_zts0001 *
*/ before saving the data in the database
FORM get_orig_contents_of_zts0001.
DATA: get_old_recs TYPE REF TO lcl_get_old_recs.
CREATE OBJECT get_old_recs.
CALL METHOD get_old_recs->export_old_recs.
ENDFORM.
* FORM get_rev_contents_of_zts0001 *
*/ after saving the data in the database
FORM get_rev_contents_of_zts0001.
DATA: old_and_new TYPE REF TO lcl_old_and_new,
check_changes TYPE REF TO lcl_check_changes,
messages TYPE REF TO lcl_messages.
CREATE OBJECT: old_and_new, check_changes, messages.
CALL METHOD old_and_new->compare_old_and_new.
CALL METHOD check_changes->check_for_changes.
CALL METHOD messages->create_message.
ENDFORM.
* FORM move_latest_date_and_user *
FORM move_latest_date_and_user.
zts0001-zcreated_by = sy-uname.
zts0001-zchanged_date = sy-datum.
ENDFORM.
Hope it helps...
P.S. Please award points if it helps... -
How to Convert internal table data into text output and send mail in ABAP
Hi All,
Good Morning.
Taking a glance at a code that converts internal table data to an Excel file in ABAP. also checked how to send this excel to mailing list as attachment.
But thought of doing it without excel.
I mean, I have an internal table which contains fields of all types (character,integer,date,time). Since it is only around 4 to 5 rows in it (output),why to convert it to excel. not required!!. Instead I want to send this output to User's mails as Normal mail body with No attachments.
Could anybody please suggest me a way as to how to send internal table data as a mail ( not as an excel or PDF etc).
as of now my findings are, it is quite complex to convert internal table data to email (Text) format. but i believe if there is some way of doing it.
Best Regards
Dileep VThere's something I have used in the past where we send out information about failed precalculation settings (which are stored in internal table gt_fail)
notice we use gt_text as "mail body"
TRY.
* -------- create persistent send request ------------------------
gv_send_request = cl_bcs=>create_persistent( ).
* -------- create and set document -------------------------------
* create text to be sent
wa_line = text-001.
APPEND wa_line TO gt_text.
CLEAR wa_line.
APPEND wa_line TO gt_text.
LOOP AT gt_fail ASSIGNING <fs_fail>.
MOVE <fs_fail>-retry_count TO gv_count.
CONCATENATE text-002
<fs_fail>-setting_id
text-003
gv_count
INTO wa_line SEPARATED BY space.
APPEND wa_line TO gt_text.
CLEAR wa_line.
ENDLOOP.
APPEND wa_line TO gt_text.
wa_line = text-007.
APPEND wa_line TO gt_text.
* create actual document
gv_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = gt_text
i_length = '12'
i_subject = 'Failed Precalculation Settings!' ).
* add document to send request
CALL METHOD gv_send_request->set_document( gv_document ).
* --------- set sender -------------------------------------------
gv_sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD gv_send_request->set_sender
EXPORTING
i_sender = gv_sender.
* --------- add recipient (e-mail address) -----------------------
LOOP AT s_email INTO wa_email.
MOVE wa_email-low TO gv_email.
gv_recipient = cl_cam_address_bcs=>create_internet_address(
gv_email ).
CALL METHOD gv_send_request->add_recipient
EXPORTING
i_recipient = gv_recipient
i_express = 'X'.
ENDLOOP.
* ---------- set to send immediately -----------------------------
CALL METHOD gv_send_request->set_send_immediately( 'X' ).
* ---------- send document ---------------------------------------
CALL METHOD gv_send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = gv_sent_to_all ).
IF gv_sent_to_all = 'X'.
WRITE text-004.
ENDIF.
COMMIT WORK.
* exception handling
CATCH cx_bcs INTO gv_bcs_exception.
WRITE: text-005.
WRITE: text-006, gv_bcs_exception->error_type.
EXIT.
ENDTRY.
with the following declarations
* TABLES *
TABLES:
adr6,
rsr_prec_sett.
* INTERNAL TABLES & WORK AREAS *
DATA:
gt_fail TYPE SORTED TABLE OF rsr_prec_sett
WITH UNIQUE KEY setting_id run_date,
gt_text TYPE bcsy_text,
wa_fail LIKE LINE OF gt_fail,
wa_line(90) TYPE c.
FIELD-SYMBOLS:
<fs_fail> LIKE LINE OF gt_fail.
* VARIABLES *
DATA:
gv_count(4) TYPE n,
gv_send_request TYPE REF TO cl_bcs,
gv_document TYPE REF TO cl_document_bcs,
gv_sender TYPE REF TO cl_sapuser_bcs,
gv_recipient TYPE REF TO if_recipient_bcs,
gv_email TYPE adr6-smtp_addr,
gv_bcs_exception TYPE REF TO cx_bcs,
gv_sent_to_all TYPE os_boolean.
* SELECTION-SCREEN *
SELECT-OPTIONS:
s_email FOR adr6-smtp_addr NO INTERVALS MODIF ID sel.
DATA:
wa_email LIKE LINE OF s_email. -
I have a VI and an attched .txt data file. Now I want to read the data from the .txt file and display it as an array in the front panel. But the result is not right. Any help?
Attachments:
try2.txt 2 KB
read_array.vi 21 KBThe problem is in the delimiters in your text file. By default, Read From Spreadsheet File.vi expects a tab delimited file. You can specify a delimiter (like a space), but Read From Spreadsheet File.vi has a problem with repeated delimiters: if you specify a single space as a delimiter and Read From Spreadsheet File.vi finds two spaces back-to-back, it stops reading that line. Your file (as I got it from your earlier post) is delimited by 4 spaces.
Here are some of your choices to fix your problem.
1. Change the source file to a tab delimited file. Your VI will then run as is.
2. Change the source file to be delimited by a single space (rather than 4), then wire a string constant containing one space to the delimiter input of Read From Spreadsheet File.vi.
3. Wire a string constant containing 4 spaces to the delimiter input of Read From Spreadsheet File.vi. Then your text file will run as is.
Depending on where your text file comes from (see more comments below), I'd vote for choice 1: a tab delimited text file. It's the most common text output of spreadsheet programs.
Comments for choices 1 and 2: Where does the text file come from? Is it automatically generated or manually generated? Will it be generated multiple times or just once? If it's manually generated or generated just once, you can use any text editor to change 4 spaces to a tab or to a single space. Note: if you want to change it to a tab delimited file, you can't enter a tab directly into a box in the search & replace dialog of many programs like notepad, but you can do a cut and paste. Before you start your search and replace (just in the text window of the editor), press tab. A tab character will be entered. Press Shift-LeftArrow (not Backspace) to highlight the tab character. Press Ctrl-X to cut the tab character. Start your search and replace (Ctrl-H in notepad in Windows 2000). Click into the Find What box. Enter four spaces. Click into the Replace With box. Press Ctrl-V to paste the tab character. And another thing: older versions of notepad don't have search and replace. Use any editor or word processor that does. -
Can I use Bridge to export image data into a .txt file?
I have a folder of images and I would like to export the File Name, Resolution, Dimensions and Color Mode for each file into one text file. Can I use Bridge to export image data into a .txt file?
Hello
You may try the following AppleScript script. It will ask you to choose a root folder where to start searching for *.map files and then create a CSV file named "out.csv" on desktop which you may import to Excel.
set f to (choose folder with prompt "Choose the root folder to start searching")'s POSIX path
if f ends with "/" then set f to f's text 1 thru -2
do shell script "/usr/bin/perl -CSDA -w <<'EOF' - " & f's quoted form & " > ~/Desktop/out.csv
use strict;
use open IN => ':crlf';
chdir $ARGV[0] or die qq($!);
local $/ = qq(\\0);
my @ff = map {chomp; $_} qx(find . -type f -iname '*.map' -print0);
local $/ = qq(\\n);
# CSV spec
# - record separator is CRLF
# - field separator is comma
# - every field is quoted
# - text encoding is UTF-8
local $\\ = qq(\\015\\012); # CRLF
local $, = qq(,); # COMMA
# print column header row
my @dd = ('column 1', 'column 2', 'column 3', 'column 4', 'column 5', 'column 6');
print map { s/\"/\"\"/og; qq(\").$_.qq(\"); } @dd;
# print data row per each file
while (@ff) {
my $f = shift @ff; # file path
if ( ! open(IN, '<', $f) ) {
warn qq(Failed to open $f: $!);
next;
$f =~ s%^.*/%%og; # file name
@dd = ('', $f, '', '', '', '');
while (<IN>) {
chomp;
$dd[0] = \"$2/$1/$3\" if m%Link Time\\s+=\\s+([0-9]{2})/([0-9]{2})/([0-9]{4})%o;
($dd[2] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of CODE\\s/o;
($dd[3] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of DATA\\s/o;
($dd[4] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of XDATA\\s/o;
($dd[5] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of FARCODE\\s/o;
last unless grep { /^$/ } @dd;
close IN;
print map { s/\"/\"\"/og; qq(\").$_.qq(\"); } @dd;
EOF
Hope this may help,
H -
Populate a table reading the data from a TXT file
how can I populate a table reading the data from a TXT file?
thanksHey Kevin!
Using FORMS.TEXT_IO to bulk load data from a file strikes me as re-inventing the wheel. It is just about justifiable in a self-service environment, but I regard the EXTERNAL TABLE is a better solution for that situation as well.
The same applies to UTL_FILE. I think the ability to read text with UTL_FILE is primarily intended for read file-based configuration or file manipulation/processing rather than data loading.
Re-writing a text file into SQL statements is too much like hard work (even with an editor that supports macro definition and regular expressions) for no real benefit. You lose all the bulk load peformance you would get from SQL*Loader. But for QAD I'd probably let you off with it.
You missed out one obvious alternative: using Java to turn the contents of an XML file into a CLOB and inserting it into a table which is read by a PL/SQL procedure that parses the XML records and insert the retrieved data into a table.
Stay lucky, APC
Maybe you are looking for
-
All of my .pdf files were converted to a different company - not Adobe.
How can I convert my .pdf files back to Acrobat & Adobe ?
-
Interlaced in Windows but not on Mac
I have 4 QuickTime files which are interlaced DV25 but look soft and progressive when viewed in QT on a Mac. The files look fine when viewed on a PC, you can see the slightly jagged edge of the fields and the pictures look good. When the same files a
-
Hi, I would like to change the sort image on my reports (Ascending image and Descending image) when I switch themes. How can I acheive that since I cannot use a template ? Can I use a &item. variable in that field ?? Thanks Francis.
-
I am not able to connect to the apps server
I get an error code 1 when I attempt to log into the apps section from my printer. I talked to tech support and we checked everything. All is good except for getting into the apps section.
-
Delivery Header Text in SAP Query SQ01
Hi Friends, My requirement is that I need to display the Header Text contents in Outbound delivery in a Query report using SQ01. As far as I know, we can pull only table fields in SQ01. Is it possible to include Text contents in SAP Query? Can we dev