Application Development and Automation 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: 
Read only

Automatically Save PDF Form

Former Member
0 Likes
1,478

Hi

I have a pdf form that read the employee details from the PA tables.

Usualy the pdf form displays in preview but now i have a request to automaticaly save the file in a folder.

The user will have a screen with a button "Generate Employee Form" when the user will press this button the system will generate the from in the backround and save a pdf file in the target folder.

Is there a way to do that ?

Thanks

4 REPLIES 4
Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
1,149

Hi

Anyway you are getting the form in preview screen right?

You can print that form and create a spool.

convert that spool to pdf and save that in the required folder.

This is just one way may be you man get best way than this too.

Thanks,

Sreeram

Read only

Florian
SAP Champion
SAP Champion
0 Likes
1,149

Hi elad,

why not, process the form.

Use Function-stone convert_otf_to_pdf (in case of you are using a smartforms/sapscript) and create a method to save it in a serverfolder.

For that you can have a look at open dataset if you want to do it in a basic way

Regards

Florian

Read only

Former Member
0 Likes
1,149

hi,

once you convert otf to pdf, do the code below


                     .

Here hard code your filepath (target folder).

w_full_path = target folder.

and then

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

* BIN_FILESIZE = W_bin_filesize

filename = w_FULL_PATH

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.

Regards -

Makarand

Read only

Former Member
0 Likes
1,149

Hey elad,

You can follow the procedure which Makarand has explained. Use the FM CONVERT_OTF to convert to PDF and use 'GUI_DOWNLOAD' to download the PDF to the required directory.

Regards

Anoop