cancel
Showing results for 
Search instead for 
Did you mean: 

can i set pf-status in print preview of form

Former Member
0 Kudos

I want to download a smartform in pdf after viewing the print preview .

For that i want to give a button / menu in the form print preview page.

can i set pf-status for that ?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Please find the Snippet below

*Calling the Function Module of the SmartForm

CALL FUNCTION l_fmodule

EXPORTING

CONTROL_PARAMETERS = wa_cparam

HEADER = wa_emp

IMPORTING

JOB_OUTPUT_INFO = it_otf_from_fm

TABLES

APPRAISALS = it_emp1

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4

OTHERS = 5.

IF SY-SUBRC <> 0.

case sy-subrc.

when 1.

message e005.

when 2.

message e010.

endcase.

ENDIF.

it_otf[] = it_otf_from_fm-otfdata[].

*PDF Preview

CALL FUNCTION 'SSFCOMP_PDF_PREVIEW'

EXPORTING

I_OTF = it_otf[]

EXCEPTIONS

CONVERT_OTF_TO_PDF_ERROR = 1

CNTL_ERROR = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

case sy-subrc.

when 1.

message e006.

endcase.

ENDIF.

*Converting into PDF Format

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

FORMAT = 'PDF'

MAX_LINEWIDTH = 132

IMPORTING

BIN_FILESIZE = l_bin_filesize

TABLES

OTF = IT_OTF

LINES = IT_pdf_tab

EXCEPTIONS

ERR_MAX_LINEWIDTH = 1

ERR_FORMAT = 2

ERR_CONV_NOT_POSSIBLE = 3

ERR_BAD_OTF = 4

OTHERS = 5.

Function Module 'SSFCOMP_PDF_PREVIEW' will Show the PDF Preview while executing the Driver Program.

And the 'CONVERT_OTF' Function Module will convert it to the PDF.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

BIN_FILESIZE = l_bin_filesize

FILENAME = l_FULL_PATH

FILETYPE = c_bin

TABLES

DATA_TAB = IT_pdf_tab

The Above function Module will Download the content of smart form in the PDF Format.

This may help you.

Thanks and Regards,

Prakash K

Answers (0)