Attach txt file
begin
Gen_Ces_Mail.email_files('[email protected]' -- van adres
, '[email protected]' -- naar adres
, 'test mail' -- onderwerp
, 'message: test message' -- bericht
, cesFiles('/usr/lib/oracle/xe/app/oracle/admin/XE/dpdump/test.txt)
end;
Can anybody help me with this?
Error:
Error starting at line 1 in command:
begin
Gen_Ces_Mail.email_files('[email protected]' -- van adres
, '[email protected]' -- naar adres
, 'test mail' -- onderwerp
, 'message: test message' -- bericht
, cesFiles('/usr/lib/oracle/xe/app/oracle/admin/XE/dpdump/test.txt)
end;
Error report:
ORA-06550: line 6, column 46:
PLS-00103: Encountered the symbol "/usr/lib/oracle/xe/app/oracle/admin/XE/dpdump/test.txt)
" when expecting one of the following:
( ) - + case mod new not null others select <an identifier>
<a double-quoted delimited-identifier> <a bind variable>
table avg count current exists max min prior sql stddev sum
variance execute multiset the both leading trailing forall
merge year month DAY_ hour minute second timezone_hour
timezone_minute timezone_region timezone_abbr time timestamp
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
regards,
Kasban.E
create or replace PACKAGE GEN_CES_MAIL AS
PROCEDURE email_files(from_name VARCHAR2,
to_names VARCHAR2,
subject VARCHAR2,
message VARCHAR2 DEFAULT '',
html_message VARCHAR2 DEFAULT '',
cc_names VARCHAR2 DEFAULT NULL,
bcc_names VARCHAR2 DEFAULT NULL,
attach cesFiles,
clob_attach cesCLOBs DEFAULT NULL,
blob_attach cesBLOBs DEFAULT NULL);
PROCEDURE email_files(from_name VARCHAR2,
to_names VARCHAR2,
subject VARCHAR2,
message CLOB,
html_message VARCHAR2 DEFAULT '',
cc_names VARCHAR2 DEFAULT NULL,
bcc_names VARCHAR2 DEFAULT NULL,
attach cesFiles,
clob_attach cesCLOBs DEFAULT NULL,
blob_attach cesBLOBs DEFAULT NULL);
PROCEDURE email_files(from_name VARCHAR2,
to_names VARCHAR2,
subject VARCHAR2,
message VARCHAR2 DEFAULT '',
html_message CLOB,
cc_names VARCHAR2 DEFAULT NULL,
bcc_names VARCHAR2 DEFAULT NULL,
attach cesFiles,
clob_attach cesCLOBs DEFAULT NULL,
blob_attach cesBLOBs DEFAULT NULL);
PROCEDURE email_files(from_name VARCHAR2,
to_names VARCHAR2,
subject VARCHAR2,
message CLOB,
html_message CLOB,
cc_names VARCHAR2 DEFAULT NULL,
bcc_names VARCHAR2 DEFAULT NULL,
attach cesFiles,
clob_attach cesCLOBs DEFAULT NULL,
blob_attach cesBLOBs DEFAULT NULL);
PROCEDURE email_files(from_name VARCHAR2,
to_names VARCHAR2,
subject VARCHAR2,
message VARCHAR2 DEFAULT '',
html_message VARCHAR2 DEFAULT '',
cc_names VARCHAR2 DEFAULT NULL,
bcc_names VARCHAR2 DEFAULT NULL,
attach cesCLOBs);
PROCEDURE email_files(from_name VARCHAR2,
to_names VARCHAR2,
subject VARCHAR2,
message CLOB,
html_message VARCHAR2 DEFAULT '',
cc_names VARCHAR2 DEFAULT NULL,
bcc_names VARCHAR2 DEFAULT NULL,
attach cesCLOBs);
PROCEDURE email_files(from_name VARCHAR2,
to_names VARCHAR2,
subject VARCHAR2,
message VARCHAR2 DEFAULT '',
html_message CLOB,
cc_names VARCHAR2 DEFAULT NULL,
bcc_names VARCHAR2 DEFAULT NULL,
attach cesCLOBs);
PROCEDURE email_files(from_name VARCHAR2,
to_names VARCHAR2,
subject VARCHAR2,
message CLOB,
html_message CLOB,
cc_names VARCHAR2 DEFAULT NULL,
bcc_names VARCHAR2 DEFAULT NULL,
attach cesCLOBs);
PROCEDURE email_files(from_name VARCHAR2,
to_names VARCHAR2,
subject VARCHAR2,
message VARCHAR2 DEFAULT '',
html_message VARCHAR2 DEFAULT '',
cc_names VARCHAR2 DEFAULT NULL,
bcc_names VARCHAR2 DEFAULT NULL,
attach cesBLOBs);
PROCEDURE email_files(from_name VARCHAR2,
to_names VARCHAR2,
subject VARCHAR2,
message CLOB,
html_message VARCHAR2 DEFAULT '',
cc_names VARCHAR2 DEFAULT NULL,
bcc_names VARCHAR2 DEFAULT NULL,
attach cesBLOBs);
PROCEDURE email_files(from_name VARCHAR2,
to_names VARCHAR2,
subject VARCHAR2,
message VARCHAR2 DEFAULT '',
html_message CLOB,
cc_names VARCHAR2 DEFAULT NULL,
bcc_names VARCHAR2 DEFAULT NULL,
attach cesBLOBs);
PROCEDURE email_files(from_name VARCHAR2,
to_names VARCHAR2,
subject VARCHAR2,
message CLOB,
html_message CLOB,
cc_names VARCHAR2 DEFAULT NULL,
bcc_names VARCHAR2 DEFAULT NULL,
attach cesBLOBs);
PROCEDURE email_files(from_name VARCHAR2,
to_names VARCHAR2,
subject VARCHAR2,
message VARCHAR2 DEFAULT '',
html_message VARCHAR2 DEFAULT '',
cc_names VARCHAR2 DEFAULT NULL,
bcc_names VARCHAR2 DEFAULT NULL,
filename1 VARCHAR2 DEFAULT NULL,
filetype1 VARCHAR2 DEFAULT 'text/plain',
filename2 VARCHAR2 DEFAULT NULL,
filetype2 VARCHAR2 DEFAULT 'text/plain',
filename3 VARCHAR2 DEFAULT NULL,
filetype3 VARCHAR2 DEFAULT 'text/plain');
END GEN_CES_MAIL;
Similar Messages
-
Attached txt file is displayed with sapoffice intead of notepad
Hi,
i´ve developed a bsp page that uploads files using fm SO_DOCUMENT_INSERT_API1.
When i try to display a txt file uploaded as above explained (with transaction FB03) the document is displayed with sapoffice and not with notepad as i expected.
Why is this hapenning?
What do i have to do so that a txt file is opened with notepad?
i´m able to upload a pdf and display it afterwards in fb03 with acrobat reader.
i´m able to upload a doc and display it afterwards in fb03 with msword.
but with a txt file it does not work.
Best regards.
Edited by: Pablo Casamayor on Nov 19, 2011 12:02 PMYou should be doing something like this to open a text file in Notepad:
Message Edited by smercurio_fc on 09-12-2007 01:07 PM
Attachments:
Example_BD.png 2 KB -
Email attachment with .txt file (first line blank in the file)
Hi all ,
Iam trying attach .txt file to email , the file that iam accessing from server . But first line blank (extra) even though i dont have blank line in original file .Can any help me out to resolve this issue?
<u>Example</u> original file
12345 aa pq
<u>Email attachment file</u>
-> This line
12345 aa pq
This is my code:
REPORT ZTEST_FILE .
DATA:BEGIN OF t_upload occurs 0,
matnr LIKE zwplcsmev-matnr,
zwgehrrg LIKE zwplcsmev-zwgehrrg,
zwgehrct LIKE zwplcsmev-zwgehrct,
zwgbev LIKE zwplcsmev-zwgbev,
zwpldt LIKE zwplcsmev-zwpldt,
zwacdt LIKE zwplcsmev-zwacdt,
END OF t_upload.
*DATA: maildata type sodocchgi1.
*DATA: mailtxt type table of solisti1 with header line.
*DATA: mailrec type table of somlrec90 with header line.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA:REC(80) TYPE C.
DATA g_mask(20) TYPE c VALUE ',., ..'.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA:P_ERROR(3).
DATA:P_REFO(3).
DATA: gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1.
selection-screen begin of block b1 with frame title text-001.
parameters:p_file type localfile.
parameter:p_email type ad_smtpadr.
selection-screen end of block b1.
--At Selection-Screen- -
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'TB_LIMIT_WS_FILENAME_GET'
EXPORTING
def_filename = p_file
mask = g_mask
mode = 'S'
title = 'INPUT FILE'
IMPORTING
filename = p_file
EXCEPTIONS
selection_cancel = 1
selection_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
START-OF-SELECTION.
PERFORM process_file.
if p_error = 'X' AND P_REFO <> 'X'.
PERFORM populate_message_body.
ENDIF.
IF P_REFO = 'X' AND P_ERROR <> 'X'.
it_message = 'Please find Attached file'.
APPEND it_message.
PERFORM send_attachment tables it_message
it_attach
using p_email
'Crest to Plc Data'
'TXT'
p_file
changing gd_error
gd_reciever.
ENDIF.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
END-OF-SELECTION.
*& Form process_file
text
FORM process_file.
*CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE x VALUE '09'. "OK for non Unicode
DATA :l_path TYPE string.
l_path = p_file.
CONSTANTS: con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB
con_cret type c value cl_abap_char_utilities=>newline.
OPEN DATASET P_FILE FOR INPUT IN TEXT MODE encoding default.
if sy-subrc = 0.
do.
read dataset p_file into IT_ATTACH.
IF SY-SUBRC NE 0 .
EXIT.
ELSE.
T_UPLOAD = IT_ATTACH.
CONCATENATE con_cret it_attach INTO it_attach .
append it_attach.
clear it_attach.
P_REFO = 'X'.
APPEND T_UPLOAD .
clear t_upload.
ENDIF.
ENDDO.
else.
p_error = 'X'.
ENDIF.
ENDFORM. "process_file
*& Form populate_message_body
text
FORM populate_message_body.
w_doc_data-obj_name = 'TEST'.
w_doc_data-obj_descr = 'Crest to Plc Data'.
w_doc_data-obj_langu = sy-langu.
it_message = 'File Not Found'.
APPEND it_message.
t_receivers-receiver = p_email.
t_receivers-rec_type = 'U'.
append t_receivers.
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = w_doc_data
document_type = 'RAW'
put_in_outbox = 'X'
tables
object_header = it_message
object_content = 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.
if sy-subrc = 0.
commit work.
SUBMIT rsconn01 USING SELECTION-SET 'SAP&CONNECTINT' AND RETURN.
else.
MESSAGE s027(vv) WITH 'E-mail not sent'.
endif.
ENDFORM. "populate_message_body
*& Form send_attachment
text
FORM send_attachment tables pit_message
pit_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
w_doc_data-doc_size = 1.
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = pit_attach[].
clear t_attachment.
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
if sy-subrc = 0.
commit work.
SUBMIT rsconn01 USING SELECTION-SET 'SAP&CONNECTINT' AND RETURN.
else.
MESSAGE s027(vv) WITH 'E-mail not sent'.
endif.
Populate error return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM. "send_attachmentJust copy the code below and execute . I just checked and found the exact values on attachment with no blank lines. This is more simple than the one u have written , just include ur data upload logic . For ITAB values to be attached i have written a simple logic to retrive from EKPO. Just copy this code and execute. u will understand then.
I understand that ur initial requirement was to attach the file directly and not to upload and attach. If u still want to go for the old requirement then check out the code(2nd program of the two that i have sent) that i have sent u on ur previous post.
REPORT ZEMAIL_ATTACH .
TABLES: ekko.
PARAMETERS: p_email TYPE somlreci1-receiver
DEFAULT '[email protected]'.
TYPES: BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
aedat TYPE ekpo-aedat,
matnr TYPE ekpo-matnr,
END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,
wa_ekpo TYPE t_ekpo.
TYPES: BEGIN OF t_charekpo,
ebeln(10) TYPE c,
ebelp(5) TYPE c,
aedat(8) TYPE c,
matnr(18) TYPE c,
END OF t_charekpo.
DATA: wa_charekpo TYPE t_charekpo.
DATA: it_message TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0
WITH HEADER LINE.
DATA: t_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
t_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
t_attachment LIKE solisti1 OCCURS 0 WITH HEADER LINE,
t_object_header LIKE solisti1 OCCURS 0 WITH HEADER LINE,
w_cnt TYPE i,
w_sent_all(1) TYPE c,
w_doc_data LIKE sodocchgi1,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
*START_OF_SELECTION
START-OF-SELECTION.
Retrieve sample data from table ekpo
PERFORM data_retrieval.
Populate table with detaisl to be entered into .xls file
PERFORM build_TXT_data_table.
*END-OF-SELECTION
END-OF-SELECTION.
Populate message body text
perform populate_email_message_body.
Send file by email as .TXT speadsheet
PERFORM send_file_as_email_attachment
tables it_message
it_attach
using p_email
'Example .TXT documnet attachment'
'TXT'
'filename'
changing gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
SELECT ebeln ebelp aedat matnr
UP TO 10 ROWS
FROM ekpo
INTO TABLE it_ekpo.
ENDFORM. " DATA_RETRIEVAL
*& Form BUILD_TXT_DATA_TABLE
Build data table for .txt document
FORM build_txt_data_table.
CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
con_tab TYPE x VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
*constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB,
con_cret type c value cl_abap_char_utilities=>CR_LF.
CONCATENATE 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
INTO it_attach SEPARATED BY SPACE . "con_tab.
CONCATENATE con_cret it_attach INTO it_attach." Use this if req.
APPEND it_attach.
LOOP AT it_ekpo INTO wa_charekpo.
CONCATENATE wa_charekpo-ebeln wa_charekpo-ebelp
wa_charekpo-aedat wa_charekpo-matnr
INTO it_attach SEPARATED BY SPACE ."con_tab.
CONCATENATE con_cret it_attach INTO it_attach." Use this if req.
APPEND it_attach.
ENDLOOP.
ENDFORM. " BUILD_txt_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
FORM send_file_as_email_attachment tables pit_message
pit_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = pit_attach[].
Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
FORM initiate_mail_execute_program.
WAIT UP TO 2 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDFORM. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
form populate_email_message_body.
REFRESH it_message.
it_message = 'Please find attached a list test ekpo records'.
APPEND it_message.
endform. " POPULATE_EMAIL_MESSAGE_BODY
execute this code and i hope that will help u.
regards,
Barath. -
Hi everyone,
I need your help.
There are many threads on txt creation in that forum but I couldn't find the one that answers to my questions.
I'd like to create a txt containing one Header (FILE EDITOR, Time and Date) and ten columns of data. Every column should be preceded (on top) by the words COLUMN1 to COLUMN10.
The created file should also contain the time and date of creation.
Please see the attached files.
Best regards
Kabanga
Attachments:
Write_file.vi 44 KB
data.txt 2 KBHi guys,
Thanks for your help!
I did the modifications you advised me. It's working well:
Now I'd like the following: If make "SAVE" for the same file three times, I'd like it to be like in the attached txt file (data):
How can I implement it? I've tried it with "Set File Position" but it's not working.
Best regards
Kabanga
Attachments:
data.txt 4 KB
Write_file.vi 52 KB -
Convert .txt file into .xml file
Hello,
How do i convert an .txt file into an .xml file using labVIEW function?.
Also i do i extract the header from the text file.
My file format is mentioned in attached .txt file.
Also I need to extract the header from the converted .xml file.
Anticipating reply
Attachments:
Example.txt 1 KBThere is no automatic mechanism for converting a .txt file to XML in any language. You have to define the XML schema and then write the code to generate the XML file. You could also read in your text file into some form of structure and then use the Flatten to XML functions to use the NI XML schema. If you need to use your own XML schema then you would need to use the XML Parser VIs to generate your XML file. Alternatively, you could use LabXML or JKI's EasyXML Toolkit.
-
Cache creation hang on .txt file
I have 50+ sites defined.
This one directory hangs on site cache creation and
dreamweaver never gets past any file.
I thought it might have been a specific file, and have
removed one after another to discover it doesn't care what the file
is, it just fails to create a site on this directory, or anything
containing this directory.
I have checked permissions and am stumped by this.
Any ideas?Hi guys,
Thanks for your help!
I did the modifications you advised me. It's working well:
Now I'd like the following: If make "SAVE" for the same file three times, I'd like it to be like in the attached txt file (data):
How can I implement it? I've tried it with "Set File Position" but it's not working.
Best regards
Kabanga
Attachments:
data.txt 4 KB
Write_file.vi 52 KB -
Error with the data format in the TXT file, sending as an Email attachment
Hi all,
I have an problem in the data formating in the TXT file while sending as an attachment via an email by using the FM "SO_DOCUMENT_SEND_API1".
For eg:
The data in the TXT file is looking like as follows:
0 0 0 0 2 L O U D S P E A K R O T H E R 3 8 W h i t e 0 0
0031 L O U D S P E A K R O T H E R 3 8 Black 0 000
38 L O U D S P E A K R O T H E R 3 8 Brown 0 00040
L O U D S P E A K R O T H E R 3 8 Brown 0 00042
and so on
But it should come as :
0 0 0 0 2 L O U D S P E A K R O T H E R 3 8 W h i t e
0 0 0031 L O U D S P E A K R O T H E R 3 8 Black
0 00038 L O U D S P E A K R O T H E R 3 8 Brown
0 00040 L O U D S P E A K R O T H E R 3 8 Brown
All the internal tables are correctly filled.
The code is as follows:
gwa_objtxt = 'Please find attached DATA EXTRACT Sheet'.
append gwa_objtxt to git_objtxt.
describe table git_objtxt lines gv_cnt.
clear git_doc_data.
read table git_objtxt index gv_cnt.
git_doc_data-doc_size = ( gv_cnt - 1 ) * 255 + strlen( gwa_objtxt ).
git_doc_data-obj_langu = sy-langu.
git_doc_data-obj_descr = lv_mtitle.
append git_doc_data.
clear git_packing_list.
refresh git_packing_list.
git_packing_list-transf_bin = space.
git_packing_list-head_start = 1.
git_packing_list-head_num = 0.
git_packing_list-body_start = 1.
git_packing_list-body_num = gv_cnt.
git_packing_list-doc_type = 'RAW'.
append git_packing_list.
Clear : gv_cnt.
Describe table git_objbin lines gv_cnt.
git_packing_list-transf_bin = 'X'.
git_packing_list-head_start = 1.
git_packing_list-head_num = 1.
git_packing_list-body_start = 1.
git_packing_list-body_num = gv_cnt.
git_packing_list-doc_type = 'TXT'.
git_packing_list-obj_descr = 'ATTACH.TXT'.
git_packing_list-obj_name = 'book'.
git_packing_list-doc_size = gv_cnt * 255.
APPEND git_packing_list.
clear git_receivers.
refresh git_receivers.
git_receivers-receiver = gv_eid.
git_receivers-rec_type = 'U'.
append git_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = git_doc_data
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = git_packing_list
CONTENTS_BIN = git_objbin
CONTENTS_TXT = git_objtxt
RECEIVERS = git_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.please give the code of
contents bin = git_objbin " how this is getting populated.
0 0 0 0 2 L O U D S P E A K R O T H E R 3 8 W h i t e <b>0 0</b>
0031 L O U D S P E A K R O T H E R 3 8 Black
0 000
38
from this im not able to understand is this over population or concatenation problem
y dont u make a append to the final table
like
data : begin of itxt occurs 0, ,
s1(132) type c ,
end of itxt.
loop at itab.
itxt-s1+0(4) = itab-f1.
itxt-s1+4(6) = itab-f2.
itxt-s1+10(8) = itab-f3.
itxts1+18(4) = itab-f4.
append itxt.
clear itxt.
endloop.
exchange this to the contents bin of hte Fm .
regards,
vijay.
can u please mail the text file and the expected o/p to my mail id [email protected] so that i can see the same from the data provided i m not able to check the result properly . -
How to pass .txt file as an attachment to the web service (SOAP Attachment)
Hi,
I am creating web service using NetBeans 6.5 IDE and JAX-WS. I create a web application and then create web service using provided interface. I want to add .txt file as an attachment/parameter to the web service operation using "Add operation" interface. Don't want to add as an attachment to the SOAP message by creating it explicitly. IDE generates SOAP request and response automatically when the service is tested using "Test Web service" option. How can I add attcahment when I add operation so that it will appear in the generated SOAP message ?
TIA.Hi AnitaDP,
Attachment doesn't work in web service. You have to pass the content of the text file as a String or as an array of bytes to a method of your web service. From there, you may save the passed data in a file. -
To send TXT file as an attachment through Email
Hi Experts,
I am working on requirement where i have to send a txt file as an attachment.
Could any one suggest me a solution.
Thanks and Regards,
Jeswanth KadaliHi,
Use the function module SO_NEW_DOCUMENT_ATT_SEND_API1.
We find it convenient to use a custom function module as a wrapper for that.
Here's the code.
FUNCTION Z_EMAILS_ATTACH.
""Local interface:
*" IMPORTING
*" VALUE(EMAIL_SUBJECT) LIKE SODOCCHGI1-OBJ_DESCR
*" VALUE(ATTACHMENT_SUBJECT) LIKE SOPCKLSTI1-OBJ_DESCR OPTIONAL
*" VALUE(ATTACHMENT_DOC_TYPE) TYPE SO_OBJ_TP OPTIONAL
*" REFERENCE(ATTACHMENT_HEADER) LIKE SOLISTI1 STRUCTURE SOLISTI1
*" TABLES
*" EMAIL_BODY STRUCTURE SOLISTI1
*" EMAIL_ATTACHMENT STRUCTURE SOLISTI1 OPTIONAL
*" RECEIVERS STRUCTURE SOMLRECI1
*" EXCEPTIONS
*" UNKNOWN_COMMUNICATION_TYPE
*" ERROR_SENDING_MAIL
*" EMPTY_ATTACHMENT
*" NO_ATTACHMENT_SUBJECT
*" USER_HAS_NO_EMAIL_ADDRESS
*" NO_RECEIVERS
NOTE
Single-testing when the tables passed to the function have reference
structure SOLISTI1 meets with a problem.
Entering non-blank rows into these tables is impossible, it seems.
This is believed to be because the single testing fails to cope with
the width of SOLISTI1-LINE [255 char].
For single testing, use CVDTLINE as the reference structure - it's
only 132 char. Then remember to change it back to SOLISTI1...
Based on Z_EMAIL_ATTACH which sends just one mail.
08.06.2007 JNM
DATA: document LIKE sodocchgi1.
DATA: packlist LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
DATA: contents LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA: header LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA: RECVLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.
DATA: NEXT_ROW LIKE SY-TABIX.
DATA: lines LIKE sy-tabix.
DATA: LAST_LINE_LENGTH TYPE I.
DATA: d_doc_size LIKE packlist-doc_size.
data: email_address type ad_smtpadr.
A user without an email address cannot email.
CALL FUNCTION 'Z_USER_EMAIL_ADDRESS'
EXPORTING
USER_NAME = SY-UNAME
IMPORTING
EMAIL_ADDRESS = email_address
EXCEPTIONS
UNKNOWN_USER = 1
NO_ADDRESS_KEY = 2
NO_ADDRESS_DATA = 3
NO_EMAIL_ADDRESS = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4
raising USER_HAS_NO_EMAIL_ADDRESS.
ENDIF.
Receivers?
describe table receivers lines lines.
if lines eq 0.
raise no_receivers.
endif.
initialization
CLEAR: CONTENTS, DOCUMENT, HEADER, PACKLIST, RECVLIST.
REFRESH: CONTENTS, HEADER, PACKLIST, RECVLIST.
attachment?
DESCRIBE TABLE EMAIL_ATTACHMENT LINES LINES.
IF LINES EQ 0 AND ATTACHMENT_SUBJECT CN SPACE.
RAISE EMPTY_ATTACHMENT.
ENDIF.
IF LINES NE 0 AND ATTACHMENT_SUBJECT CO SPACE.
RAISE NO_ATTACHMENT_SUBJECT.
ENDIF.
email body
concatenate 'SAP client:'
sy-host sy-sysid sy-mandt
into contents separated by space.
append contents.
clear contents.
append contents.
APPEND LINES OF EMAIL_BODY TO CONTENTS.
header - row for body
HEADER = 'BODY HEADER'.
APPEND HEADER.
packing list - row for body
PACKLIST-TRANSF_BIN = SPACE.
PACKLIST-HEAD_START = 1.
PACKLIST-HEAD_NUM = 1.
PACKLIST-BODY_START = 1.
DESCRIBE TABLE CONTENTS LINES PACKLIST-BODY_NUM.
NEXT_ROW = 1 + PACKLIST-BODY_NUM.
*packlist-doc_type = 'EXT'.
PACKLIST-DOC_TYPE = 'RAW'.
APPEND PACKLIST.
IF ATTACHMENT_SUBJECT CN SPACE. " if there's an attachment
attachment into contents
APPEND LINES OF EMAIL_ATTACHMENT TO CONTENTS.
DESCRIBE TABLE EMAIL_ATTACHMENT LINES LINES.
READ TABLE EMAIL_ATTACHMENT INDEX LINES.
LAST_LINE_LENGTH = STRLEN( EMAIL_ATTACHMENT ).
header - attachment
if attachment_header is initial.
HEADER = 'ATTACH'.
else.
header = attachment_header.
endif.
APPEND HEADER.
packing list - row for attachment
CLEAR PACKLIST.
case attachment_doc_type.
when 'XLS'.
PACKLIST-TRANSF_BIN = 'X'.
when others.
PACKLIST-TRANSF_BIN = SPACE.
endcase.
PACKLIST-HEAD_START = 2.
PACKLIST-HEAD_NUM = 1.
PACKLIST-BODY_START = NEXT_ROW.
if not attachment_doc_type is initial.
packlist-doc_type = attachment_doc_type.
else.
PACKLIST-DOC_TYPE = 'RAW'.
endif.
packlist-doc_type = 'EXT'.
PACKLIST-OBJ_DESCR = ATTACHMENT_SUBJECT.
PACKLIST-OBJ_NAME = 'ATTACHMENT'.
PACKLIST-BODY_NUM = LINES.
D_DOC_SIZE = LAST_LINE_LENGTH + ( 255 * ( LINES - 1 ) ).
PACKLIST-DOC_SIZE = D_DOC_SIZE.
APPEND PACKLIST.
ENDIF. "attachment
document
document-obj_name = 'EMAIL'.
DOCUMENT-OBJ_DESCR = EMAIL_SUBJECT.
document-obj_langu = sy-langu.
document-obj_expdat = sy-datum.
document-sensitivty = 'F'.
document-obj_prio = 9.
document-no_change = 'X'.
document-priority = 9.
document-expiry_dat = sy-datum.
ADD 1 TO: DOCUMENT-OBJ_EXPDAT, DOCUMENT-EXPIRY_DAT.
DESCRIBE TABLE contents LINES lines.
D_DOC_SIZE = LAST_LINE_LENGTH + ( 255 * ( LINES - 1 ) ).
document-doc_size = d_doc_size.
call the mail function
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = document
put_in_outbox = 'X'
commit_work = 'X'
TABLES
object_header = header
packing_list = packlist
contents_txt = contents
receivers = 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.
IF SY-SUBRC > 0.
RAISE ERROR_SENDING_MAIL.
ENDIF.
ENDFUNCTION.
Also remember that the SAP user sending the email must have an email address in the user details, so that SAP has something to put in the "From" field when creating the email.
That's why we use this:
FUNCTION Z_USER_EMAIL_ADDRESS.
""Local interface:
*" IMPORTING
*" REFERENCE(USER_NAME) TYPE SYUNAME DEFAULT SY-UNAME
*" EXPORTING
*" REFERENCE(EMAIL_ADDRESS) TYPE AD_SMTPADR
*" EXCEPTIONS
*" UNKNOWN_USER
*" NO_ADDRESS_KEY
*" NO_ADDRESS_DATA
*" NO_EMAIL_ADDRESS
tables:
adr6,
usr21,
usr02.
SAP logon data
select single *
from usr02
where bname = user_name.
if sy-subrc ne 0.
message i017(ZREP) with
'SAP user' user_name 'is unknown'
raising unknown_user.
endif.
SAP user address key
select single *
from usr21
where bname = user_name.
if sy-subrc ne 0.
message i017(ZREP) with
'No address data assigned to SAP user' user_name
raising no_address_key.
endif.
SAP user address
select single *
from adr6
where addrnumber = usr21-addrnumber and
persnumber = usr21-persnumber.
if sy-subrc ne 0.
message i017(ZREP) with
'No address data found for SAP user' user_name
raising no_address_data.
endif.
email_address = adr6-smtp_addr.
if email_address is initial.
message i017(ZREP) with
'No address data found for SAP user' user_name
raising no_email_address.
endif.
ENDFUNCTION.
John -
Shell Script to send email with .txt file as attachment
Dear Al,
Could any one help me with code, for sending email with .txt file as attachment using shell script.
Thank You!978334 wrote:
Dear Al,
Could any one help me with code, for sending email with .txt file as attachment using shell script.
Thank You!http://bit.ly/XHfSCz
https://forums.oracle.com/forums/search.jspa?threadID=&q=sendmail&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
Thanks,
Hussein -
Send email with txt file as attachment
Hi ,
can any one help me in download as txt file using the function module SO_OBJECT_SEND along with email .
a sample code using this function module would be helpfull.
Thanks,
vinay .Hi vinay,
Not only TXT file, u can send any
other file like word,excel,pdf,exe, etc.
1. There is some trick involved
in the binary files.
2. I have made a program (and it works fantastic)
ONLY 6 LINES FOR EMAILING
BELIEVE ME
ITS A FANTASTIC PROGRAM.
IT WILL WORK LIKE OUTLOOK EXPRESS !
3. The user is provided with
a) file name
b) email address to send mail
and it sends ANY FILE (.xls,.pdf .xyz..)
Instantaneously !
4. Make two things first :
1. Include with the name : ZAMI_INCLFOR_MAIL
2. Report with the name : ZAM_TEMP147 (any name will do)
3. Activate both and execute (2)
4. After providing filename, email adress
5. Code for Include :
10.08.2005 Amit M - Created
Include For Mail (First Req F16)
Modification Log
Data
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
FORM
FORM ml_customize USING objname objdesc.
Clear Variables
CLEAR docdata.
REFRESH objpack.
CLEAR objpack.
REFRESH objhead.
REFRESH objtxt.
CLEAR objtxt.
REFRESH objbin.
CLEAR objbin.
REFRESH objhex.
CLEAR objhex.
REFRESH reclist.
CLEAR reclist.
REFRESH listobject.
CLEAR listobject.
CLEAR tab_lines.
CLEAR doc_size.
CLEAR att_type.
Set Variables
docdata-obj_name = objname.
docdata-obj_descr = objdesc.
ENDFORM. "ml_customize
FORM
FORM ml_addrecp USING preceiver prec_type.
CLEAR reclist.
reclist-receiver = preceiver.
reclist-rec_type = prec_type.
APPEND reclist.
ENDFORM. "ml_customize
FORM
FORM ml_addtxt USING ptxt.
CLEAR objtxt.
objtxt = ptxt.
APPEND objtxt.
ENDFORM. "ml_customize
FORM
FORM ml_prepare USING bypassmemory whatatt_type whatname.
IF bypassmemory = ''.
Fetch List From Memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
COMPRESSED_SIZE =
TABLES
in = listobject
out = objbin
EXCEPTIONS
OTHERS = 1
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
ENDIF.
Header Data
Already Done Thru FM
Main Text
Already Done Thru FM
Packing Info For Text Data
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
Packing Info Attachment
att_type = whatatt_type..
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = whatname.
APPEND objpack.
Receiver List
Already done thru fm
ENDFORM. "ml_prepare
FORM
FORM ml_dosend.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
CONTENTS_HEX = objhex
OBJECT_PARA =
object_parb =
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8
IF sy-subrc <> 0.
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
ENDFORM. "ml_customize
FORM
FORM ml_spooltopdf USING whatspoolid.
DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
Call Function
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = whatspoolid
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
OTHERS = 12.
Convert
PERFORM doconv TABLES pdf objbin.
ENDFORM. "ml_spooltopdf
FORM
FORM doconv TABLES
mypdf STRUCTURE tline
outbin STRUCTURE solisti1.
Data
DATA : pos TYPE i.
DATA : len TYPE i.
Loop And Put Data
LOOP AT mypdf.
pos = 255 - len.
IF pos > 134. "length of pdf_table
pos = 134.
ENDIF.
outbin+len = mypdf(pos).
len = len + pos.
IF len = 255. "length of out (contents_bin)
APPEND outbin.
CLEAR: outbin, len.
IF pos < 134.
outbin = mypdf+pos.
len = 134 - pos.
ENDIF.
ENDIF.
ENDLOOP.
IF len > 0.
APPEND outbin.
ENDIF.
ENDFORM. "doconv
CODE FOR PROGRAM
5.
REPORT zam_temp147 .
INCLUDE zami_inclfor_mail.
DATA
DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : file_name TYPE string.
data : path like PCFILE-PATH.
data : extension(5) type c.
data : name(100) type c.
SELECTION SCREEN
PARAMETERS : receiver TYPE somlreci1-receiver lower case.
PARAMETERS : p_file LIKE rlgrap-filename
OBLIGATORY.
AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CLEAR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM ml_customize USING 'Tst' 'Testing'.
PERFORM ml_addrecp USING receiver 'U'.
PERFORM upl.
PERFORM doconv TABLES itab objbin.
PERFORM ml_prepare USING 'X' extension name.
PERFORM ml_dosend.
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
FORM
FORM upl.
file_name = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_name
filetype = 'BIN'
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
path = file_name.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
CHECK_DOS_FORMAT =
IMPORTING
DRIVE =
EXTENSION = extension
NAME = name
NAME_WITH_EXT =
PATH =
EXCEPTIONS
INVALID_DRIVE = 1
INVALID_EXTENSION = 2
INVALID_NAME = 3
INVALID_PATH = 4
OTHERS = 5
ENDFORM. "upl
regards,
amit m. -
How to send txt file as attachement in email
Hi Experts ,
How to send txt file as attachement in email .
which function module i useHi,
Try to use this one
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
Hope it can solve your problem!
Good luck!
Tao -
Photo attachment is .txt file not .jpg
When I send a photo from iphone to yahoo or gmail address, the photo is imbedded in the email but the attachment is not a jpg file, it is a 3kb .txt file when opened says "sent from my iphone". When I right click on the imbedded photo, I cannot save this as a jpg file. This is happening recently, it never happened before. I asked Yahoo and they said it was something to do with Apple, not Yahoo. So frustrating, can someone please help me??????
Photo Stream only uses the file name, not the title. The title only exist in iPhoto. To get the title to be used in Photo Stream once must export the file out of iPhoto via the File ➙ Export ➙ File Export menu with the option File Name - User Title option. Then import the new photos and add them to the Photo Stream.
Send a feature request to Apple via http://www.apple.com/feedback/iphoto.html.
OT -
Problem in send mail with .txt file attached
According to the diferent checks, I found the next problems:
1.- Between each caracters there is an space, example:(E Q U I P M E N T) and could be (EQUIPMENT), the last one is the correct form.
2.- For example, two registers in my internal table appear in one line of my .txt file, but i want that each register of my internal table appear in differents lines of my .txt file.
3.- The length of each register of my internal table (objbin) is 255 characters, but i really want that the length of each register of my internal table be 1023 characters.
Thank youThis is my perform:
FORM z_envia_correo .
DATA: docu_data LIKE SODOCCHGI1,
tablines TYPE i,
destinatarios like somlreci1 occurs 1 with header line.
DATA: BEGIN OF packlist OCCURS 0.
INCLUDE STRUCTURE SOPCKLSTI1.
DATA: END OF packlist.
DATA: BEGIN OF objbin OCCURS 0.
INCLUDE STRUCTURE SOLISTI1.
DATA: END OF objbin.
DATA: BEGIN OF object_header OCCURS 0.
INCLUDE STRUCTURE SOLISTI1.
DATA: END OF object_header.
DATA: BEGIN OF contents OCCURS 0.
INCLUDE STRUCTURE SOLISTI1.
DATA: END OF contents.
*-->ihv270907
DATA: l_string TYPE string,
l_fecha(10) TYPE c,
l_dia(2) TYPE c,
l_mes(2) TYPE c,
l_ano(4) TYPE c,
l_hora(8) TYPE c,
l_h(2) TYPE c,
l_min(2) TYPE c,
l_seg(2) TYPE c.
*<--ihv270907
Variable del destinatario para enviar el mail
DATA: l_usrnam TYPE string.
*Caracter salto de linea
FIELD-SYMBOLS <hex_container> TYPE c.
CONSTANTS: zz_tab TYPE x VALUE '0D' LENGTH 4. "valor del salto de linea en hexadecimal
ASSIGN zz_tab TO <hex_container> CASTING.
cargo el texto de cabecera del mail
CLEAR docu_data.
docu_data-obj_name = 'ZFLOTA'.
CONCATENATE 'ZFLOTA' sy-datum INTO docu_data-obj_descr SEPARATED BY space.
docu_data-proc_type = 'T'.
docu_data-proc_name = 'ZFLOTA'.
cargo el texto del cuerpo del mail
CLEAR contents.
*-->ihv270907
l_string = TEXT-I04.
REPLACE '&' IN l_string WITH sy-uname.
l_ano = sy-datum+0(4).
l_mes = sy-datum+4(2).
l_dia = sy-datum+6(2).
CONCATENATE l_dia l_mes l_ano INTO l_fecha SEPARATED BY '/'.
REPLACE '&' IN l_string WITH l_fecha.
l_h = sy-uzeit+0(2).
l_min = sy-uzeit+2(2).
l_seg = sy-uzeit+4(2).
CONCATENATE l_h l_min l_seg INTO l_hora SEPARATED BY ':'.
REPLACE '&' IN l_string WITH l_hora.
contents = l_string.
*<--ihv270907
APPEND contents.
DESCRIBE TABLE contents LINES tablines.
READ TABLE contents INDEX tablines.
docu_data-doc_size = ( tablines - 1 ) * 255 + STRLEN( contents ).
cargo el contenido del attachmet
LOOP AT g_gt_outtab_mail.
g_gt_outtab_mail-line+254(1) = <hex_container>.
MOVE g_gt_outtab_mail-line TO objbin-line.
APPEND objbin.
ENDLOOP.
genero el nombre del archivo a ser attachado
CLEAR object_header.
object_header-line = 'ZFLOTA.txt'.
APPEND object_header.
armo las caracteristicas del mail
CLEAR packlist.
packlist-head_start = 1.
packlist-head_num = 0.
packlist-body_start = 1.
packlist-body_num = tablines.
packlist-transf_bin = space.
packlist-doc_type = 'RAW'.
APPEND packlist.
armo las caracteristicas del attachment
DESCRIBE TABLE objbin LINES tablines.
packlist-transf_bin = 'X'.
packlist-head_start = 1.
packlist-head_num = 0.
packlist-body_start = 1.
packlist-body_num = tablines.
packlist-doc_type = 'TXT'.
packlist-obj_name = 'ZFLOTA.txt'.
packlist-obj_descr = 'ZFLOTA.txt'.
packlist-doc_size = tablines * 250.
APPEND packlist.
Destinatarios
l_usrnam = sy-uname.
MOVE: l_usrnam TO destinatarios-receiver.
destinatarios-rec_type = 'B'. "U externo; B -> SAP
destinatarios-sap_body = 'X'.
APPEND DESTINATARIOS.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = docu_data
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = packlist
OBJECT_HEADER = object_header
CONTENTS_BIN = objbin
CONTENTS_TXT = contents
RECEIVERS = destinatarios
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.
ENDFORM. " z_envia_correo
Thank you. -
How to send mail from linux with .txt file as attachment ..
I want to send email from linux box and in the body of the email i want to have the content of dblog.txt file.
I want dglob.txt file content to be part of the mail body.
Thanks in advance!!Apr 29 15:19:35 lctwprddb01 sendmail[1616]: m3TJJZ4k001616: to=[email protected], ctladdr=oracle (500/500), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30109, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (m3TJJZhB001617 Message accepted for delivery)
Apr 29 16:04:52 lctwprddb01 sendmail[1422]: m3TIP6LJ031388: to=<[email protected]>, ctladdr=<[email protected]> (500/500), delay=01:39:46, xdelay=00:48:01, mailer=esmtp, pri=120423, relay=cluster2a.us.messagelabs.com. [216.82.249.211], dsn=4.0.0, stat=Deferred: Connection timed out with cluster2a.us.messagelabs.com.
Apr 29 16:07:36 lctwprddb01 sendmail[1619]: m3TJJZhB001617: to=<[email protected]>, ctladdr=<[email protected]> (500/500), delay=00:48:01, xdelay=00:48:01, mailer=esmtp, pri=120425, relay=cluster2a.us.messagelabs.com. [216.82.248.44], dsn=4.0.0, stat=Deferred: Connection timed out with cluster2a.us.messagelabs.com.
Apr 29 16:07:52 lctwprddb01 sendmail[1627]: m3TILs2r031176: to=<[email protected]>, ctladdr=<[email protected]> (500/500), delay=01:45:58, xdelay=00:48:01, mailer=esmtp, pri=120429, relay=cluster2a.us.messagelabs.com. [216.82.248.45], dsn=4.0.0, stat=Deferred: Connection timed out with cluster2a.us.messagelabs.com.
Maybe you are looking for
-
How do I disable Mission Control in favor of old Spaces and Exposé?
Spaces was my favorite feature from previous versions and now they upgraded (killed) it. I loved having a Space for each kind of activity, like browsing or email or system-related tasks, and so on. Now it's all confusing and I still don't know how to
-
An error occurred downloading the VI to the FPGA device.
Hello, So I'm trying to download a VI to my FPGA and I get the following error every time. Could you help me with this? Does anyone know how to solve this? "An error occurred downloading the VI to the FPGA device. Verify that the target is connected
-
Can I turn two conversations into one
My friend doesn't have an iphone so we speak over text but he has an iPad so if we spoke over both it comes up in two conversations one for iMessage and one for text but I was wondering if it can be combined into one conversation instead of two or do
-
Hi to evey one, it is possible to set a default size making a proyector (.exe) in flash with AS3??? Thanks
-
Airport express / wireless speakers / time capsule
I use Time Capsule for my home network and backups. I'd like to be able to have wireless speakers I can move around the inside and outside of my house. Is AirPort express the way to go? Will using it create conflicts with my Time Capsule? Any recomme