cancel
Showing results for 
Search instead for 
Did you mean: 

.PDF download code is not working for 7000 records or more in ABAP

Subbaka11
Participant
0 Kudos
437

Hello Team,

I have internal table data which contains Header and Item records I am using adobe form to display these header and Item records.

My report would download .PDF file in desktop... this logic works for 10 to 200 suppliers, but when I run the same program for 6000 to 7000, 0KB file is getting downloaded and I am unable to open it.

It is clear that .PDF option is not working for thousands of records.

Is there any solution for this issue ? Or downloading PDF files have any limitations with no of records?

CONCATENATE 'C:\DESKTOP\ap_report' sy-uzeit '.PDF' INTO filename.

DATA:
ls_outputparams TYPE sfpoutputparams,
ls_docparams TYPE sfpdocparams,
ls_pdf_file TYPE fpformoutput,

lv_fm_name TYPE rs38l_fnam,
lv_device TYPE output_device,
lv_failed TYPE boole_d.

DATA:
gt_content TYPE STANDARD TABLE OF tdline,
len TYPE i.

DATA: i_inpf TYPE pcfile-path,
o_drive TYPE pcfile-drive,
o_path TYPE pcfile-path,
gs_interface TYPE ty_agig.


CLEAR : gs_interface .

ls_outputparams-nodialog = 'X'.
ls_outputparams-getpdf = 'X'.
ls_outputparams-connection = 'ADS'.
ls_outputparams-dest = 'LP01'.
ls_outputparams-pdltype = 'pdf'.

CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = ls_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.

TRY.
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = 'ZRTR_PAYABLE'
IMPORTING
e_funcname = lv_fm_name.
CATCH cx_fp_api_repository
cx_fp_api_usage
cx_fp_api_internal.

RETURN.
ENDTRY.
*BREAK Vtibirisetti .
lt_supplier_h = lt_supplier .
SORT lt_supplier_h BY supplier .
DELETE ADJACENT DUPLICATES FROM lt_supplier_h COMPARING supplier .

CALL FUNCTION lv_fm_name
EXPORTING
/1bcdwb/docparams = ls_docparams
* sls_prt_com = gs_interface
lt_supplier_h = lt_supplier_h
lt_supplier = lt_supplier
lt_amount = lt_amount
IMPORTING
/1bcdwb/formoutput = ls_pdf_file
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
* ENDIF.

"Convert xstring/rawstring to binary ITAB
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
* buffer = xstr_content
buffer = ls_pdf_file-pdf
IMPORTING
output_length = len
TABLES
binary_tab = gt_content.

i_inpf = filename.

CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = i_inpf
* CHECK_DOS_FORMAT =
IMPORTING
drive = o_drive
* EXTENSION =
* NAME =
* NAME_WITH_EXT =
path = i_inpf
EXCEPTIONS
invalid_drive = 1
invalid_extension = 2
invalid_name = 3
invalid_path = 4
OTHERS = 5.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = len
filename = filename
filetype = 'BIN'
TABLES
data_tab = gt_content
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
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc <> 0.
MESSAGE 'Unable to download file from SAP'
TYPE 'E'.
ENDIF.

Accepted Solutions (1)

Accepted Solutions (1)

RaymondGiuseppi
Active Contributor
0 Kudos

Did you already look for an OSS note related to your version, e.g. 3075257 - Java components for S/4HANA 2021 – Restrictions which provides links to required information on limitations and suggests application-side workaround.

Answers (0)