Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

saving several pdf forms to one file

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.

Not what you were looking for? View more on this topic or Ask a question