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

Convert OTF to PDF problem

Former Member
0 Likes
1,155

Hi everyone,

I am currently testing a report in our acceptance box. The report is converting a sapscript form output to OTF. Then the OTF result will be converted to PDF that will be sent to external email address as attachment. However, when I checked the PDF result in acceptance box, it is not of ASCII type. In development box, the PDF result is ASCII. Does this mean that the OTF, PDF settings in the 2 SAP boxes are not the same.

As you can see, this is the converted PDF in dev box. This is working okay.

--> %PDF-1.3##%aaDO##2 0 obj##<<##/Length 3 0 R##/Filter /ASCIIHexDecode##/Length1 5866##/Length2 29788##/Length3 544##>>##stream##25215

But in acceptance box, the codes are different. This one is not working.

--> %PDF-1.3##%aaDO##2 0 obj##<<##/Type /FontDescriptor##/Ascent 720##/CapHeight 660##/Descent -270##/Flags 32##/FontBBox [-177 -269 112

Does this have to do with the OTF, PDF settings defined in the systems? Where should we check the settings of these 2 formats?

Thanks!

Hi everyone,

I am currently testing a report in our acceptance box. The report is converting a sapscript form output to OTF. Then the OTF result will be converted to PDF that will be sent to external email address as attachment. However, when I checked the PDF result in acceptance box, it is not of ASCII type. In development box, the PDF result is ASCII. Does this mean that the OTF, PDF settings in the 2 SAP boxes are not the same.

As you can see, this is the converted PDF in dev box. This is working okay.

--> %PDF-1.3##%aaDO##2 0 obj##<<##/Length 3 0 R##/Filter /ASCIIHexDecode##/Length1 5866##/Length2 29788##/Length3 544##>>##stream##25215

But in acceptance box, the codes are different. This one is not working.

--> %PDF-1.3##%aaDO##2 0 obj##<<##/Type /FontDescriptor##/Ascent 720##/CapHeight 660##/Descent -270##/Flags 32##/FontBBox [-177 -269 112

Does this have to do with the OTF, PDF settings defined in the systems? Where should we check the settings of these 2 formats?

Thanks!

2 REPLIES 2
Read only

Former Member
0 Likes
668

Check if standard RSTXPDFT4 works same way. Will narrow down the Error possibility.

The report is converting a sapscript form output to OTF.

Sapscript already generates OTF you just need to convert it to PDF.

Read only

0 Likes
668

Hi,

Try to use function module SX_OBJECT_CONVERT_OTF_PDF as shown below:

We had a similar requirement and we need to send email with attachment as the output of SMARTFORM in to PDF.

IF lv_kschl EQ 'Z300'.
*Call function for sales order or return order
    CALL FUNCTION lf_fm_name
      EXPORTING
        archive_index        = toa_dara
        archive_parameters   = arc_params
        control_parameters   = ls_control_param
        mail_recipient       = ls_recipient
        mail_sender          = ls_sender
        output_options       = ls_composer_param
        user_settings        = ' '
        znast                = nast
        zvbdka               = vbdka
        zaddres              = addr_key
      IMPORTING
        document_output_info = document_output_info
        job_output_info      = job_output_info
        job_output_options   = job_output_options
      TABLES
        ztvbdpa              = tvbdpa
      EXCEPTIONS
        formatting_error     = 1
        internal_error       = 2
        send_error           = 3
        user_canceled        = 4
        OTHERS               = 5.

    IF sy-subrc <> 0.
      retcode = sy-subrc.
      PERFORM protocol_update.

* get SmartForm protocoll and store it in the NAST protocoll
      PERFORM add_smfrm_prot.
    ENDIF.

   IF ls_control_param-getotf = 'X'. 
    zzotfdata[] = job_output_info-otfdata.
    LOOP AT zzotfdata INTO wa_otfdata.
      CONCATENATE wa_otfdata-tdprintcom wa_otfdata-tdprintpar INTO wa_pdf.
      APPEND wa_pdf TO i_context_txt.
    ENDLOOP.

    CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
      EXPORTING
        format_src            = 'OTF'
        format_dst            = 'PDF'
       devtype               =  'PRINTER'
      CHANGING
        transfer_bin          = wa_tranfer_bin
        content_txt           = i_context_txt
        content_bin           = i_content_bin
        objhead               = i_objhead
        len                   = v_len_in
*    EXCEPTIONS
*      ERR_CONV_FAILED       = 1
*      OTHERS                = 2
              .
    IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ELSE.
      v_size = v_len_in.
      EXPORT i_content_bin[] TO MEMORY ID 'ABCD'.
    ENDIF.
  ENDIF.

KR Jaideep,