Skip to Content
0
Former Member
Jun 26, 2008 at 11:51 AM

smart form conversion in PDF

27 Views

Hi Guys,

I have one query in the smartforms, I can able to convert the smartform to PDF and saving the PDF in my DESKTOP directly with showing the POP_UP, when i choose the print preview in the POP-UP screen.

*My Requirement is : I need to display the PDF details first and later i will chose the save option, Could you add your comments.

As of now i am using below code the PDF saving in the DESKTOP, Could any ple add your suggestion how to show the PDF with out saving the PDF.

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

FORMAT = 'PDF'

IMPORTING

BIN_FILESIZE = LOC_PDF_LEN

TABLES

OTF = INT_OTF

LINES = IT_LINES

EXCEPTIONS

ERR_MAX_LINEWIDTH = 1

ERR_FORMAT = 2

ERR_CONV_NOT_POSSIBLE = 3

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

  • To display File SAVE dialog window

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG

CHANGING

FILENAME = LOC_FILE_NAME

PATH = LOC_FILE_PATH

FULLPATH = LOC_FULL_PATH

EXCEPTIONS

CNTL_ERROR = 1

ERROR_NO_GUI = 2

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

  • Use the FM GUI_DOWNLOAD to download the generated PDF file onto the

  • presentation server

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

BIN_FILESIZE = LOC_PDF_LEN

FILENAME = LOC_FULL_PATH

FILETYPE = 'BIN'

TABLES

DATA_TAB = IT_LINES

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_BATCH = 2

GUI_REFUSE_FILETRANSFER = 3

INVALID_TYPE = 4

NO_AUTHORITY = 5

UNKNOWN_ERROR = 6

HEADER_NOT_ALLOWED = 7

SEPARATOR_NOT_ALLOWED = 8

FILESIZE_NOT_ALLOWED = 9

HEADER_TOO_LONG = 10

DP_ERROR_CREATE = 11

DP_ERROR_SEND = 12

DP_ERROR_WRITE = 13

UNKNOWN_DP_ERROR = 14

ACCESS_DENIED = 15

DP_OUT_OF_MEMORY = 16

DISK_FULL = 17

DP_TIMEOUT = 18

FILE_NOT_FOUND = 19

DATAPROVIDER_EXCEPTION = 20

CONTROL_FLUSH_ERROR = 21

OTHERS = 22.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.