cancel
Showing results for 
Search instead for 
Did you mean: 

Generate form (developed in smartforms) to local drive

Former Member
0 Kudos

Hi experts,

I have a requirement that development a smartforms and output it into a local directory.

Let's say, the user will press on a button and it will generate a pdf file (developed from smartforms) into the user's local C drive.

Can someone provide me some guidelines? Is this possible to do it?

Any clues are appreciated.

Thank you.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Code it like below:

DATA: pdftab type standard TABLE OF tline,

datab TYPE standard TABLE OF itcoo.

itcpo-tdgetotf = 'X'.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

DEVICE = 'PRINTER'

DIALOG = 'X'

FORM = 'ZFORM'

LANGUAGE = SY-LANGU

OPTIONS = itcpo

// call script using start_form and write_form.

CALL FUNCTION 'CLOSE_FORM'

TABLES

OTFDATA = datab

EXCEPTIONS

UNOPENED = 1

BAD_PAGEFORMAT_FOR_PRINT = 2

SEND_ERROR = 3

SPOOL_ERROR = 4

CODEPAGE = 5

OTHERS = 6

.

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

FORMAT = 'PDF'

IMPORTING

BIN_FILESIZE = BINFILE

TABLES

otf = datab

lines = pdftab

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

BIN_FILESIZE = binfile

filename = 'C:\MYFILE.PDF' ---> give the path where u want to download

FILETYPE = 'BIN'

tables

data_tab = pdftab

Hope it helps!!

Rgds,

Pavan

Answers (0)