2011 Jan 03 3:20 PM
Hello Everybody,
I have to store a PDF in our Archive. While I was searching for a solution I found the FM "ARCHIVOBJECT_CREATE_TABLE". I already have the binaries of the PDF-Document.
CALL FUNCTION 'ARCHIVOBJECT_CREATE_TABLE'
EXPORTING
archiv_id =
* ARC_DOC_ID =
document_type =
* LENGTH = "What do I have to place here ?
* COMPID = 'data' "...and here ?
* SIGNATURE = 'X'
* IMPORTING
* ARCHIV_DOC_ID =
* TABLES
* ARCHIVOBJECT =
* COMPONENTS =
* BINARCHIVOBJECT =
* EXCEPTIONS
* ERROR_ARCHIV = 1
* ERROR_COMMUNICATIONTABLE = 2
* ERROR_KERNEL = 3
* OTHERS = 4
.
There is no error code after I executed it. At last I write a connection for the buisness object and PDF-File. I use the FM "ARCHIV_CONNECTION_INSERT". This one also works without any error code.
After the report finished I tried to open the attachment in the transaction JHF3 as an attachment (attachment list). And here comes the error. When I try to open the attachment the PDF-Acrobat-Reader says the file is damaged.
Here is the code:
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = l_bindat
TABLES
binary_tab = lt_bindata_archv.
*
DATA: l_archiv_doc_id LIKE sapb-sapadokid.
*
*
CALL FUNCTION 'ARCHIVOBJECT_CREATE_TABLE'
EXPORTING
archiv_id = 'TD'
* ARC_DOC_ID =
document_type = 'PDF'
LENGTH = 17 "I entered number of the rows of the lt_bindata_archv
COMPID = 'data'
* SIGNATURE = 'X'
IMPORTING
archiv_doc_id = l_archiv_doc_id
TABLES
* ARCHIVOBJECT =
* COMPONENTS =
binarchivobject = lt_bindata_archv
EXCEPTIONS
error_archiv = 1
error_communicationtable = 2
error_kernel = 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.
CALL FUNCTION 'ARCHIV_CONNECTION_INSERT'
EXPORTING
archiv_id = 'TD'
arc_doc_id = l_archiv_doc_id
* AR_DATE = ' '
ar_object = toa_dara-ar_object
del_date = toa_dara-del_date
mandant = '100'
object_id = toa_dara-object_id
sap_object = toa_dara-sap_object
doc_type = 'PDF'
* BARCODE = ' '
EXCEPTIONS
error_connectiontable = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Can somebody please guide me through this ?
2011 Jan 04 8:28 AM
Hi people,
I solved the problem by myself. I'm using the FM "CONVERT_OTF_AND_ARCHIVE". This FM transforms an OTF-itab to an archived PDF. This ones saved my life. 😃
Greetz GollmerBZ
2014 May 01 6:58 AM
Hi Michael,
Can you please specify the exact order of FM calling?
Thanks.
2015 Aug 31 2:36 PM
Hello Mivheal,
Can you please let me know how were you able to retrieve the saved DOC_ID from the archieved tables.Because CONVERT_OTF_AND_ARCHIVE this dont have any exporting parameters.
Thanks,
Vijay.
2015 Dec 02 4:14 PM
Could you please help us what exactly we need to pass to the importing parameters?
I need to archive the OTF data to Invoice.
2021 Jan 05 7:42 AM
Could you please let us know, to which parameter we could pass file content to the FM : CONVERT_OTF_AND_ARCHIVE