cancel
Showing results for 
Search instead for 
Did you mean: 

Uploading & Downloading Files into DMS Server using Web Dynpro Java

TusharShinde
Active Participant
0 Kudos

Hello Friends,

I want to Upload a file from Portal to Document Management Server and to Download a file from Document Management Server to Portal, In short, I want to give the user the facility to Upload a File into DMS Sever via Portal and also to download the file from DMS Sever via Portal.

Can anybody give me a Input for the same from Both Java Development End as well as ABAP End, more inputs are required from ABAP end, since i have a very less ABAP Experience on working with DMS. Few Questions i have in my mind?

1. How to actually access the file contents with the help of Document Number?

2. With the help of Doc-Number we can extract the file from DMS sever but to provide a option for downloading in portal, the RFC should convert the File Contents into X-String or is there some other way?

+3. While Uploading the Data should be given in Which format to RFC? Are there any limitation with respect to size or formats. Is there any Standard RFC i can use directly in WD4 Java application to upload the file into DMS Server and which will return me the Document Number? +

Please give me your valuable inputs.

Thank You.

Edited by: TusharShinde on Feb 21, 2011 11:13 AM

Now, I am able to download the File in Portal via my WD4 Java Application from DMS Server by passing the Document Number, but I am facing the problem in downloading the PDF files, Its not working for PDF files. Please give me inputs for the same.

Thank You.

Edited by: TusharShinde on Feb 22, 2011 10:13 AM

Accepted Solutions (0)

Answers (2)

Answers (2)

TusharShinde
Active Participant
0 Kudos

Able to download the Files from DMS using the above RFC code via Portal. Some DMS Config were missing now things are working well..

former_member185086
Active Contributor
0 Kudos

Hi,

As question given in below thread.

[checkouts of documents from DMS SAP in a Web Dynpro Java application|;

BR

Satish Kumar

TusharShinde
Active Participant
0 Kudos

HI,

Thanks for reply.

I am able to download the file From DMS server but I am still not able to Upload the File to DMS Server via Portal. For Download also it is working for all file formats but not for PDF any specific reason for the same.


function zhrf_rfc_dms_download_document.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(LV_DOCUMENT) TYPE  DOKNR
*"  EXPORTING
*"     VALUE(LV_FADA) TYPE  XSTRING
*"  TABLES
*"      LT_DOC STRUCTURE  BAPI_DOC_FILES2
*"      LT_OUT STRUCTURE  ZST_DMS_FILE_XSTRING
*"----------------------------------------------------------------------

data: ls_docfiles type bapi_doc_files2,
         ls_dms type dms_doc_files,
         lt_docfiles type standard table of bapi_doc_files2.

*      data: LT_OUT  type table of  ZST_DMS_FILE_XSTRING.

  data :wa_out like line of lt_out.

  select single * from dms_doc_files
    into ls_dms
    where doknr = lv_document."Retrieve file

  if sy-subrc = 0.
    ls_docfiles-documenttype = ls_dms-dokar.
    ls_docfiles-documentnumber = lv_document.
    ls_docfiles-documentpart = ls_dms-doktl.
    ls_docfiles-documentversion = ls_dms-dokvr.

*    ls_docfiles-documenttype = '321'.
*    ls_docfiles-documentnumber = LV_DOCUMENT.
*    ls_docfiles-documentpart = '000'.
*    ls_docfiles-documentversion = 'A0'.
  endif.

  call function 'BAPI_DOCUMENT_CHECKOUTVIEW2'
    exporting
      documenttype    = ls_docfiles-documenttype
      documentnumber  = ls_docfiles-documentnumber
      documentpart    = ls_docfiles-documentpart
      documentversion = ls_docfiles-documentversion
      documentfile    = ls_docfiles
      getstructure    = '1'
      getcomponents   = 'X'
      getheader       = 'X'
*      pf_http_dest    = 'SAPHTTPA'
      pf_ftp_dest     = 'SAPFTPA'
    tables
      documentfiles   = lt_docfiles.

  data: i_bin type standard table of sdokcntbin,
        i_info type standard table of scms_acinf,
        v_info type scms_acinf,
        v_id type sdok_phid,
        v_cat type sdok_stcat.

  if sy-subrc = 0.
    loop at lt_docfiles into ls_docfiles.
      v_id = ls_docfiles-docfile.
      v_cat = ls_docfiles-storagecategory.

      call function 'SCMS_DOC_READ'
        exporting
          stor_cat              = v_cat
          doc_id                = v_id
          phio_id               = ls_docfiles-file_id
        tables
          access_info           = i_info
          content_bin           = i_bin
        exceptions
          bad_storage_type      = 1
          bad_request           = 2
          unauthorized          = 3
          comp_not_found        = 4
          not_found             = 5
          forbidden             = 6
          conflict              = 7
          internal_server_error = 8
          error_http            = 9
          error_signature       = 10
          error_config          = 11
          error_format          = 12
          error_parameter       = 13
          error                 = 14
          others                = 15.
    endloop.
    if sy-subrc <> 0.

    else.
      data: v_xstring type xstring.
      read table i_info into v_info index 1.
      call function 'SCMS_BINARY_TO_XSTRING'
        exporting
          input_length = v_info-comp_size
        importing
          buffer       = v_xstring
        tables
          binary_tab   = i_bin
        exceptions
          failed       = 1
          others       = 2.
      if sy-subrc <> 0.

      endif.
    endif.

    wa_out-file_name =  ls_docfiles-docfile.
    wa_out-binary = v_xstring.
    lv_fada = v_xstring.
    append wa_out to lt_out.
  endif.


endfunction.

The above is the RFC Code, I am using in my WD4Java app for downloading the file From DMS Server, Is there any Improvement suggested for above RFC to make it work in more efficient way. Please give me input for my Upload RFC.

Thank You.