Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Need Guidence for the FM "ARCHIVOBJECT_CREATE_TABLE"

Former Member
0 Kudos

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 ?

5 REPLIES 5

Former Member

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

0 Kudos

Hi Michael,

Can you please specify the exact order of FM calling?

Thanks.

0 Kudos

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.

0 Kudos

Could you please help us what exactly we need to pass to the importing parameters?

I need to archive the OTF data to Invoice.

0 Kudos

Could you please let us know, to which parameter we could pass file content to the FM : CONVERT_OTF_AND_ARCHIVE