Problem with PDF attach
Hi, my problem es this, I use de FM 'CONVERT_OTFSPOOLJOB_2_PDF' to convert a spool to PDF document, it work ok.
Then I convert th PDF doc from 132 to 255 char, and the end I send the PDF with FM 'SO_OBJECT_SEND'
The mail is sending correctly but when a try to open the PDF attached occurs an error "Error (14)" or "Format Error"
Anyone?
Thanks in advance.
Instead of using the function module 'SO_OBJECT_SEND' try to use 'SO_NEW_DOCUMENT_ATT_SEND_API1'.
For more information: check Abhishek Suppal's response in this [thread|PDF attachment in mail;.
Similar Messages
-
Problem with PDF Attachment (from GOS)
Hi Experts,
Below is the code in a ZFM. We are trying to get GOS attachments and the same are to be sent to SAP Inbox through Workitem. When we executed, the attachment is being shown but couldn't be opened. It's throwing an error as 'The file has been damaged'.
As per my understanding, we are getting PDF file into lt_object_content_l and we are trying to convert that to binary file and send the same to SAP_WAPI_ATTACHMENT_ADD.
FUNCTION ztest_service_atta.
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(IV_WORKITEMID) TYPE SWW_WIID OPTIONAL
*" REFERENCE(IV_PERNR) TYPE PERSNO
*" REFERENCE(IV_REINR) TYPE REINR
*" EXPORTING
*" REFERENCE(ES_ATT_ID) TYPE SWR_ATT_ID
*" EXCEPTIONS
*" ATTACH_FAILED
DATA: gs_att_header TYPE swr_att_header.
DATA: ls_lpor TYPE sibflporb,
lt_lpor LIKE TABLE OF ls_lpor,
ls_option TYPE obl_s_relt,
lt_option TYPE obl_t_relt,
ls_rol_op TYPE obl_s_rolt,
lt_rol_op TYPE obl_t_rolt,
ls_links TYPE obl_s_link,
lt_links TYPE obl_t_link,
ls_folder TYPE soodk,
ls_object TYPE soodk,
ls_obj_hd TYPE sood2,
lt_object_content_l TYPE TABLE OF solisti1,
ls_object_content_l TYPE solisti1,
lt_obj_cont TYPE TABLE OF soli.
* Work areas
DATA: lwa_doc_data LIKE sodocchgi1,
lwa_document_data LIKE sofolenti1,
lv_document_id TYPE sofolenti1-doc_id,
lwa_links LIKE LINE OF lt_links,
lwa_object TYPE borident,
ev_binfile TYPE xstring.
FIELD-SYMBOLS <p> TYPE x.
ls_lpor-instid = '000011110000000123'.
ls_lpor-typeid = 'BUS2089'.
ls_lpor-catid = 'BO'.
APPEND ls_lpor TO lt_lpor.
ls_option-sign = 'I'.
ls_option-option = 'EQ'.
ls_option-low = 'ATTA'.
APPEND ls_option TO lt_option.
ls_rol_op-sign = 'I'.
ls_rol_op-option = 'EQ'.
ls_rol_op-low = 'GOSAPPLOBJ'.
APPEND ls_rol_op TO lt_rol_op.
CALL METHOD cl_binary_relation=>read_links
EXPORTING
is_object = ls_lpor
it_relation_options = lt_option
it_role_options = lt_rol_op
IMPORTING
et_links = lt_links.
* Process the attachment list
LOOP AT lt_links INTO ls_links.
lv_document_id = ls_links-instid_b.
* Read the data
CALL FUNCTION 'SO_DOCUMENT_READ_API1'
EXPORTING
document_id = lv_document_id
IMPORTING
document_data = lwa_document_data
TABLES
object_content = lt_object_content_l
EXCEPTIONS
document_id_not_exist = 1
operation_no_authorization = 2
x_error = 3
OTHERS = 4.
ENDLOOP.
LOOP AT lt_object_content_l INTO ls_object_content_l.
ASSIGN ls_object_content_l TO <p> CASTING.
CONCATENATE ev_binfile <p> INTO ev_binfile IN BYTE MODE.
ENDLOOP.
IF ev_binfile IS NOT INITIAL AND iv_workitemid IS NOT INITIAL.
gs_att_header-file_type = 'B'.
gs_att_header-file_extension = 'PDF'.
gs_att_header-language = 'EN'.
gs_att_header-file_name = 'Scanned Atta.PDF'.
CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'
EXPORTING
workitem_id = iv_workitemid
att_header = gs_att_header
att_bin = ev_binfile
do_commit = 'X'
IMPORTING
att_id = es_att_id.
IF es_att_id IS INITIAL.
RAISE attach_failed.
ENDIF.
ENDIF.
ENDFUNCTION.
Can somebody please tell me if I went somewhere wrong. What I feel is, it's because of the PDF file being 255 chars. As I have got the PDF file but not OTF, how can I convert that ot be of 132 chars. Whatever, is the problem due to this reason only?
Can somebody please tell me where I have gone wrong. Your help is highly appreciable.
ThanksSolved. Instead of converting object_content, I got contents_hex also and converted that as below:
CALL FUNCTION 'SO_DOCUMENT_READ_API1'
EXPORTING
document_id = lv_document_id
IMPORTING
document_data = lwa_document_data
TABLES
object_content = lt_object_content_l
contents_hex = lt_hex_cont
EXCEPTIONS
document_id_not_exist = 1
operation_no_authorization = 2
x_error = 3
OTHERS = 4.
LOOP AT lt_hex_cont INTO ls_hex_cont.
ASSIGN ls_hex_cont TO <p> CASTING.
CONCATENATE ev_binfile <p> INTO ev_binfile IN BYTE MODE.
ENDLOOP. -
Problem with PDF attachment - need to send as "application/pdf" - Urgent!
I have code to email a created PDF but when the email is received the attachment is being removed by some kind of SMTPO firewall (I assume at my ISP). It says that attachment type "application/octet" with that file extension (.pdf) is not allowed. How do I set the mime type of the attachment to be "application/pdf"?
My code I use is similar to this at the moment:-
// Part one is the text
BodyPart bodyPart = new MimeBodyPart();
bodyPart.setText("Some text");
multipart.addBodyPart(bodyPart);
// Part two is the attachment
bodyPart = new MimeBodyPart();
DataSource sourceFile = new FileDataSource(FileName);
bodyPart.setDataHandler(new DataHandler(sourceFile));
bodyPart.setFileName("FileName.pdf");
multipart.addBodyPart(bodyPart);
message.setContent(multipart);Any help would be greatly apprecieated as I need to fix asap!!!i tried like this,but it will giving error like this
javax.mail.MessagingException: IOException while sending message;
nested exception is:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/pdf
my code is :
MimeBodyPart pdfpart=new MimeBodyPart();
pdfpart.setContent(message,"application/pdf");
pdfpart.addHeaderLine("Content-Type: application/pdf; charset=\"iso-8859-1\"");
pdfpart.addHeaderLine("Content-Transfer-Encoding: quoted-printable");
Multipart mp2=new MimeMultipart();
for( int i = 0; i < m_attachments.length; i++ )
// attachments= str+"/"+attachments[i];
MimeBodyPart messageBodyPart = new MimeBodyPart();
DataSource fileDataSource =new FileDataSource(m_attachments[i]);
InputStream fi = fileDataSource.getInputStream();
DataSource fileDataSource1 = new ByteArrayDataSource(fi, "application/pdf");
messageBodyPart.setDataHandler(new DataHandler(fileDataSource1));
// messageBodyPart.setFileName(attachments[i]);
messageBodyPart.setFileName(m_attachments[i].getName());
mp2.addBodyPart(messageBodyPart); -
Is anyone else having a problem sending a mail message with PDF attached?
Is anyone else having a problem sending a mail message with PDF attached? I receive the following message:
Sending the message content to the server failed.
Select a different outgoing mail server from the list below or click Try Later to leave the message in your Outbox until it can be sent.
Is there a fix for this?Anyone? I was hoping my problem would just 'fix itself'... but I still have some clients telling me they're not receiving any email from me. I've since deleted that account on my computers and re-added it. But still having the same issue.
-
Problem in sending mail with PDF attachment
Hi all,
Kindly check this code..
I neeed to send the smartform as a PDF attachment..
PDF generated form of smartform is generated successfully..
<b>but PDF going as attachment is showing errors in opening</b> .
Please help me to solve this issue as soon as possible
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
doc_chng-doc_size = tab_lines * 255.
Creation of the entry for the compressed document
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
APPEND objpack.
Creation of the document attachment
DESCRIBE TABLE objbin LINES tab_lines.
Creation of the entry for the compressed document
CLEAR objpack-transf_bin.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = tab_lines * 255 .
objpack-body_num = tab_lines.
objpack-doc_type = 'PDF'.
objpack-obj_name = 'SMART'.
objpack-obj_descr = 'test'.
APPEND objpack.
Completing the recipient list
target recipent
CLEAR reclist.
reclist-receiver = '[email protected]'.
reclist-express = 'X'.
reclist-rec_type = 'U'.
APPEND reclist.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = doc_chng
put_in_outbox = 'X'
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
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 = 99.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards,
ajithHello Ajith,
Use this Code.
Internal Table declarations
DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
i_tline TYPE TABLE OF tline WITH HEADER LINE,
i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
Objects to send mail.
i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
Work Area declarations
wa_objhead TYPE soli_tab,
w_ctrlop TYPE ssfctrlop,
w_compop TYPE ssfcompop,
w_return TYPE ssfcrescl,
wa_doc_chng typE sodocchgi1,
w_data TYPE sodocchgi1,
wa_buffer TYPE string,"To convert from 132 to 255
Variables declarations
v_form_name TYPE rs38l_fnam,
v_len_in LIKE sood-objlen,
v_len_out LIKE sood-objlen,
v_len_outn TYPE i,
v_lines_txt TYPE i,
v_lines_bin TYPE i.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZZZ_TEST1'
importing
fm_name = v_form_name
exceptions
no_form = 1
no_function_module = 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.
w_ctrlop-getotf = 'X'.
w_ctrlop-no_dialog = 'X'.
w_compop-tdnoprev = 'X'.
CALL FUNCTION v_form_name
EXPORTING
control_parameters = w_ctrlop
output_options = w_compop
user_settings = 'X'
IMPORTING
job_output_info = w_return
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 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.
ENDIF.
i_otf[] = w_return-otfdata[].
call function 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
others = 4.
Fehlerhandling
if sy-subrc <> 0.
endif.
loop at i_tline.
translate i_tline using '~'.
concatenate wa_buffer i_tline into wa_buffer.
endloop.
translate wa_buffer using '~'.
do.
i_record = wa_buffer.
append i_record.
shift wa_buffer left by 255 places.
if wa_buffer is initial.
exit.
endif.
enddo.
Attachment
refresh:
i_reclist,
i_objtxt,
i_objbin,
i_objpack.
clear wa_objhead.
i_objbin[] = i_record[].
Create Message Body
Title and Description
i_objtxt = 'test with pdf-Attachment!'.
append i_objtxt.
describe table i_objtxt lines v_lines_txt.
read table i_objtxt index v_lines_txt.
wa_doc_chng-obj_name = 'smartform'.
wa_doc_chng-expiry_dat = sy-datum + 10.
wa_doc_chng-obj_descr = 'smartform'.
wa_doc_chng-sensitivty = 'F'.
wa_doc_chng-doc_size = v_lines_txt * 255.
Main Text
wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + strlen( i_objtxt )
clear i_objpack-transf_bin.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_txt.
i_objpack-doc_type = 'RAW'.
append i_objpack.
Attachment
(pdf-Attachment)
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
Länge des Attachment ermitteln
describe table i_objbin lines v_lines_bin.
read table i_objbin index v_lines_bin.
i_objpack-doc_size = v_lines_bin * 255 .
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'smart'.
i_objpack-obj_descr = 'test'.
append i_objpack.
clear i_reclist.
i_reclist-receiver = '[email protected]'.
i_reclist-rec_type = 'U'.
append i_reclist.
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
TABLES
packing_list = i_objpack
object_header = wa_objhead
CONTENTS_BIN = i_objbin
contents_txt = i_objtxt
receivers = i_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
others = 8.
if helped reward points
Vasanth -
Error while sending mail with pdf attachment
Dear All,
I am sending mail to outlook Internet address, with PDF attachment, if i have the some text in the mail along with the attachment,
then the PDF attachment file is not opeining, throws file corrupted error.
If i don't have the text for mail body, and send only attachment then the PDF attachments working fine.
Please help.
regards,
Kumar.Hi Kumar,
If you are using the th FM "SO_NEW_DOCUMENT_ATT_SEND_API1" to send the PDF data(As an attachment) to an internet address, try prepare an internal table with the text you want to mention in your mail. This table needs to be passed to the
'contents_txt' of this function module. You can check your mail in SOST transaction and in DOC Content section.
Ex: wa_objtxt = 'Regards'.
APPEND wa_objtxt TO t_objtxt.
I am sure that you won't get any problem if you follow the procedure mentioned above.
Thank You,
Regards,
Naresh. -
Problem with PDF extract in a report
Hi guys,
We are facing a peculiar problem with PDF extract in a report. When we run a report and export PDF , all the records in the result set are populated in the PDF. however, if I navigate away from the report and return back to the same report, and click on export pdf (with the result set already populated) i get a blank PDF document without any records. If i run the report again and then export the PDF it works fine.
Export excel works fine for all cases.
I am assuming it has got something to do with the way the system handles the cache for PDF export.
I also found that this occurs only when we have a value list filter with "none" set as default,and in this case, initially on opening the report for the first time the query does not get executed automatically.
Any help on this would be highly appreciated.
Thanks and Regards,
immanuelHi Immanuel,
Have you tried clearing the cache? My guess is, it is probably a defect.
Regards,
Vikram -
Error occured when sending mail with PDF attachment
Dear Experts
When i trigger email through SMTP server with PDF attachment using application server 10g , i got following error :
REP-50159: Executed successfully but there were some errors when distribute the output
i am using web.show_document utility
str1:='http://erp.ruchi.com:7777/reports/rwservlet?destype=mail'||'&desname='||c1rec.hist_email||'&from=[email protected]'||'&subject=Your Payslip for Month '||to_char(c1rec.tran_month,'Mon-YYYY')||'&desformat=PDF&server=rep_erp_bi&report=/asdeploy/webutil/pay/reports/payslip.rdf&userid=qwqwqw/aasasas@DIAMOND'||'&COMPANY='||:parameter.para_comp_code||'&LOCATION='||:parameter.para_loc_code||'&MONTH='||to_char(:sdate,'MM/YYYY')||'&ECODE='||c1rec.tran_ecode;
WEB.SHOW_DOCUMENT(str1,'_SELF');
previously i had successfully using this utility but now i am facing above error
Pl suggest
regards
shaileshDear Experts
I already configured application server configuration file with specifying SMTP mail server IP in pluginParam parameter
<pluginParam name="mailServer">202.157.161.76</pluginParam>
<property name="enableSSL" value="no"/>
<property name="mailUserName" value="%[email protected]%"/>
<property name="mailPassword" value="%soyacl#123%"/>
what is the issue
Pl clarify
Please reply it's urgent -
Change Font Size with PDF attachment via e--mail
Hi experts,
I want to send mail with PDF attachment . Now the attachment is ok but only the font size in PDF is a little small.
Is that possible to Change the font size of PDF
Below is my code:
first the data comes from an internal table, then changed to an ABAP Pool.
* Create a new spool from the data in gt_data_pdf
new-page print on
destination c_local "<<== my printer
cover text text-027 "<<== Title or Spool req. name
list name space
list dataset space
immediately space " X means print now
keep in spool c_checked " X means keep spool
new list identification c_checked
line-size 255
line-count 65
no dialog .
loop at gt_data_pdf.
write: / gt_data_pdf-line.
endloop.
new-page print off.
lv_spoolid = lv_spdel-rqident = sy-spono.
lv_spdel-sys = sy-sysid.
*Convert ABAP Spool to PDF
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid = lv_spoolid
no_dialog = c_checked
importing
pdf_bytecount = lv_pdf_fsize
tables
pdf = lt_pdf_table
exceptions
others = 0.
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = lv_doc_chng
put_in_outbox = space
commit_work = c_checked
tables
packing_list = lt_objpack
object_header = lt_objhead
contents_bin = lt_objbin
contents_txt = lt_objtxt
receivers = lt_reclist
exceptions
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
others = 99.
Anyone could help me?
Thanks a lot.
Sincerely
JulieHi,
we don´t have many options for setting the font type and size in an ABAP list. One option is that you print the output using either SmartForms or AdobeForms, where you can control font type as well as size. This one requires additional work.
Another option is to use the instruction Print-Control:
NEW-PAGE PRINT ON.
PRINT-CONTROL FONT 1 SIZE 1 LPI 6 CPI 10.
WRITE: /10 'FONT 1 size 1 LPI 6 cpi 10'.
SKIP.
PRINT-CONTROL FONT 1 SIZE 5 LPI 6 CPI 5.
WRITE: /10 'FONT 1 size 5 LPI 6 cpi 5'.
SKIP.
PRINT-CONTROL FONT 2 SIZE 5 LPI 6 CPI 10.
WRITE: /10 'FONT 2 size 5 LPI 6 cpi 10'.
SKIP.
NEW-PAGE PRINT OFF. -
How to send a mail with PDF attachment
Hello
Good Day!
We have a requirement to send the mail with pdf attachment. Pdf file will be remain same for all mails and it will be placed at server. We are on R12.4 and below is the database information :
BANNER
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production
Thanks a ton for your anticipated help!
Thanks
GauravThe word URGENT is considered as rude in this forum.. Nobody here is getting paid for the ansers they are giving..
Just have a look at These threads.Those will help you. -
Send Mail with PDF Attachment in ABAP
Hi Experts,
I have a requirement where I need to convert internal table data into PDF format and send it as an E-Mail with PDF attachment to Outlook mail using ABAP.
How do I achieve this .
Can anyone send me example code for doing this.
Thanks
Kumarhiii
check following code for PDF attachment and mail
** Check for any ATTACHMENTS...
IF d_desired_type = 'RAW'. " Set to RAW?
* PERFORM convert_to_abaplist. " YES - convert it
ENDIF. " end...
IF d_desired_type = 'ALI'. " Set to ALI?
PERFORM convert_to_alilist. " YES - convert it
ENDIF. " end...
* Check for any ATTACHMENTS...
IF NOT t_soli[] IS INITIAL. " attachment?
h_real_type = d_desired_type. " ENABLE
h_transf_type = 'X'. " Transfer type BINARY...
* Write PDF/ALI formatted data to BINARY table...
t_con_bin[] = t_soli[].
* Add Packing List (attachment) for PDF...
DESCRIBE TABLE t_con_bin LINES h_tab_cntr.
READ TABLE t_con_bin INDEX h_tab_cntr.
h_doc_data-doc_size = h_doc_data-doc_size
+ ( ( h_tab_cntr - 1 )
* 255 + STRLEN( t_con_bin ) ).
h_doc_data-obj_descr = mail_subject.
h_body_start = 1.
h_body_num = h_tab_cntr.
* Write RAW data if that's what it is (adds to TEXT)...
IF h_real_type = 'RAW'.
DESCRIBE TABLE t_con_text LINES h_body_start.
h_body_start = h_body_start + 1.
h_transf_type = space. " Transfer type TEXT...
LOOP AT t_con_bin. " Zip thru TEXT stuff
t_con_text = t_con_bin. " set TEXT table header..
APPEND t_con_text. " add to what's there!
ENDLOOP.
CLEAR: t_con_bin. " clear BINARY header..
REFRESH: t_con_bin. " reset BINARY table...
ENDIF.
CLEAR t_pak_list.
IF h_transf_type = 'X'. " Binary=PDF/ALI?
t_pak_list-transf_bin = 'X'.
t_pak_list-head_start = 1.
t_pak_list-head_num = 0.
t_pak_list-body_start = 1.
t_pak_list-body_num = h_tab_cntr.
t_pak_list-doc_type = h_real_type.
t_pak_list-obj_name = 'ATTACHMENT'.
t_pak_list-obj_descr = 'Document'(001).
t_pak_list-doc_size = ( h_tab_cntr - 1 )
* 255 + STRLEN( t_con_bin ).
ELSE.
DESCRIBE TABLE t_con_text LINES h_tab_cntr.
READ TABLE t_con_text INDEX h_tab_cntr.
t_pak_list-transf_bin = ' '. " Binary=RAW
t_pak_list-head_start = 1.
t_pak_list-head_num = 0.
t_pak_list-body_start = h_body_start.
t_pak_list-body_num = h_tab_cntr.
t_pak_list-doc_type = h_real_type.
t_pak_list-obj_name = 'ATTACHMENT'(002).
t_pak_list-obj_descr = 'Report'(003).
t_pak_list-doc_size = ( h_body_num - 1 )
* 255 + STRLEN( t_con_text ).
ENDIF.
APPEND t_pak_list.
ENDIF.
* Send the EMAIL out with SAP function...
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = h_doc_data
put_in_outbox = 'X'
* commit_work = 'X'
TABLES
packing_list = t_pak_list
contents_bin = t_con_bin
contents_txt = t_con_text
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 syst-subrc NE 0.
* RAISE send_failed.
CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
EXPORTING
msg_arbgb = '00'
msg_nr = '001'
msg_ty = 'E'
msg_v1 = 'O/P Could not be issued '(001)
msg_v2 = ' Due to No Mail ID'(002)
msg_v3 = syst-msgv3
msg_v4 = syst-msgv4
EXCEPTIONS
OTHERS = 1.
* Check General incompletion status of the header
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
WRITE : 'SENT'.
ENDIF.
ELSE.
* commit work.
ENDIF.
ENDFORM. " SEND_MAIL_FAX
*& Form convert_otf_2_pdf
* text
* --> p1 text
* <-- p2 text
FORM convert_otf_2_pdf .
DATA: "t_line LIKE tline OCCURS 0 WITH HEADER LINE,
t_objcont LIKE soli OCCURS 0 WITH HEADER LINE,
d_doc_size(12) TYPE c,
d_fle1(2) TYPE p,
d_fle2(2) TYPE p,
d_off1 TYPE p,
d_hltlines TYPE i,
d_hfeld(500) TYPE c,
w_indx LIKE sy-tabix.
CLEAR: t_line, t_objcont, d_off1.
REFRESH: t_line, t_objcont.
* Check/set DEFAULT Desired-type attachment...
IF d_desired_type IS INITIAL. " Entered Desired type?
d_desired_type = 'PDF'. " NO - default to PDF
ENDIF. "
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = d_desired_type
IMPORTING
bin_filesize = d_doc_size
TABLES
otf = t_itcoo
lines = t_line
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc > 0.
RAISE otf_convert_failed.
ENDIF.
ENDFORM. " convert_otf_2_pdf
*& Form convert_otf_2_pdf_sx
* text
* --> p1 text
* <-- p2 text
FORM convert_otf_2_pdf_sx .
DATA:
t_otf LIKE solisti1 OCCURS 0 WITH HEADER LINE,"ENABLE
t_pdf LIKE tline OCCURS 0 WITH HEADER LINE,"ENABLE
doc_size(12) TYPE n,
len_out TYPE i,
x_real LIKE soodk-objtp,
x_idx_b LIKE sy-tabix,
x_idx_e LIKE sy-tabix.
IF d_desired_type = 'PDF'.
d_desired_type = 'OTF'.
ENDIF.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = d_spool_id
desired_type = d_desired_type
IMPORTING
real_type = x_real
TABLES
buffer = t_otf
buffer_pdf = t_pdf
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.
IF sy-subrc = 1.
RAISE invalid_spool_id.
ELSE.
RAISE otf_convert_failed.
ENDIF.
ENDIF.
* Check Desired-Type vs. Real-Type (if any)...
IF d_desired_type IS INITIAL.
IF x_real = 'OTF'.
d_desired_type = 'PDF'.
ELSE.
d_desired_type = x_real.
ENDIF.
ELSE.
IF ( d_desired_type = 'PDF' OR
d_desired_type = 'OTF' ) AND
( x_real = 'OTF' OR
x_real = 'PDF' ).
d_desired_type = 'PDF'.
ELSE.
IF d_desired_type <> x_real.
RAISE type_no_match.
ENDIF.
ENDIF.
IF ( d_desired_type = 'ALI' OR
d_desired_type = 'RAW' ) AND
x_real = 'OTF'.
RAISE type_no_match.
ENDIF.
ENDIF.
* Check if ABAP-LIST and not SapScript...
IF d_desired_type = 'ALI' OR
d_desired_type = 'RAW'.
t_soli[] = t_otf[].
EXIT.
ENDIF.
* Load OTF data gotten from spool...
LOOP AT t_otf.
t_itcoo = t_otf.
APPEND t_itcoo.
* if Vendor P/O (SapScript = Z_MEDRUCK) then
* trap INDEX for "Terms & Conditions" on BACK...
IF t_itcoo-tdprintcom = 'IN' AND
t_itcoo-tdprintpar = '01EZ_MEDRUCK BACK'.
x_idx_b = sy-tabix.
ENDIF.
IF t_itcoo-tdprintcom = 'IN' AND
t_itcoo-tdprintpar = '01EZ_MEDRUCK NEXT'.
x_idx_e = ( sy-tabix - 1 ).
ENDIF.
ENDLOOP.
* Drop from table if INDEX'S are set (see above)...
IF ( x_idx_b > 0 AND
( x_idx_e > x_idx_b ) ) .
DELETE t_itcoo FROM x_idx_b
TO x_idx_e.
ENDIF.
PERFORM convert_otf_2_pdf.
ENDFORM. " convert_otf_2_pdf_sx
*& Form CONVERSION_OF_SIZE *
* *"Converting the file to get a 255 char single line internal table *
* The PDF file that is generated out of the above function module *
* cannot be transported as it needs to be of 255 chars. Hence *
* converting the file to get a 255 char single line,internal table. *
FORM conversion_of_size .
"Declaring Local Constants............................................
CONSTANTS:
cnv_hexconst_zero TYPE x VALUE '00'.
* Internal table to hold 255 Char's Single Line. *
DATA:
lv_big_lines(268) TYPE c
OCCURS 0 WITH HEADER LINE.
*"Local Work Variables.................................................
DATA:
lfl_flag TYPE c,
lv_left_t(268) TYPE c,
lv_left_i TYPE i,
tv_left_i TYPE i,
lv_curr_i TYPE i.
FIELD-SYMBOLS: <f>.
* Get the lines into a table of 268 char as the first step to put it in
* the pdf file of 255 chars
CLEAR lfl_flag.
LOOP AT t_line.
IF lfl_flag EQ ' '.
CLEAR lv_big_lines.
ASSIGN lv_big_lines(134) TO <f>.
<f> = t_line.
lfl_flag = 'X'.
ELSE.
lv_big_lines+134 = t_line.
APPEND lv_big_lines.
CLEAR: lfl_flag.
ENDIF. " If lfl_flag = ''..
ENDLOOP. " Loop at t_pdf
IF lfl_flag EQ 'X'.
APPEND lv_big_lines.
ENDIF. " If lflf_flag eq 'X'..
* Next fill it into a 255 char table
CLEAR: lv_left_t, lv_left_i, tv_left_i.
lv_curr_i = 255.
LOOP AT lv_big_lines.
IF lv_left_i NE 0.
IF lv_curr_i NE 0.
wa_objcont(lv_left_i) = lv_left_t(lv_left_i).
wa_objcont+lv_left_i(lv_curr_i) = lv_big_lines(lv_curr_i).
ELSE.
wa_objcont = lv_left_t(lv_left_i).
ENDIF. " IF lv_curr_i NE 0
ELSE.
wa_objcont = lv_big_lines(lv_curr_i).
ENDIF. " IF lv_left_i NE 0
APPEND wa_objcont TO t_objcont.
tv_left_i = 268 - lv_curr_i.
IF tv_left_i > 255.
wa_objcont = lv_big_lines+lv_curr_i(255).
APPEND wa_objcont TO t_objcont.
lv_left_i = tv_left_i - 255.
tv_left_i = 255 + lv_curr_i.
lv_curr_i = 255 - lv_left_i.
lv_left_t = lv_big_lines+tv_left_i.
ELSE.
lv_left_t = lv_big_lines+lv_curr_i.
lv_left_i = 268 - lv_curr_i.
lv_curr_i = 255 - lv_left_i.
ENDIF. " IF tv_left_i > 255
ENDLOOP. " LOOP AT lv_big_lines.
CLEAR wa_objcont .
ASSIGN wa_objcont(lv_left_i) TO <f>.
<f> = lv_left_t(lv_left_i).
APPEND wa_objcont TO t_objcont.
h_transf_type = 'X'. " Transfer type BINARY...
IF NOT t_objcont[] IS INITIAL.
t_soli[] = t_objcont[]. " SapScript doc to Objects...
ENDIF.
regards
twinkal -
Sending an e-mail with pdf attachment and logo as a signature
Hi,
My task is to send an email with pdf attachement. And an image file need to be added as a signature. Is it possible, if so, can anyone please guide me?
Thanking you.
Kumar.Hi
I'm having the same issue, except my application actually sends the email but the attachment is 0 octet and it doesn't even give me an error... Any chance you found a solution for this and could share it ?
Thanks -
Workflow Step 'In Process'- Send mail with PDF attachment
Hi,
have to send mail with PDF attachment.
I have written a function module with following steps,
1. Convert SPOOL number to PDF using Function Module 'CONVERT_OTFSPOOLJOB_2_PDF'.
2. Send mail with PDF attachment using Function Module 'SO_DOCUMENT_SEND_API1'.
The Function Module is giving required output when tested and called in the report(Background Job).
When I call this Function Module from Method-> Workflow Task the Workflow steps status is 'In Process' and not ending.
Could you please help me on this??Hi shafath,
When you try to send mail, You need to call the function FP_JOB_OPEN before calling the function module to generate the pdf. ( /1B****) . Is it missing in your code? -
Printing Problems with PDF - Adobe Acrobat
Printer - HP Deskjet 3070A
Laptop - Asus Zenbook running Windows 7 Home Premium
Issue: Printing problems with PDF (Adobe Acrobat Reader)
Dear All,
Please help!
My printer was working absolutely perfectly until my brother in law recently needed to borrow my printer. He plugged in his laptop running Windows 8 (awful thing that is). Since he did this to print his own PDF, I cannot print mine.
Although all the text will appear on the page perfectly both in the document view and on actual printing, it appears that some of the transparent formatting stuff on a PDF - such as boxes you have to fill in and transparent areas (such as you find on glorious tax forms) are omitted completely. In fact, in their place I was getting a single black dot. Now, after uninstalling and re-installing updates for the printer, windows 7, adobe acrobat reader, etc.etc. I get squat. Just all the text laid out but none of the shading or boxes.
I have tried fiddling with the printer settings; the print as 'photo' option, dpi settings, greyscale - as much as I can think of and I am thoroughly stumped.
In a desperate attempt, I even installed the Universal Printer Drivers - thinking it might have been that. No. All I got was a page of gobbledygook. Consequently, I uninstalled and reinstalled the normal drivers again.
If there are any wonderful people out there with any fabulous ideas about how I can get my shading and boxes back; I'd very much appreciate it. Sadly I have a tax return to fill out (which is already fabulously late) and need my printer to work!
Much appreciation in advance xHey there @Reverie!
Thanks for posting on the HP Forums!
I can see that the printer is no longer printing in the correct format after it was plugged into the Windows 8 computer! You mentioned you have run the updates and uninstalled/re-installed the printer software. Have you uninstalled and re-installed the Adobe software? Are you getting the same issue from other programs as well? Are you getting the same issues if you are logged in as a different user on the computer?
I have located the HP Update Software Utility that may be able to help. You can download an run the utility. It may be able to locate any other updates for the printer.
I would also recommend running a disk cleanup on the computer to clear any temporary files and junk files that may be causing some performance or software issues. If you do not know how to run a disk cleanup on the computer please follow this document regarding Delete files using Disk Cleanup. It is recommended to restart the computer after a disk cleanup. After the restart try the print job again!
Let me know if that helped and thanks again for posting on the HP Forums!
Cbert
I work on behalf of HP.
Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
Click the “Kudos, Thumbs Up" at the bottom of this post to say “Thanks” for helping! -
Idoc to RNIF with pdf attachment
Hi
I am implementing a Idoc to RNIF with pdf attachment. I have to pick the pdf file from an ftp server in PI based on the invoice number in the idoc. I could not find a blog or documentation on how to attach the pdf file. The only viable solution I found is to create a module in this forum [Re: Using attachment with RNIF|Re: Using attachment with RNIF] Has anybody implemented this in any other way? Also, in this solution its not clear how both the messages and pdf file are reaching the rnif adapter together.
Can somebody give a step by step solution?
I am on PI 7.1 Ehp1
Thanks in advance
AsifAnyone working/worked with RNIF adapter would like to share their experience.
Maybe you are looking for
-
Multiple Line Items in billing
Dear All, I got one issue on production server,the scenario is like this, My client gives one Free of Cost (Item Category is TANN) On purchase of one material like XYZ(with item category TAN). And while creating Sales order it takes FOC automatically
-
Font display problem in Safari....
Hi-I am sure that this has been discussed here....... Anyway, on some pages in Safari the fonts are weird-there are large spaces between the letters and lots of S's and random capitalizations. None of the letters form a word. Is there a fix for this?
-
it appears to be the case that if you add podcast tracks to a playlist and set the playlist to shuffle, the podcast tracks are skipped. is there any way around this? can i reformat the podcast tracks to that they'll play randomly in playlists like ot
-
HP Pavilion dv7-2250ed and dual monitor setup
Good evening, Currently I own a HP Pavilion dv7-2250ed notebook using a dual monitor setup (notebook display + extra monitor) I wondered if it would be possible to hook 2 monitors to this laptop? (notebook display + extra monitor + extra monitor) If
-
Oracle Connector User-Name Issue: "Claude La User"
Folks - I have an Oracle Collaboration Suite User who has no issue connecting to the calendar server via the "Windows Oracle Calendar Client" Application or via the Calendar-Server Web-Interface: He has a somewhat unique 3-part name: We'll call him "