Application Development 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: 

how to convert smart form to PDF ?

Former Member
0 Kudos

i want to convert the smartform output to PDF format, i am using convert_otf, convert_otf_to_pdf, GUI_download function module. but i am getting an information saying "OTF end command // missing in OTF" . Please help to resolve this problem

3 REPLIES 3

Former Member
0 Kudos

Hi,

Set the Control Parameter GETOTF in structure CONTROL_PARAMETERS as 'X' (Interface Parameter to Smart Form) and then use CONVERT_OTF_TO_PDF and GUI_DOWNLOAD.

Manoj

Former Member
0 Kudos

hi

good

try to use this i hope this ll help you to solve your problem,

        • 1. call the smart form FM

CALL FUNCTION '/xxx/xxxx'

EXPORTING

user_settings = space

control_parameters = control_parameters

output_options = output_options

IMPORTING

job_output_info = output_data

TABLES

zsystems = lt_sys

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

        • 2. convert the OTF data to PDF

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

IMPORTING

bin_filesize = l_pdf_len

bin_file = l_pdf_xstring

TABLES

otf = output_data-otfdata

lines = lt_lines

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

err_bad_otf = 4

OTHERS = 5.

thanks

mrutyun^

Former Member
0 Kudos

The procedure for the form to be returned as a table in OTF format is as follows:

1. Define a structure of type SSFCTRLOP (control structure, standard parameter CONTROL_PARAMETERS) and another structure of type SSFCRESCL (to contain the output results, standard parameter JOB_OUTPUT_INFO):

DATA: my_control_pars TYPE ssfctrlop. "For CONTROL_PARAMETERS

DATA: my_output_info TYPE ssfcrescl. "For JOB_OUTPUT_INFO

2. To deactivate the dialogs and to inform SAP Smart Forms that you only want the OTF table to be returned, set the parameters NO_DIALOG and GETOTF of the control structure:

my_control_pars-no_dialog = 'X'.

my_control_pars-getotf = 'X'.

3. Pass both structures in the call of the generated function module.

Now access the OTF table in the formal parameter JOB_OUTPUT_INFO using the OTFDATA parameter of your structure.

4. Get the OTF output from table OTFDATA of the standard parameter JOB_OUTPUT_INFO.

5. To convert the OTF output to PDF, transfer the OTF table to the function module CONVERT_OTF. To do this, set the parameter FORMAT to 'PDF'. The output can be returned either as a binary string (parameter BIN_FILE) or as a character table (parameter LINES). SAP recommends the first variant.

CALL FUNCTION "CONVERT_OTF"

EXPORTING FORMAT = "PDF"

IMPORTING BIN_FILESIZE = FILE_LEN

TABLES OTF = OTFDATA

LINES = PDFDATA

EXCEPTIONS ERR_MAX_LINEWIDTH = 1

ERR_FORMAT = 2

ERR_CONV_NOT_POSSIBLE = 3

OTHERS = 4.

I hope it helps.

Best Regards,

Vibha

*Please mark all the helpful answers