You are on page 1of 9

Community

Follow

Ask a Question Write a Blog Post Login


 Like

 RSS Feed

Technical Articles

Rohith Ramagiri
December 28, 2020
| 2 minute read

Download adobe form into local system in PDF format.


 0  1  3,169

Introduction:

I came across a situation where my client wants to download and save adobe form into local system in PDF format from the report on the
user confirmation. Confirmation message is shown when the user clicks back from output screen.

The below are the following function modules and methods:

FP_JOB_OPEN
FP_FUNCTION_MODULE_NAME
FP_JOB_CLOSE
POPUP_TO_CONFIRM
SCMS_XSTRING_TO_BINARY
cl_gui_frontend_services=>gui_download
cl_gui_frontend_services=>execute
Follow
Step 1:

Call function ‘FP_JOB_OPEN’.  Like

Here, we pass the form’s output parameters into lv_fp_outputparams.


 RSS Feed

CALL FUNCTION 'FP_JOB_OPEN'

CHANGING

ie_outputparams = lv_fp_outputparams

EXCEPTIONS

cancel = 1

usage_error = 2

system_error = 3

internal_error = 4

OTHERS = 5.

IF sy-subrc <> 0.

ENDIF.

Step 2:

Call function ‘FP_FUNCTION_MODULE_NAME’

Gets the technical name of the generated form.

CALL FUNCTION 'FP_FUNCTION_MODULE_NAME' "& Form Processing Generation

EXPORTING

i_name = ' ' "&Adobe form name

IMPORTING

e_funcname = lv_fm_name.

IF sy-subrc <> 0.

ENDIF.
Follow
ELSE.

   Like

Step 3:
 RSS Feed
Call function ‘lv_fm_name’ (This variable contains technical name of the form). Here, we get a pdf in xsting format generated in
‘lv_fp_formutput-pdf’.

CALL FUNCTION lv_fm_name

EXPORTING

/1bcdwb/docparams = lv_fp_docparams

gw_ers = gw_ers

IMPORTING

/1bcdwb/formoutput = lv_fp_formoutput

EXCEPTIONS

usage_error = 1

system_error = 2

internal_error = 3.

IF sy-subrc <> 0.

ENDIF.

Step 4:

Call function ‘FP_JOB_CLOSE’.

CALL FUNCTION 'FP_JOB_CLOSE'

* IMPORTING

* e_result =

EXCEPTIONS

usage_error = 1

system_error Follow
= 2

internal_error = 3

OTHERS = 4.

IF sy-subrc <> 0.
 Like
ENDIF.

   RSS Feed

Step 5:

Call function ‘POPUP_TO_CONFIRM’ (The is optional).

We use this function module to generate an editable pop up to confirm saving the form into local system.

CALL FUNCTION 'POPUP_TO_CONFIRM'

EXPORTING

text_question = text_question

display_cancel_button = ' '

IMPORTING

answer = answer

EXCEPTIONS

text_not_found = 1

OTHERS = 2.

Step 6:

I have executed the following FM’s when user click’s ‘Yes’ in the step 5.

Call function ‘SCMS_XSTRING_TO_BINARY’.


This function module converts xstring data to binary data from lv_fp_formoutput-pdf into data_tab.

Follow
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'

EXPORTING

buffer = Like
lv_fp_formoutput-pdf

TABLES

binary_tab = data_tab.
 RSS Feed
 

Step 7:

Using this method we can download the generated form. Here, we have to mention the desired file path in the exporting parameter
‘Filename’. We can save and open our file in the desired path.

CALL METHOD cl_gui_frontend_services=>gui_download

EXPORTING

filename = filename1

filetype = 'BIN'

CHANGING

data_tab = data_tab

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

Follow
unknown_dp_error = 14

access_denied = 15

dp_out_of_memory = 16

disk_full  Like = 17

dp_timeout = 18

file_not_found = 19

 RSS Feed
dataprovider_exception = 20

control_flush_error = 21

not_supported_by_gui = 22

error_no_gui = 23

OTHERS = 24.

IF sy-subrc <> 0.

ENDIF.

Step 8:

This method is optional. Here, we can able to view the saved or downloaded form in the local system or desktop.

CALL METHOD cl_gui_frontend_services=>execute

EXPORTING

document = filename

EXCEPTIONS

cntl_error = 1

error_no_gui = 2

bad_parameter = 3

file_not_found = 4

path_not_found = 5

file_extension_unknown = 6

error_execute_failed = 7

synchronous_failed = 8

not_supported_by_gui = 9

others = 10

.
Follow
IF sy-subrc <> 0.

* Implement suitable error handling here

ENDIF.  Like

 
 RSS Feed
Conclusion:

Using the above steps one can save the adobe form into local system in PDF format at the desired path.

Thanks for Reading.

Hope this post would be helpful.

Alert Moderator

Assigned Tags

ABAP Development

Similar Blog Posts 


Simple way to generate a pdf of adobe form and save it in local pc in Webdynpro on clicking hyperlink.
By
Thammunuri Ramya Feb 16, 2021

Create Webservice enabled Adobe PDF attachment in CRM Application


By
Jerry Wang May 16, 2014

Follow
Dynamic Fonts in Adobe Forms
By
Sambeet Mohapatra Dec 12, 2013

 Like

Related Questions
 RSS Feed

Adobe form - download the aodbe form
By
Former Member Feb 25, 2009

PDF Preview Download as .pdf


By
Former Member Mar 28, 2018

Adobe Forms function module - downloading the xstring output in PDF file
By
Former Member Jun 17, 2010

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Find us on
Follow
Privacy Terms of Use

Legal Disclosure  LikeCopyright

Trademark
 RSS Feed
Newsletter Support

You might also like