Skip to Content

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

After Downloading, Error while opening PDF : PDF has no pages

After Downloading, Error while opening PDF : PDF has no pages

CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'

EXPORTING

SRC_SPOOLID = L_SPOOLNO

NO_DIALOG = SPACE

DST_DEVICE = MSTR_PRINT_PARMS-PDEST

IMPORTING

PDF_BYTECOUNT = MI_BYTECOUNT

TABLES

PDF = MTAB_PDF

EXCEPTIONS

ERR_NO_ABAP_SPOOLJOB = 1

ERR_NO_SPOOLJOB = 2

ERR_NO_PERMISSION = 3

ERR_CONV_NOT_POSSIBLE = 4

ERR_BAD_DESTDEVICE = 5

USER_CANCELLED = 6

ERR_SPOOLERROR = 7

ERR_TEMSEERROR = 8

ERR_BTCJOB_OPEN_FAILED = 9

Thanks in advance

Monika

ERR_BTCJOB_SUBMIT_FAILED = 10

ERR_BTCJOB_CLOSE_FAILED = 11

OTHERS = 12.

  • Transfer the 132-long strings to 255-long strings

LOOP AT MTAB_PDF.

TRANSLATE MTAB_PDF USING '~'.

CONCATENATE WA_BUFFER MTAB_PDF INTO WA_BUFFER.

ENDLOOP.

TRANSLATE WA_BUFFER USING '~'.

DO.

it_attach = WA_BUFFER.

APPEND it_attach.

SHIFT WA_BUFFER LEFT BY 255 PLACES.

IF WA_BUFFER IS INITIAL.

EXIT.

ENDIF.

ENDDO.

****GET THE FILE NAME TO STORE....................

v_path = 'C:\PD Form\' .

CONCATENATE v_path p_pernr-low '.pdf' into v_name.

create object v_guiobj.

call method v_guiobj->file_save_dialog

EXPORTING

default_extension = 'pdf'

default_file_name = v_name

file_filter = v_filter

CHANGING

filename = v_name

path = v_path

fullpath = v_fullpath

user_action = v_uact.

if v_uact = v_guiobj->action_cancel.

leave to current transaction.

endif.

..................................DOWNLOAD AS FILE....................

move v_fullpath to v_filename.

call function 'GUI_DOWNLOAD'

EXPORTING

bin_filesize = MI_BYTECOUNT

filename = v_filename

filetype = 'BIN'

TABLES

data_tab = it_ATTACH

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 id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

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