cancel
Showing results for 
Search instead for 
Did you mean: 

how to read DMS file into internal table

Former Member
0 Kudos

Hi Experts,

I upload local JPG picture into DMS system via CV01N and checked in. Now, I need to read this JPG file from DMS into internal table. Which FM can I use?

I can get some info by BAPI_DOCUMENT_GETDETAIL2, but how can I get file content directly into internal table in binary? some FM seems can, but i don't know what value should pass to parameter "document class".

similar question in MIME via Tcode SMW0: how can I read file into internal table directly? any FM or class method?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Please use the Function module 'SCMS_DOC_READ' .

step 1.

CALL FUNCTION 'BAPI_DOCUMENT_GETDETAIL2'

    EXPORTING

      documenttype               = ls_stb-dokar

      documentnumber             = ls_stb-doknr

      documentpart               = ls_stb-doktl

      documentversion            = ls_stb-dokvr

    getobjectlinks             = 'X'

    getcomponents              = 'X'

    getstatuslog               = 'X'

    getlongtexts               = 'X'

    getactivefiles             = 'X'

    getdocdescriptions         = 'X'

    getdocfiles                = 'X'

    getclassification          = 'X'

    getstructure               = 'X'

    getwhereused               = 'X'

    hostname                   = 'X'

   IMPORTING

    documentdata               = ls_documentdata

     return                    = ls_return

   TABLES

    objectlinks                lt_objectlinks

*   DOCUMENTDESCRIPTIONS       =

*   LONGTEXTS                  =

*   STATUSLOG                  =

      documentfiles              = lt_documentfiles

*   COMPONENTS                 =

*   CHARACTERISTICVALUES       =

*   CLASSALLOCATIONS           =

*   DOCUMENTSTRUCTURE          =

*   WHEREUSEDLIST              =

            .

step 2.

      READ TABLE lt_documentfiles INDEX 1 INTO ls_documentfile.

CALL FUNCTION 'SCMS_DOC_READ'

             EXPORTING

               mandt       = sy-mandt

*              stor_cat    = ls_co_documentfiles-storagecategory

*              doc_id      = ls_co_documentfiles-file_id

               stor_cat    = ls_documentfile-storagecategory

               doc_id      = ls_documentfile-file_id

             TABLES

               access_info = lt_access

               content_bin = lt_sdokcntbin.

regards

Sachin Patel

Former Member
0 Kudos

Hi Sachin,

Thanks for your reply. I tried these codes, but no FILE_ID returned. The file already checked in by CV01N. Is something I missing?

previous document is using my own doc type "ZPC". When I create another document with type "DRW", the FILE_ID can be get and file content can be read by FM SCMS_DOC_READ. So maybe some config missing for my own doc type.

Anyway, your code is correct and solve my problem. Thank you!

Answers (0)