cancel
Showing results for 
Search instead for 
Did you mean: 

Reg. DMS

Former Member
0 Kudos

Hii Experts..

I have given one scenario.. in which i have to create one webdynpro application in which the user can upload files from the page and that files should store in the DOCUMENT MANAGEMENT SYSTEM (DMS) IN ECC. As well as the user can view the files also which is present in DMS and can when the user click on that file it will download into the local hardrive of PC.

So, If anyone knows anything regarding this, it will be really helpful to me.. kindly give ur suggestions from where should i start and what should be the logic behind this..

Thanks In advance...

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi Jhings,

follow these steps

1 you need to create a document type in DMS , specific to your requrement

2 you need to write a custom function module to upload file data to application server since gui_upload will not work in case of webdynpro . inside you z function module use bapi BAPI_DOCUMENT_CHANGE2 to create document

3 to download your file to local system use function module C_DESK_DOC_GET_URL , with document number and doc type as parameter . it will generate an URL for your file , use this URL and open it in a new window using lo_window_manager->create_external_window

sample code for z function module for file upload

CONSTANTS path_name TYPE dms_path

VALUE '/tmp/'.

CONSTANTS log TYPE dms_path VALUE '/tmp/logFO.txt'.

DATA: ls_draw TYPE bapi_doc_draw2,

lt_documentfiles TYPE TABLE OF bapi_doc_files2,

ls_documentfiles TYPE bapi_doc_files2,

ls_dm_files TYPE zdm_files,

lv_filename TYPE string,

lv_ext TYPE string,

lv_file_type TYPE draw-dappl,

lv_file_name TYPE dms_path,

lv_msg(80) TYPE c,

lt_objectlinks TYPE TABLE OF bapi_doc_drad,

ls_objectlinks TYPE bapi_doc_drad,

lv_ebelp TYPE ebelp

.

  • Prepare Data

MOVE iv_documentnumber TO ls_draw-documentnumber.

MOVE iv_documenttype TO ls_draw-documenttype.

MOVE iv_documentversion TO ls_draw-documentversion.

MOVE iv_documentpart TO ls_draw-documentpart.

ls_draw-statusextern = iv_dokst.

ls_draw-statusintern = iv_dokst.

ls_draw-username = sy-uname.

LOOP AT it_dm_files INTO ls_dm_files.

SPLIT ls_dm_files-filepath AT '.' INTO lv_filename lv_ext.

CALL FUNCTION 'CV120_DOC_GET_APPL'

EXPORTING

pf_file = ls_dm_files-filepath

IMPORTING

pfx_dappl = lv_file_type.

TRANSLATE lv_file_type TO UPPER CASE.

OPEN DATASET log FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

TRANSFER lv_ext TO log.

ls_documentfiles-wsapplication = lv_file_type.

TRANSLATE ls_documentfiles-wsapplication TO UPPER CASE.

CONCATENATE path_name

lv_filename

'.'

lv_ext

INTO lv_file_name.

CONDENSE lv_file_name NO-GAPS.

TRANSFER lv_file_name TO log.

OPEN DATASET lv_file_name FOR OUTPUT IN BINARY MODE MESSAGE lv_msg.

*Transfer Attachment Content to Application Server

TRANSFER ls_dm_files-content TO lv_file_name.

CLOSE DATASET lv_file_name.

TRANSFER 'move data to lt_files' TO log.

ls_documentfiles-storagecategory = iv_storage_cat.

ls_documentfiles-docfile = lv_file_name.

ls_documentfiles-DOCUMENTVERSION = IV_DOCUMENTVERSION.

APPEND ls_documentfiles TO lt_documentfiles.

CLEAR lv_file_name.

CLOSE DATASET log.

ENDLOOP.

IF iv_ebeln IS NOT INITIAL.

ls_objectlinks-objecttype = 'EKPO'.

SELECT SINGLE ebelp INTO lv_ebelp FROM ekpo WHERE

ebeln = iv_ebeln

AND loekz eq space.

CONCATENATE iv_ebeln lv_ebelp INTO ls_objectlinks-objectkey.

APPEND ls_objectlinks TO lt_objectlinks.

ENDIF.

  • CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'

  • EXPORTING

  • documentdata = ls_draw

  • pf_ftp_dest = 'SAPFTPA'

  • pf_http_dest = 'SAPHTTPA'

  • IMPORTING

  • documentnumber = ev_documentnumber

  • return = es_return

  • TABLES

  • objectlinks = lt_objectlinks

  • documentfiles = lt_documentfiles.

DATA: ls_doc_data type bapi_doc_draw2,

ls_doc_datax type bapi_doc_drawx2,

ls_return type bapiret2.

  • Set value for document data

ls_doc_data-statusextern = 'IW'.

ls_doc_data-statusintern = 'IW'.

  • Set value for document data check

  • ls_doc_datax-statusextern = 'X'.

  • ls_doc_datax-statusintern = 'X'.

CALL FUNCTION 'BAPI_DOCUMENT_CHANGE2'

EXPORTING

DOCUMENTTYPE = 'ROS'

DOCUMENTNUMBER = IV_DOCUMENTNUMBER

DOCUMENTPART = IV_DOCUMENTPART

DOCUMENTVERSION = IV_DOCUMENTVERSION

DOCUMENTDATA = ls_doc_data

DOCUMENTDATAX = ls_doc_datax

  • HOSTNAME =

  • DOCBOMCHANGENUMBER =

  • DOCBOMVALIDFROM =

  • DOCBOMREVISIONLEVEL =

  • SENDCOMPLETEBOM = ' '

pf_ftp_dest = 'SAPFTPA'

pf_http_dest = 'SAPHTTPA'

  • CAD_MODE = ' '

  • ACCEPT_EMPTY_BOM = ' '

IMPORTING

RETURN = ls_return

TABLES

  • CHARACTERISTICVALUES =

  • CLASSALLOCATIONS =

  • DOCUMENTDESCRIPTIONS =

  • OBJECTLINKS =

  • DOCUMENTSTRUCTURE =

DOCUMENTFILES = lt_documentfiles.

  • LONGTEXTS =

  • COMPONENTS =

.

move ls_return to ES_RETURN.

if ls_return-ID = '26' and LS_RETURN-NUMBER = '003'.

CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'

EXPORTING

documentdata = ls_draw

pf_ftp_dest = 'SAPFTPA'

pf_http_dest = 'SAPHTTPA'

IMPORTING

documentnumber = ev_documentnumber

return = es_return

TABLES

objectlinks = lt_objectlinks

documentfiles = lt_documentfiles.

move es_return to ES_RETURN.

endif.

IF es_return-type CA 'EA' ."NE 'E' AND es_return-type NE 'A'.

"do nothing

ELSE.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

ENDIF.

LOOP AT lt_documentfiles INTO ls_documentfiles.

DELETE DATASET ls_documentfiles-docfile.

ENDLOOP.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hall Jhings,

refer the blog here [http://www.sdn.sap.com/irj/scn/weblogs?blog=/cs/blank/view/wlg/20443%3fx-t%3dblank.view%26page%3dlast%26x-maxdepth%3d0|http://www.sdn.sap.com/irj/scn/weblogs?blog=/cs/blank/view/wlg/20443%3fx-t%3dblank.view%26page%3dlast%26x-maxdepth%3d0]

You can also search DMS specific solution in [|]

Former Member
0 Kudos

Thanks For Reply..

But the links which u have given is not the thing which i want.. i first want to upload files into DMS and the links which u gave is for downloading puporse..

So, if u know anything regarding uploading then tell me...

Regards,

Jhings

gill367
Active Contributor
0 Kudos

I am not sure about this but there are function module present which you can call in your web dynpro application to upload the documents.

here is link to the programming present.

gill367
Active Contributor
0 Kudos

I am not sure about this but there are function module present which you can call in your web dynpro application to upload the documents.

here is link to the programming present.

[link to DMS programming interface|http://help.sap.com/SAPhelp_nw04/helpdata/en/3c/4d26696ab411d3aece0000e82deb58/frameset.htm]

Former Member
0 Kudos

Hallo Jhings,

You can use function module BAPI_DOCUMENT_CREATE2 .