Skip to Content
avatar image
Former Member

Archivobject_get_table returns empty table

Hello,

I'm having trouble since I changed the archive process of PDFs to binary.

I have one programm which is reading a pdf in binary mode like this:

"Step1 read pdf to xstring:
      OPEN DATASET im_filepath FOR INPUT IN BINARY MODE.
      DO.
        READ DATASET im_filepath INTO lf_tempxstr.
        IF sy-subrc <> 0.
          CONCATENATE lf_pdfxstr lf_tempxstr INTO lf_pdfxstr IN BYTE MODE.
          EXIT.
        ENDIF.
        CONCATENATE lf_pdfxstr lf_tempxstr INTO lf_pdfxstr IN BYTE MODE.
      ENDDO.
      CLOSE DATASET im_filepath.

"Step2 xstring to binary table:
 CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
    EXPORTING
      buffer     = lf_pdfxstr
    TABLES
      binary_tab = tb_binfile.

"Step 3 archiving:
CALL FUNCTION 'ARCHIVOBJECT_CREATE_TABLE'
    EXPORTING
      archiv_id                = pa_arcid
      document_type            = 'PDF'
    IMPORTING
      archiv_doc_id            = gs_inv-arcdocid
    TABLES
      binarchivobject          = tb_binfile

This works without errors and I get an archiv_doc_id to the file.

In another program I try to retrieve the file from the archive again:

CALL FUNCTION 'ARCHIVOBJECT_GET_TABLE'
    EXPORTING
      archiv_id                = co_arc_id
      document_type            = 'PDF'
      archiv_doc_id            = gs_invdata-arcdocid
    TABLES
      binarchivobject          = lt_file_data

This also works without errors, but the lt_file_data table remains empty. Can anyone help me and say what I am doing wrong here?

Best regards.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Mar 17, 2017 at 03:18 PM

    I solved it myself.

    Apparently, when using function 'ARCHIVOBJECT_TABLE_CREATE' and passing the file as binarchivobject, you need to pass the length parameter too, which you can get from the 'SCMS_XSTRING_TO_BIN' function. Doing this I were able to retrieve the file again.

    Add comment
    10|10000 characters needed characters exceeded