on 08-04-2014 8:42 AM
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?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.