Como fazer download de arquivo do DMS via BAPI



Como fazer download de arquivo do DMS via BAPI



Please follow the steps to Download a file from DMS or Display in Browser.

1. Call BAPI ‘BAPI_DOCUMENT_GETDETAIL2′

call function ‘BAPI_DOCUMENT_GETDETAIL2′

exporting

documenttype = document_key-doctype

documentnumber = document_key-docnumber

documentpart = document_key-docpart

documentversion = document_key-docversion

getcomponents = ‘X’

getdocdescriptions = ‘X’

getdocfiles = ‘X’

getclassification = ‘X’

importing

documentdata = documentdata

return = lv_return

tables

documentdescriptions = it_documentdescriptions

documentfiles = it_documentfiles

characteristicvalues = it_characteristicvalues

classallocations = it_classallocations.

2. Then call BAPI_DOCUMENT_CHECKOUTVIEW2

documentfile-wsapplication = it_documentfiles-wsapplication.

call function ‘BAPI_DOCUMENT_CHECKOUTVIEW2′

exporting

documenttype = document_key-doctype

documentnumber = document_key-docnumber

documentpart = document_key-docpart

documentversion = document_key-docversion

documentfile = documentfile

getstructure = ‘1′

getheader = ‘X’

pf_ftp_dest = ‘*SAPFTPA*’

importing

return = lv_return

tables

documentfiles = it_co_documentfiles.

You need to pass PF_FTP_DEST as SAPFTPA as we are calling this FM from Browser not SAP GUI and if you dont pass this value then the FM errors out because it doesn’t find SAP GUI.

3. Now call SCMS_DOC_READ to get the Binary Data of the File.

call function ‘SCMS_DOC_READ’

exporting

mandt = sy-mandt

stor_cat = c_storage

doc_id = it_co_documentfiles-file_id

tables

access_info = lt_access

content_bin = lt_sdokcntbin.

IT_SDOKCNTBIN is the Binary Data Table of the file you want to download.

Now you have the binary file data which you can write on Application Server or Convert it to XSTRING and show in a web dynpro application. I am not sure how to display in BSP.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download