cancel
Showing results for 
Search instead for 
Did you mean: 

saving several pdf forms to one file

Former Member
0 Kudos

Hi to all,

I create ADOBE form and save it from the printing program.

I call to the form in loop, evry time I send it diffrent data.

I want the all the forms will be saved in one file.

I see that the file that created is getting bigger in evry loop, but when I try to opwn it in Acrobat Reader (not from sap) I see only the last page I saved.

Please review the code and tell me what I am doing wrong:

CALL FUNCTION 'FP_JOB_OPEN'

CHANGING

ie_outputparams = fp_outputparams

EXCEPTIONS

cancel = 1

usage_error = 2

system_error = 3

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

LOOP AT lt_emp_details INTO ls_emp_details.

  • CALL FUNCTION '/1BCDWB/SM00000018'

CALL FUNCTION l_fm_name

EXPORTING

/1bcdwb/docparams = fp_docparams

ls_emp_data = ls_emp_details

IMPORTING

/1bcdwb/formoutput = fp_result

EXCEPTIONS

usage_error = 1

system_error = 2

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

filename =p_path.

CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'

EXPORTING

buffer = fp_result-pdf

  • append_to_table = 'X'

TABLES

binary_tab = gt_file.

cl_gui_frontend_services=>gui_download( EXPORTING

filename = filename

filetype ='BIN'

append = 'X'

CHANGING

data_tab = gt_file ).

  • PERFORM download_file.

ENDLOOP.

CALL FUNCTION 'FP_JOB_CLOSE'

IMPORTING

e_result = result

EXCEPTIONS

usage_error = 1

system_error = 2

internal_error = 3

OTHERS = 4.

Thanks in advanced

Chaya.

Accepted Solutions (0)

Answers (2)

Answers (2)

kmoore007
Active Contributor
0 Kudos

Did anyone get this to work? I have the same requirement.

Former Member
0 Kudos

Hi,

The problem is that on every form you fet while calling the function module, you get the header information of an ADOBE Forms so when you try to open it you will see the latest one ...

The ideal solution is to merge all your document into one , unfortunately it's not possible while using ADS in SAP .

An alternative for your problem is to modify your form in order to have page break while changing of forms . Then you will retrieve only one form with all page and that should work.

Hope this is clear and help you .

Regards.