Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Pdf file unreadable

lijo_raj2
Explorer
0 Likes
972

Hi Experts,

I have a program where it sends an email to the customer with a PDF file as an attachment. But in one scenario the attachment couldnot be opened. While trying to open the pdf file it shows an error 'Adobe reader couldnot open the file because either it is not a supported file or because the file has been damaged'.

As we are not able to reproduce the same issue in Development we are not able to find the exact reason for this. Can you please give me some points which possibly could be the reasons for this error.

Hi Experts,

I have a program where it sends an email to the customer with a PDF file as an attachment. But in one scenario the attachment couldnot be opened. While trying to open the pdf file it shows an error 'Adobe reader couldnot open the file because either it is not a supported file or because the file has been damaged'.

As we are not able to reproduce the same issue in Development we are not able to find the exact reason for this. Can you please give me some points which possibly could be the reasons for this error.

4 REPLIES 4
Read only

Former Member
0 Likes
898

hi,

it means that pdf file doesn't have data or does not exits.

please provide some more technical information to give better answer.

regards,

padmaja

Read only

0 Likes
898

Hi Padmajavaddi ,

I have checked and the data to be converted is present.

What technical details should i provide you.

Thanks for your valuable time

Read only

Former Member
0 Likes
898

Did you recently upgrade the system? SAP note 787418 should be able to help you on this.

Read only

Former Member
0 Likes
898

hi ,

I have faced the same problem , but i solved it using OOPS .

You can use it.Below is the code

TRY.

  • -------- create persistent send request ------------------------

send_request = cl_bcs=>create_persistent( ).

  • -------- create and set document -------------------------------

pdf_content1 = cl_document_bcs=>xstring_to_solix( bin_file1 ).

READ TABLE i_packing_list INDEX 1.

document = cl_document_bcs=>create_document(

i_type = 'RAW'

i_text = li_text

i_subject = l_mtitle ).

READ TABLE i_packing_list INDEX 2.

document->add_attachment( i_attachment_type = 'PDF'

i_attachment_subject = l_mtitle1

i_att_content_hex = pdf_content1 ).

  • add document object to send request

send_request->set_document( document ).

  • --------- add recipient (e-mail address) -----------------------

  • create recipient object

recipient = cl_cam_address_bcs=>create_internet_address( mailto ).

  • add recipient object to send request

send_request->add_recipient( i_recipient = recipient

i_express = 'X' i_copy = lx_copy ).

  • send_request->add_recipient( recipient ).

  • ---------- send document ---------------------------------------

sent_to_all = send_request->send( i_with_error_screen = 'X' ).

CATCH cx_bcs INTO bcs_exception.

ENDTRY.