Sending PDF attachments in OSB
Hi,
I want to return PDF files as attachments using OSB proxy service to client .
How can I build this functionality in OSB.I have to use http or soap transports.I am using a "Sync Read" JCA file adapter to read for the specific PDFs that I have to send back.
Any pointers to guide me?
Thank you.
I first thought will test with a text file and then go for pdf.
I created a file adapter to read a text file and a HTTP proxy service to return binary data.The contents of the file are "Oracle OSB Text".
When I execute the proxy service I see
<soap-env:Body xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<opaq:opaqueElement xmlns:opaq="http://xmlns.oracle.com/pcbpel/adapter/opaque/">T3JhY2xlIE9TQiBUZXh0</opaq:opaqueElement>
</soap-env:Body>
How to get the text file out of this $body?
Similar Messages
-
Sending pdf attachments via e-mail in BSP
Hi all,
i have written a code for sending email to a given mailid with some text but
can anyone tell me step to step procedure for sending pdf attchments to mailid.
Thanks and Regards,
Sneha Puppala.Hi ravikiran,
This is my code for sending email with attach:
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<%@extension name="bsp" prefix="bsp"%>
<htmlb:content id="content" design="classicdesign2002design2003" controlRendering="sap"
rtlAutoSwitch = "true">
<htmlb:page title = "BSP Extension: HTMLB / Element: fileUpload">
<htmlb:form method = "post" encodingType = "multipart/form-data">
<head>
<link rel="stylesheet" href="../../sap/public/bc/bsp/styles/sapbsp.css">
<title>mail to </title>
</head>
<bsp:testSuite id="testSuite" name = "<fileUpload>" key = "<%=content->design%>">
<% IF NOT %_testSuite->id_list IS INITIAL.%>
<bsp:testCase nr="DATA" text = "Data Handling"/>
<table border="1px" cellpadding="1px" cellspacing="0px" style="font:normal 10pt Arial">
<tr> <th>id</th> <th>File Name</th> <th>Content Type</th> <th>Length</th> </tr>
<%-- Notice: It's recommended to do input processing in onInputProcessing
event block, not in onLayout block like in this case. --%>
<% DO.
DATA: fu TYPE REF TO CL_HTMLB_FILEUPLOAD,
next_id TYPE STRING.
next_id = %_testSuite->next_restore_id( ).
IF next_id IS INITIAL. EXIT. ENDIF.
fu ?= CL_HTMLB_MANAGER=>GET_DATA( request = request id = next_id name = 'fileUpload' ).
%>
<tr>
<td><%=next_id%></td>
<td><%= cl_http_utility=>escape_html( fu->file_name ) %> </td>
<td><%=fu->file_content_type%> </td>
<td><%=fu->file_length%></td>
</tr>
<% ENDDO. %>
</table>
<% ENDIF. %>
<%----
%>
<%
DATA: event TYPE REF TO if_htmlb_data,
fileUpload_event TYPE REF TO CL_HTMLB_FILEUPLOAD.
event = cl_htmlb_manager=>get_event_ex( request ).
IF event IS NOT INITIAL AND event->event_name = htmlb_events=>fileupload.
fileUpload_event ?= event.
%>
<table border="1px" cellpadding="1px" cellspacing="0px" style="font:normal 10pt Arial">
<tr> <td>Event-Class</td> <td><%= event->event_class%> </td> </tr>
<tr> <td>Event-ID</td> <td><%= event->event_id%> </td> </tr>
<tr> <td>Event-Name</td> <td><%= event->event_name%> </td> </tr>
<tr> <td>Event-Type</td> <td><%= event->event_type%> </td> </tr>
<tr> <td>Event-Server Name</td> <td><%= event->event_server_name%> </td> </tr>
<tr> <td>Event-Defined</td> <td><%= event->event_defined%> </td> </tr>
<tr> <td>FileUpload-Name</td> <td><%= fileUpload_event->file_name%> </td> </tr>
<tr> <td>FileUpload-Content_Type</td> <td><%= fileUpload_event->file_content_type%> </td> </tr>
<tr> <td>FileUpload-Length</td> <td><%= fileUpload_event->file_length%> </td> </tr>
</table>
<%
ENDIF.
%>
<%----
%>
<bsp:testCase text = "upload attachment" />
<htmlb:fileUpload id = "<%= %_testSuite->seq_nr( )%>" />
<htmlb:button id = "submitButton"
text = "Upload"
onClick = "HandleUpload" />
<%----
%>
<html>
<body class="bspBody1">
<H1 class="bspH1"> Consultation-Service </H1>
<form method = "post" action="<%=page->get_page_url( )%>">
<table class="bspTbvStd" cellpadding="4">
<tr>
<td class="bspTbvHdrStd" colspan="2" align="center"><font size="4">Address</font></td>
</tr>
<tr class="bspTbvCellStd">
<td>Name</td>
<td><input type="text" name="name"
value="<% page->write( value = name ). %>" size="40" ></td>
</tr>
<tr class="bspTbvCellStd">
<td>Mail address1</td>
<td><input type="text" name="mail_address1"
value="<% page->write( value = mail_address1 ). %>" size="40"></td>
</tr>
<tr class="bspTbvCellStd">
<td>Mail address2</td>
<td><input type="text" name="mail_address2"
value="<% page->write( value = mail_address2 ). %>" size="40"></td>
</tr>
</table>
</bsp:testSuite>
</htmlb:form>
</htmlb:page>
</htmlb:content>
</form>
</body>
</html>
On Input Processing:
if page->messages->num_messages( ) eq 0.
if mail_address1 is not initial and mail_address2 is not initial.
call method application->send
exporting mail_address = mail_address1
changing messages = page->messages .
call method application->send
exporting mail_address = mail_address2
changing messages = page->messages .
if page->messages->num_messages( ) eq 0.
data text type string.
text = application->get_text( ).
navigation->set_parameter( name = 'mailtext' value = text ).
navigation->next_page( 'show' ).
endif.
else.
navigation->next_page( 'no_address' ).
endif.
endif.
"method send in defined class":
method SEND.
CLASS cl_bcs DEFINITION LOAD.
DATA:
lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
lo_send_request = cl_bcs=>create_persistent( ).
Message body and subject
DATA:
lt_message_body TYPE bcsy_text VALUE IS INITIAL,
lt_att_content_hex type solix_tab,
lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.
APPEND 'Dear Vendor,' TO lt_message_body.
append ' ' to lt_message_body.
APPEND 'Please find the attached report.'
TO lt_message_body.
append ' ' to lt_message_body.
APPEND 'Thank You,' TO lt_message_body.
lo_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = lt_message_body
i_subject = 'Visit report' ).
data: data_tab type solix_tab,
p_data type XSTRING.
call function 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = p_data
TABLES
binary_tab = data_tab.
DATA: lx_document_bcs TYPE REF TO cx_document_bcs VALUE IS INITIAL.
TRY.
lo_document->add_attachment(
EXPORTING
i_attachment_type = 'PDF'
i_attachment_subject = 'Visit Report'
I_ATTACHMENT_SIZE =
I_ATTACHMENT_LANGUAGE = SPACE
I_ATT_CONTENT_TEXT =
I_ATTACHMENT_HEADER =
i_att_content_hex = data_tab ).
CATCH cx_document_bcs INTO lx_document_bcs.
ENDTRY.
Add attachment
Pass the document to send request
lo_send_request->set_document( lo_document ).
Create sender
DATA:
lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
l_send type ADR6-SMTP_ADDR value '[email protected]'.
lo_sender = cl_cam_address_bcs=>create_internet_address( l_send ).
Set sender
lo_send_request->set_sender(
EXPORTING
i_sender = lo_sender ).
Create recipient
DATA:
lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL.
lo_recipient = cl_sapuser_bcs=>create( sy-uname ).
Set recipient
lo_send_request->add_recipient(
EXPORTING
i_recipient = lo_recipient
i_express = 'X' ).
lo_send_request->add_recipient(
EXPORTING
i_recipient = lo_recipient
i_express = 'X' ).
Send email
DATA: lv_sent_to_all(1) TYPE c VALUE IS INITIAL.
lo_send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = lv_sent_to_all ).
COMMIT WORK.
message 'The visit report has been sent' type 'I'.
Thanks and Regards,
Sneha Puppala. -
Problem sending pdf attachments from .me email
When I send an email from my .me account with a pdf attachment, the recipient does not receive it. The attachment is not lost: they do not receive the email at all.
If I send the same email with a doc, excel or other type of attachment, it is received without a problem.
I can send the same pdf from my yahoo account and it is received without a problem.
I have replicated the problem with different pdf files and different recipients.
Any thoughts on what might be happening?
Thanks!In Mail's menu, go to Edit > Attachments
Do you have "Always Send Windows-Friendly Attachments" checked? You should. -
PDF attachments not getting to recipients
Greetings. I'm having trouble sending PDF attachments via Mail. I do what I've always done--toggle down, find the file, click "choose file" and hit send. The client always says that no attachement was included. When they respond, I can make out a tiny, tiny icon of some sort at the bottom of their email, too small to read, in a perforaated box. Is this related?
Any obvious, dopey thing I'm missing?
Thanks,
MAtt
using 10.4.10, G5Matt,
Welcome to the Discussions.
Do you Compose and Send in Rich Text Format when sending these PDF? If so, try using only Plain Text with these clients (plain text in any Signature as well).
How are the PDF created -- with what application?
Do you ever attempt to use the Resize button while in Compose? This should never be done with PDF files, btw.
More info, please.
Ernie -
Sending PDF attachment through EMAIL Triggering
Hi,
Could you plaese let me know How to send Pdf Attachments
through Email in SAP.
Using Function Module SO_NEW_DOCUMENT_ATT_SEND_API1.
Regards
BhuvanaHi,
GP does not involve any sort of coding.
Just like workflow, GP has a flow desgined in a process.
Each step has a callable object associated with it.
Check [this|http://help.sap.com/saphelp_nw04s/helpdata/en/0f/619fd378a641b29386063019c24fc4/frameset.htm] link for details
-Ashutosh -
IMS 5.2 Can't receive .pdf attachments
I get the following errors when sending emails to anyone on my iMS 5.2 email system.
This is a delivery status notification, automatically generated by MTA stc-imail.southeasterntech.edu on Fri, 26 Aug 2005 14:42:21 -0400 Regarding recipient(s) : [email protected]
Delivery status : Failed. Did not receive the expected protocol response. (students.southeasterntech.edu).
We have been attempting delivery for 5 times.
Maximum delivery tries attempted. Please contact your administrator to contact the destination domain or resend your message. Delivery failed.
Message Information:
Sender : [email protected]
Recipient : [email protected]
MTA Response :4.4.1
The original message headers are included as attachment.
Reporting-MTA: dns; stc-imail.southeasterntech.edu
Final-Recipient: rfc822;[email protected]
Diagnostic-Code: smtp; 4.4.1 Did not receive the expected protocol response.
Action: failed
Status: 4.0.0
We are running iMS 5.2
I can send .pdf attachments from my iMS system to other systems and other users on the iMS system. I just can't receive .pdf attachments from other systems.
Any Ideas?Ok, first, YOU NEED to install 5.2p2. You can get it here:
http://javashoplm.sun.com/ECom/docs/Welcome.jsp?StoreId=11&PartDetailId=MsgSvr-5.2p2-OTH-G-TP&TransactionId=Try
Second, it would really, truly help me to help you, if you'd answer the rest of my questions.
Does this happen with EVERY pdf attachment, or is it size related?
I would first patch your iMS, then put debug logging on the channel you're receiving the mail through.
set in your imta.cnf, in the channel definition for the channel your mail comes in trough. Add the keywords, "master_debug slave_debug"
then add this to the end of the option.dat file:
mm_debug=5
run:
imsimta cnbuild
imsimta restart
now, you'll get a debug log for every message. Send a test message with a pdf. Save the log file, and post it here.
remove the debug settings, so you don't fill your disk. re-run the two commands above. -
Unable to send PDFs as email attachments
I have become unable to send PDFs as email attachments when using Firefox.
Depending on the PDF, I either get the message “There was an error opening this document. The file is damaged and could not be repaired.” or it opens as a blank document. This occus when opening the file with both Adobe Reader and Acrobat Pro. The problem seems to be isolated to PDFs. (I am able to send Word files. If a PDF is zipped before attaching, it can be opened without problem.) This occurs on both an institutional email account and personal (Yahoo) email account. This problem is isolated to Firefox (does not happen in Chrome).
I have reset Firefox to default settings, as well as reinstalling.
Thank you.Update Adobe® Acrobat® Plug-in for Web Browsers, Version 10.1.13 to version 11.
Also please update all of your plugins and try again.
Does this happen when you open the pdf in pdf.js, it is possible to change the default viewer by:
* [[How to disable the built-in PDF viewer and use another viewer]] -
Sending PDF + Excel as Email attachments in Unicode System
Hi,
I have a problem in sending mails having 2 attachments. one with PDF and another Excel. I use SO_DOCUMENT_SEND_API1 by populating contents_bin table. PDF attachment is fine (PDF is created from spool), but excel attachment fails to open correctly. I refered note 1151258, but not successfull.
When I tried using contents_hex as suggested in report SENDLIST, the PDF attachment is corrupted.
The above method works fine in non-unicode system. But not in a unicode system.
In short I want to send two attachments (one PDF by reading spool and second excel by using an interanl table) in a mail. Any ideas & suggestions please?
Thanks,
RavikanthHI,
use below logic..
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
FORM build_xls_data_table.
*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 '' '' '' 'PASSPORT AND VISA DETAILS REPORT' ' '
INTO lt_attach SEPARATED BY SPACE.
CONCATENATE con_cret lt_attach INTO lt_attach.
APPEND lt_attach.
CONCATENATE 'Per.Num' 'Sub.Type' 'First.Name' 'Dep.Name'
'Nation ' 'Pass. Num' 'Exp.Date' 'Visa.Num' 'Exp.Date'
INTO lt_attach SEPARATED BY con_tab.
CONCATENATE con_cret lt_attach INTO lt_attach.
APPEND lt_attach.
LOOP AT ot_dependent INTO wa_dependent.
CONCATENATE wa_dependent-pernr
wa_dependent-subty
wa_dependent-subtype_text
wa_dependent-vorna
wa_dependent-favor
wa_dependent-fanat
wa_dependent-zzicnum
wa_dependent-zzexpid
wa_dependent-zzvcnum
wa_dependent-zzvexpid
INTO lt_attach SEPARATED BY con_tab.
CONCATENATE con_cret lt_attach INTO lt_attach.
APPEND lt_attach.
ENDLOOP.
ENDFORM. " BUILD_XLS_DATA_TABLE
FORM f_send_email_passport_details .
Populate message body text
PERFORM populate_email_message_body.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
TABLES lt_message
lt_attach
USING p_email
'Passport and Visa .xls document attachment'
'XLS'
'filename'
CHANGING gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
ENDFORM. " F_SEND_EMAIL_PASSPORT_DETAILS
FORM f_send_email_passport_details .
Populate message body text
PERFORM populate_email_message_body.
Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
TABLES lt_message
lt_attach
USING p_email
'Passport and Visa .xls document attachment'
'XLS'
'filename'
CHANGING gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
PERFORM initiate_mail_execute_program.
ENDFORM. " F_SEND_EMAIL_PASSPORT_DETAILS
*& 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 lt_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( lt_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 lt_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 = lt_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. "send_file_as_email_attachment
*& 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
Regards,
Naresh Chava. -
I'm unable to email PDF attachments, this has started in the last 2 weeks - any clues why as other file types are sending?
Greetings,
That is rather strange. Attachments are attachments. The big difference between what will send and what won't is usually either who you are sending it to (wrong email address) or how big the attachment is (most email providers have a limit to the total message size between 10 MB and 20 MB).
-- What happens when you say you are "unable to email PDF attachments"? What error message do you get?
-- Are you sending these emails using the Mail program?
-- What is the file size of the PDF you are trying to send?
-- What happens if you compress the PDF before you email it (Highlight the PDF on the desktop and then go to File > Compress) ?
-- What happens if you send the PDF to yourself?
Cheers. -
.pdf attachments already open in outlook, won't send to iBooks
How can I stop pdf attachments from opening in the body of an email on iPad 3, so I can download and open them in iBooks? This only happens with some .pdf's. I'm trying to send some to myself right now from a different email, but when I open it the attachments are viewable in the body, and I can't get them in iBooks; this has happened quite a bit with certain .pdf's, and makes work much harder! Please help if you know how to remedy this!
What version of iOS are you running?
What you are describing typically occurs with single page PDFs (but not always). You should still be able to tap and hold to get the menu that allows you to open the file in other apps, including iBooks. -
Is it possible to send multiple PDF attachments from an iPad?
When sending an email from my iPad, I am unable to send multiple attachments, just one file at a time.
Is there any way to send two PDF files in one email?
Thanks,
Melissa.I don't need to send it to multiple contacts, I need to send multiple PDF files in an email from my iPad.
Thanks for the assistance though.
Regards,
Melissa. -
How to send smartforms as pdf attachments with e mail
hi experts,
how to send smartforms as pdf attachments with e mail???
nitinHi
In the FORM Interface put proper parameter. Hope this helps. -
Mail sends Word and PDF attachments but they don't arrive
When I send emails with Word or PDF attachments they leave my inbox, but the email is not received on the other side.
Anyone know why?Hi Ernie
I see you've answered many peple's questions about this, thanks! I've tried deleting the outbox in my Library folder as you suggested to someone else.
Messages without attachments are received by others.
Messages are sent to sent box
Messages show they have an attachment in the sent box.
Another related issue that has happened. I might have 5 attahments and then saved them the email to the Drafts folder, only to find that it has deleted or can't see several of them when I open it again to send.
Thanks for this
dyingswan -
Can´t send emails with pdf attachments - why?
Since i moved all my accounts to my new airbook (OS X 10.8.2) everything works fine BUT i am not able to send emails with pdf attachments.I have an exchange and a mac.account - but they both won`t work.
The emails stay put in the local ausgang? exit box and won`t move away unless i delete them.
i checked the accounts, the activity - all says it works fine - but it doesn`t!
Maybe in the *deep* of my mac is one thing that says no pdf - but where can i find it?
I appreciate every helpful hint :-)
greetingsit tries to send the email for about five minutes and than gives the message *server doesn't work* you want to try another? repeat? or later?
when i change the server e.g. from exchange to mac - tries again and without further notice i find the message in the outbox - even when i click that one and *send* again - nothing changes......
I already tried to name the attachments in.pdf - i also change the pdf to jpeg - nothing works - all emails i write after that go immediately to the outbox - so when i want to send messages at all i need to delete the ones with the attachment or send the other ones manually
Please notice in the activity window there is a lot of traffic :-) but it doesn`t help
i even closed all other programmes like excel,safari and stuff - but still
and i still have al lot of free GB on my airbook....
any idea???? -
Multiple pdf attachments from server folder using SO_DOCUMENT_SEND_API1
Dears,
I am trying to build a program able to send an email with multiple pdf attachments.
The files are stored in a folder in SAP server.
I am able to generate a pdf file from a spool and sucessfully attach it to the email using:
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
bin_filesize = v_bin_filesize
TABLES
otf = job_output_info-otfdata
doctab_archive = it_docs
lines = it_lines
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 2
OTHERS = 3.
IF sy-subrc = 0.
LOOP AT it_lines.
TRANSLATE it_lines USING ' ~'.
CONCATENATE gd_buffer it_lines INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att_aux = gd_buffer.
APPEND it_mess_att_aux.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDIF.
Internal table it_mess_att_aux is the parameter contents_bin of FM SO_DOCUMENT_SEND_API1.
I have now 2 files on a server folder which I would like to include as well.
I am reading the content of the pdf files in following way:
DATA: gd_buffer TYPE string,
OPEN DATASET lv_fileserver FOR INPUT IN BINARY MODE.
IF sy-subrc <> 0.
MESSAGE e257(zmsgsd) WITH lv_fileserver.
ELSE.
CLEAR: it_mess_att_aux[], gd_buffer.
DO.
READ DATASET lv_fileserver INTO gd_buffer.
IF sy-subrc <> 0.
EXIT.
ENDIF.
APPEND gd_buffer TO it_mess_att_aux.
ENDDO.
APPEND LINES OF it_mess_att_aux TO it_mess_att.
I do not understand the purpose of the statement:
TRANSLATE it_lines USING ' ~'.
in this context. Could anyone explain it?
All the files are attached to email with the desired name but corrupted and with the wrong size.
Can anyone help me build the logic to attach a pdf file from server in a email?
Thank you in advance,
Kind Regards,
João Cabritahi , try this ,it is working fine .
DATA: i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
* wa_doc_chng LIKE sodocchgi1,
i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
* i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_objhead LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_tline TYPE TABLE OF tline WITH HEADER LINE,
i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
wa_doc_chng LIKE sodocchgi1,
v_lines_txt TYPE i,
l_lines TYPE I VALUE '20'.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = bin_filesize
TABLES
otf = int_tab_otf_final
lines = int_pdf_tab.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*****************soc ranjan***************************
* IF full_path IS INITIAL.
* CALL METHOD cl_gui_frontend_services=>file_save_dialog
* EXPORTING
** WINDOW_TITLE =
** DEFAULT_EXTENSION = 'PDF'
** DEFAULT_FILE_NAME =
* file_filter = 'Portable Document Format (.pdf)' " for restricting saving file only as pdf
* CHANGING
* filename = file_name
* path = file_path
* fullpath = full_path
* IF sy-subrc <> 0.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
* ENDIF.
* ENDIF.
******************eoc ranjan*****************
*break-point.
CONCATENATE full_path git_select_option-pernr INTO path SEPARATED BY '_'.
CONCATENATE path 'PDF' INTO path SEPARATED BY '.'.
** **************************for downloading*********************************
* CALL FUNCTION 'GUI_DOWNLOAD'
* EXPORTING
* bin_filesize = bin_filesize
* filename = path
* filetype = 'BIN'
* IMPORTING
* filelength = file_size
* TABLES
* data_tab = int_pdf_tab.
* 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 : lop , el , sl , cl .
* ******************addeddd later by ranjan 21.04.2011
DATA : desc TYPE char40 ,
desc1 TYPE char100 .
CALL FUNCTION 'QCE1_CONVERT'
TABLES
t_source_tab = int_pdf_tab
t_target_tab = i_record
EXCEPTIONS
convert_not_possible = 1
OTHERS = 2.
IF sy-subrc <> 0.
WRITE : / 'Error in conversion of pdf lines'(015).
ENDIF.
APPEND LINES OF i_record TO i_objbin.
*Creation of the entry for the compressed attachment
DESCRIBE TABLE i_objbin LINES bin_filesize.
i_objtxt = 'Hi'.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = 'Pls find the attached salary slip ' .
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = ' '.
APPEND i_objtxt.
i_objtxt = 'Regards: '.
APPEND i_objtxt.
i_objtxt = 'Corporate HR '.
APPEND i_objtxt.
DESCRIBE TABLE i_objtxt LINES L_LINES.
READ TABLE i_objtxt INDEX L_LINES.
wa_doc_chng-doc_size = ( L_LINES - 1 ) * 255 + STRLEN( i_objtxt ).
*Creating the entry for the compressed document
CLEAR i_objpack-transf_bin.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = L_LINES.
i_objpack-doc_type = 'RAW'.
APPEND i_objpack.
***CLEAR: i_objpack .
***i_objpack-transf_bin = ' '.
**i_objpack-head_start = 1.
**i_objpack-head_num = 0.
**i_objpack-body_start = 1.
**i_objpack-body_num = L_LINES.
**i_objpack-doc_type = 'TXT'.
**i_objpack-obj_descr = desc1 .
**APPEND i_objpack.
*CLEAR: i_objhead .
*i_objhead = DESC.
*APPEND i_objhead.
*break-point .
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 1.
i_objpack-body_start = 1.
i_objpack-body_num = bin_filesize.
i_objpack-obj_name = 'Employee Payslip'.
i_objpack-obj_descr = 'Employee Payslip'.
i_objpack-doc_size = bin_filesize * 255 .
i_objpack-doc_type = 'PDF'.
APPEND i_objpack.
CONCATENATE 'Salary Slip of Month' p_month INTO desc SEPARATED BY ' ' .
*DESCRIBE TABLE i_objtxt LINES v_lines_txt.
*READ TABLE i_objtxt INDEX v_lines_txt.
****wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 375 + STRLEN( i_objtxt ).
wa_doc_chng-obj_name = 'Payslip'.
wa_doc_chng-expiry_dat = sy-datum + 10.
wa_doc_chng-obj_descr = desc.
wa_doc_chng-sensitivty = 'F'.
wa_doc_chng-doc_size = v_lines_txt * 255.
CLEAR i_objpack.
DATA: l_usrid_long TYPE pa0105-usrid_long.
DATA : emessage(70) TYPE c.
CLEAR : l_usrid_long.
SELECT SINGLE usrid_long
FROM pa0105
INTO l_usrid_long
WHERE pernr = git_pa0001-pernr
AND subty = '0010'.
*break-point.
IF sy-subrc EQ 0.
i_reclist-receiver = l_usrid_long.
i_reclist-rec_type = 'U'.
i_reclist-com_type = 'INT'.
APPEND i_reclist.
ELSE.
WRITE:/ 'No email id is maintained for this personnel number' , git_pa0001-pernr.
ENDIF.
IF NOT i_reclist[] IS INITIAL.
***************************************for senders id *************************************
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
sender_address = 'xys'
sender_address_type = 'SMTP'
commit_work = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
* SENDER_ID =
TABLES
packing_list = i_objpack
object_header = i_objhead
contents_bin = i_objbin
contents_txt = i_objtxt
receivers = i_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8. .
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Maybe you are looking for
-
ITunes "grouping" tag - ID3 tags and file rewriting
From Wikipedia's entry about ID3 tags: "ID3v2.2 and 2.3 require that the tag data precede the file. Whilst for streaming data this is absolutely required, for static data it means that the entire audio file must be updated to insert data at the front
-
No incoming video and audio for new Jabber video account
We have registered a couple of jabber video account, but they all have the same issue, couldn't successfuly establish a call. However, it seems working fine for old jabber video account. Anyone can help?
-
Hi experts, I have a doubt regarding the check of employee authorization. That is, we are providing 2 reports for MSS user in portal. The MSS user can view only those employees who reports to him. But, in addition to this, we need to filter only the
-
Scheduled start and finish dates in the Work order.
Hi Friends, I am facing peculiar issue that once the Work order has been released schedule start and finish dates should be derived from the control key and operation hours and work center capacity,infact in my case while releasing the Work order,the
-
Hello all, I am writting an application (not an applet) that is a timer program. Everything is working okay except for the painting of the time. I have quite a few classes since I have tried to make this as neat as possible. Here is my problem: 1)I h