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 Conversion Error in Email

Former Member
0 Likes
1,022

Hi Experts,

my task is to convert a smartform into pdf & download & email. in two different programs

download program i converted smartform using 'CONVERT_OTF_2_PDF' and its working fine with no problem.

and in email program when tried the same one, I have a error as the PDF file is damaged and could not be repaired.

So I used 'CONVERT_OTF', its working fine and can send emails to external systems with no errors.

Now my problem is in the email, when i open the attachement, i getting a error in Pdf file.

"Cannot extract the embedded font Arial. Some characters may not be display or print correctly".

Please tell me how to close this error.

Thanks & regards,

Dileep .C

5 REPLIES 5
Read only

Former Member
0 Likes
836

check this

[https://www.sdn.sap.com/irj/scn/forums]

[https://www.sdn.sap.com/irj/scn/forums]

Read only

0 Likes
836

Hi Poorna,

Please send the links again,

Hi Sai,

I dont have that example in my system. please send teh sample code or tell any other program.

Thanks in advance

-Dunlop

Read only

0 Likes
836

hi,

----


  • Report BCS_EXAMPLE_6

----


  • Email documents using PDF based forms

----


REPORT bcs_example_6.

DATA: carr_id TYPE sbook-carrid.

PARAMETER: p_custid TYPE scustom-id DEFAULT 12.

SELECT-OPTIONS: s_carrid FOR carr_id DEFAULT 'AA' TO 'ZZ'.

PARAMETER: p_email TYPE adr6-smtp_addr OBLIGATORY.

DATA: customer TYPE scustom,

bookings TYPE ty_bookings,

connections TYPE ty_connections,

fm_name TYPE rs38l_fnam,

fp_docparams TYPE sfpdocparams,

fp_outputparams TYPE sfpoutputparams,

error_string TYPE string.

DATA ls_formoutput TYPE fpformoutput.

DATA lx_fp_api TYPE REF TO cx_fp_api.

data lp_form TYPE tdsfname value 'FP_TEST_03'.

data lp_langu TYPE langu value 'D'.

data lp_countr TYPE land1 value 'DE'.

  • BCS data

DATA send_request TYPE REF TO cl_bcs.

DATA text TYPE bcsy_text.

DATA document TYPE REF TO cl_document_bcs.

DATA recipient TYPE REF TO if_recipient_bcs.

DATA: bcs_exception TYPE REF TO cx_bcs.

DATA sent_to_all TYPE os_boolean.

DATA pdf_content TYPE solix_tab.

DATA lp_pdf_size TYPE so_obj_len.

  • get data

SELECT SINGLE * FROM scustom INTO customer WHERE id = p_custid.

CHECK sy-subrc = 0.

SELECT * FROM sbook INTO TABLE bookings

WHERE customid = p_custid

AND carrid IN s_carrid

ORDER BY PRIMARY KEY.

SELECT * FROM spfli INTO TABLE connections

FOR ALL ENTRIES IN bookings

WHERE carrid = bookings-carrid

AND connid = bookings-connid

ORDER BY PRIMARY KEY.

  • Print data:

  • First get name of the generated function module

TRY.

CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'

EXPORTING

i_name = lp_form

IMPORTING

e_funcname = fm_name.

CATCH cx_fp_api INTO lx_fp_api.

  • exception handling

MESSAGE ID lx_fp_api->msgid TYPE lx_fp_api->msgty

NUMBER lx_fp_api->msgno

WITH lx_fp_api->msgv1 lx_fp_api->msgv2

lx_fp_api->msgv3 lx_fp_api->msgv4.

EXIT.

ENDTRY.

  • Set output parameters and open spool job

fp_outputparams-nodialog = 'X'. " no print preview

fp_outputparams-getpdf = 'X'. " request PDF

CALL FUNCTION 'FP_JOB_OPEN'

CHANGING

ie_outputparams = fp_outputparams

EXCEPTIONS

cancel = 1

usage_error = 2

system_error = 3

internal_error = 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.

  • Set form language and country (->form locale)

fp_docparams-langu = lp_langu.

fp_docparams-country = lp_countr.

  • Now call the generated function module

CALL FUNCTION fm_name

EXPORTING

/1bcdwb/docparams = fp_docparams

customer = customer

bookings = bookings

connections = connections

IMPORTING

/1bcdwb/formoutput = ls_formoutput

EXCEPTIONS

usage_error = 1

system_error = 2

internal_error = 3

OTHERS = 4.

IF sy-subrc <> 0.

CALL FUNCTION 'FP_GET_LAST_ADS_ERRSTR'

IMPORTING

e_adserrstr = error_string.

IF NOT error_string IS INITIAL.

  • we received a detailed error description

WRITE:/ error_string.

EXIT.

ELSE.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDIF.

  • Close spool job

CALL FUNCTION 'FP_JOB_CLOSE'

  • IMPORTING

  • E_RESULT =

EXCEPTIONS

usage_error = 1

system_error = 2

internal_error = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

  • ------------ Call BCS interface ----------------------------------

TRY.

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

send_request = cl_bcs=>create_persistent( ).

  • ---------- add document ----------------------------------------

  • get PDF xstring and convert it to BCS format

lp_pdf_size = XSTRLEN( ls_formoutput-pdf ).

pdf_content = cl_document_bcs=>xstring_to_solix(

ip_xstring = ls_formoutput-pdf ).

document = cl_document_bcs=>create_document(

i_type = 'PDF'

i_hex = pdf_content

i_length = lp_pdf_size

i_subject = 'test created by BCS_EXAMPLE_6' ). "#EC NOTEXT

  • add document to send request

send_request->set_document( document ).

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

recipient = cl_cam_address_bcs=>create_internet_address(

i_address_string = p_email ).

  • add recipient to send request

send_request->add_recipient( i_recipient = recipient ).

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

sent_to_all = send_request->send(

i_with_error_screen = 'X' ).

IF sent_to_all = 'X'.

message i022(so).

ENDIF.

  • ---------- explicit 'commit work' is mandatory! ----------------

COMMIT WORK.

  • ------------------------------------------------------------------

  • * exception handling

  • ------------------------------------------------------------------

  • * replace this very rudimentary exception handling

  • * with your own one !!!

  • ------------------------------------------------------------------

CATCH cx_bcs INTO bcs_exception.

WRITE: text-001.

WRITE: text-002, bcs_exception->error_type.

EXIT.

ENDTRY.

Read only

Former Member
0 Likes
836

Hi

I hope you have done correct but it might be possible bez of Adobe reader if not

Check the Program "BCS_EXAMPLE_6" it will help you .

Read only

Former Member
0 Likes
836

Hi Dunlop,

You just type this in Google "Cannot extract the embedded font Arial. Some characters may not be display or print correctly".

You will get the 100's of solution,

Thanks & Regards,

Dileep .C