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 USE Class Interface CL_GUI_FRONTEND_SERVICES

Former Member
0 Kudos

Dear All,

I am working to get output of SMARTFORMS through report into PDF file.Following code i am using inside LOOP.

*CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG

  • EXPORTING

    • WINDOW_TITLE =

  • DEFAULT_EXTENSION = 'PDF'

  • DEFAULT_FILE_NAME = 'PAYSLIP.pdf'

    • WITH_ENCODING =

    • FILE_FILTER =

    • INITIAL_DIRECTORY =

    • PROMPT_ON_OVERWRITE = 'X'

  • CHANGING

  • FILENAME = W_FILE_NAME

  • PATH = W_FILE_PATH

  • FULLPATH = W_FULL_PATH

    • USER_ACTION =

    • FILE_ENCODING =

  • 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.

*

*CALL FUNCTION 'GUI_DOWNLOAD'

  • EXPORTING

  • BIN_FILESIZE = W_BIN_FILESIZE

  • FILENAME = W_FILE_NAME

  • FILETYPE = 'BIN'

  • TABLES

  • DATA_TAB = T_PDF_TAB.

*

*IF SY-SUBRC <> 0.

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

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

*ENDIF.

I am getting proper output through the above coding.

But problem is,if there will be a multiple PDF output it always ask the path to save each PDF file as i am using "FILE_SAVE_DIALOG"

I want all PDF files to save at once by giving default path of PC.

How can i do this, is there any other method i can use please

let me know...

Regards,

Ankur

3 REPLIES 3

former_member188685
Active Contributor
0 Kudos

don't use the method FILE_SAVE_DIALOG, instead you can dynamically pass the filepath to the gui_download , if you are sure of the filepath.

if you have multiple files then you can add the counter for the filenames(c:/payslip1.pdf, c:/payslip2.pdf etc )

0 Kudos

Hi,

I have used following code..

CALL METHOD cl_gui_frontend_services=>gui_download

EXPORTING

  • bin_filesize =

filename =

  • filetype = 'ASC'

  • append = SPACE

  • write_field_separator = SPACE

  • header = '00'

  • trunc_trailing_blanks = SPACE

  • write_lf = 'X'

  • col_select = SPACE

  • col_select_mask = SPACE

  • dat_mode = SPACE

  • confirm_overwrite = SPACE

  • no_auth_check = SPACE

  • codepage = SPACE

  • ignore_cerr = ABAP_TRUE

  • replacement = '#'

  • write_bom = SPACE

  • trunc_trailing_blanks_eol = 'X'

  • wk1_n_format = SPACE

  • wk1_n_size = SPACE

  • wk1_t_format = SPACE

  • wk1_t_size = SPACE

  • IMPORTING

  • filelength =

changing

data_tab = T_PDF_TAB

.

but the error it is giving that "T_PDF_TAB is not a compatible type".

0 Kudos

i think you are using the table with header line, show the table declaration..?

CALL METHOD cl_gui_frontend_services=>gui_download

EXPORTING

bin_filesize =

filename = "? where is the filepath

filetype = 'ASC'

append = SPACE

write_field_separator = SPACE

header = '00'

trunc_trailing_blanks = SPACE

write_lf = 'X'

col_select = SPACE

col_select_mask = SPACE

dat_mode = SPACE

confirm_overwrite = SPACE

no_auth_check = SPACE

codepage = SPACE

ignore_cerr = ABAP_TRUE

replacement = '#'

write_bom = SPACE

trunc_trailing_blanks_eol = 'X'

wk1_n_format = SPACE

wk1_n_size = SPACE

wk1_t_format = SPACE

wk1_t_size = SPACE

IMPORTING

filelength =

changing

data_tab = T_PDF_TAB[]. "use body