Skip to Content
0
Aug 10, 2016 at 04:36 AM

PDF archieve question

215 Views

Hi expert,

I have an issue about PDF archiving.

The requirement is getting the PDF file from application server, archiving it and move to another path.

I have a development solution as below:

1 use open dataset to get PDF file

OPEN DATASET lv_file IN BINARY MODE FOR INPUT.

DO.

READ DATASET lv_file INTO ls_bin_file.

IF sy-subrc = 0.

APPEND ls_bin_file TO lt_bin_file.

ELSE.

APPEND ls_bin_file TO lt_bin_file.

EXIT.

ENDIF.

ENDDO.

CLOSE DATASET lv_file.

2 Archive by function: ARCHIVOBJECT_CREATE_TABLE and ARCHIV_CONNECTION_INSERT

CALL FUNCTION 'ARCHIVOBJECT_CREATE_TABLE'

EXPORTING archiv_id = me->v_archiv_id

document_type = me->v_doc_type

LENGTH = lv_length

IMPORTING archiv_doc_id = lv_archiv_doc_id

TABLES binarchivobject = lt_binarchivobject

.

CALL FUNCTION 'ARCHIV_CONNECTION_INSERT'

EXPORTING arc_doc_id = lv_archiv_doc_id

ar_object = lv_ar_object

object_id = lv_object_id

sap_object = '/OPT/V1001' .

There are no any error when calling these two functions.(sy-subrc = 0) But when I read the PDF file, there is an error:

" Adobe reader could not open ‘3655f90_2734.pdf’ because it is either not a supported file type or because the file has been damaged(for example, it was sent as an email attachment and wasn’t correctly decoded)."

Could anyone give some advices?

Thanks.