Hello Guru's
Am able to upload files to DMS from webdynpro using upload ui element. and i can able to view the file in the DMS ( using tcode iw22 ).
But my issue is when i upload more than one file in the DMS and try to view any of the file. i can able to view only the file which i uploaded recently.
Detailed explanation;
these two file 1.txt and 2.txt are uploaded...
when i try to view the 1.txt by clicking on it
but.i am able to view 2.txt file .instead of 1.txt file.
CODE :
data : lt_drad type standard table of bapi_doc_drad ,
ls_drad type bapi_doc_drad .
data : drive type pcfile-drive,
extension type pc_fext ,
name type pc_fname,
name_with_ext type pc_fname_e,
lv_path type pcfile-path,
lv_path1 type char75,
path type pc_path .
data lo_nd_n_upload type ref to if_wd_context_node.
data lo_el_n_upload type ref to if_wd_context_element.
data ls_n_upload type wd_this->element_n_upload.
lo_nd_n_upload = wd_context->get_child_node( name = wd_this->wdctx_n_upload ).
lo_el_n_upload = lo_nd_n_upload->get_element( ).
if lo_el_n_upload is initial.
endif.
lo_el_n_upload->get_static_attributes(
importing
static_attributes = ls_n_upload ).
data lo_nd_n_dowunload type ref to if_wd_context_node.
data lt_n_dowunload type wd_this->elements_n_dowunload.
data ls_n_dowunload type wd_this->element_n_dowunload.
lo_nd_n_dowunload = wd_context->get_child_node( name = wd_this->wdctx_n_dowunload ).
lo_nd_n_dowunload->get_static_attributes_table( importing table = lt_n_dowunload ).
* lv_path1 = ls_n_upload-file_name.
* lv_path = lv_path1.
data filename type localfile.
data ls_return type bapiret2.
constants path_name type localfile value '\usr\sap\SUM\abap\'.
constants log type localfile value '/usr/tmp/logFO.txt'.
* ---------------------------------------------------------------------* Create document* ---------------------------------------------------------------------
data : ls_documentdata type bapi_doc_draw2.
data :ls_documentfiles type bapi_doc_files2.
data :ls_bapi_characteristic_values type bapi_characteristic_values.
data :lt_bapi_characteristic_values type table of bapi_characteristic_values.
data :ls_bapi_class_allocation type bapi_class_allocation.
data :lt_bapi_class_allocation type table of bapi_class_allocation.
data: lt_documentfiles type table of bapi_doc_files2.
data: lt_descr type table of bapi_doc_drat.
data: lv_documentnumber type bapi_doc_aux-docnumber,
gv_return type bapiret2,
msg(80) type c.
data: lv_apptyp(3) type c.
data: file(255) type c,
lv_no type c,
lv_document_number type doknr,
lv_document_number_h type doknr.
if wd_comp_controller->notification_id is not initial.
loop at lt_n_dowunload into ls_n_dowunload.
clear : drive,extension,name,name_with_ext,path.
lv_path = ls_n_dowunload-file_name.
call function 'PC_SPLIT_COMPLETE_FILENAME'
exporting
complete_filename = lv_path
importing
drive = drive
extension = extension
name = name
name_with_ext = name_with_ext
path = path.
concatenate path_name name_with_ext "File Name
into file.
open dataset file for output in binary mode message msg.
transfer ls_n_upload-file_contents to file. "content is the XSTRING format of file
close dataset file.
translate extension to upper case.
lv_no = lv_no + 1.
concatenate wd_comp_controller->notification_id '-' lv_no into lv_document_number.
ls_documentfiles-documenttype = 'TS2'.
ls_documentfiles-documentpart = '000'.
ls_documentfiles-documentnumber = lv_document_number.
ls_documentfiles-docfile = file.
* ls_documentfiles-save docfile1 = file.
ls_documentfiles-documentversion = 'AA'.
ls_documentfiles-storagecategory = 'DMS_C1_ST'.
ls_documentfiles-wsapplication = extension.
ls_documentfiles-docpath = path_name.
ls_documentfiles-docfile = name_with_ext. " Edited by murali on 4/8/15
ls_documentfiles-description = lv_document_number.
ls_documentfiles-language = 'EN'.
ls_documentfiles-checkedin = 'X'.
append ls_documentfiles to lt_documentfiles .
clear ls_drad.
refresh lt_drad.
ls_drad-objecttype = 'PMQMEL'.
ls_drad-objectkey = wd_comp_controller->notification_id.
append ls_drad to lt_drad.
clear : ls_n_dowunload.
endloop.
concatenate 'I' wd_comp_controller->notification_id into lv_document_number_h.
ls_documentdata-documenttype = 'TS2'.
ls_documentdata-documentnumber = lv_document_number_h.
ls_documentdata-documentversion = 'AA'.
ls_documentdata-documentpart = '000'.
ls_documentdata-description = lv_document_number_h.
ls_documentdata-laboratory = ' '.
ls_documentdata-docfile1 = file.
ls_documentdata-savedocfile1 = file.
ls_documentdata-wsapplication1 = lv_apptyp.
ls_bapi_characteristic_values-classname = 'DMS_TSR1'.
ls_bapi_characteristic_values-charname = 'DMS_TSR_PROCESS_ACTION'.
ls_bapi_characteristic_values-CHARVALUE = 'INTIATOR'.
ls_bapi_characteristic_values-classtype = '017'.
append ls_bapi_characteristic_values to lt_bapi_characteristic_values.
* ls_bapi_characteristic_values-classname = 'DMS_TSR1'.
* ls_bapi_characteristic_values-charname = 'DMS_TSR_PROCESS_DATE'.
* ls_bapi_characteristic_values-CHARVALUE = 'TEST datume'..
* ls_bapi_characteristic_values-classtype = '017'.
* append ls_bapi_characteristic_values to lt_bapi_characteristic_values.
*
* ls_bapi_characteristic_values-classname = 'DMS_TSR1'.
* ls_bapi_characteristic_values-charname = 'DMS_TSR_PROCESS_TIME'.
* ls_bapi_characteristic_values-CHARVALUE = sy-timlo.
* ls_bapi_characteristic_values-classtype = '017'.
*
* append ls_bapi_characteristic_values to lt_bapi_characteristic_values.
*
* ls_bapi_characteristic_values-classname = 'DMS_TSR1'.
* ls_bapi_characteristic_values-charname = 'DMS_TSR_PROCESS_USER'.
* ls_bapi_characteristic_values-CHARVALUE = sy-uname.
* ls_bapi_characteristic_values-classtype = '017'.
*
* append ls_bapi_characteristic_values to lt_bapi_characteristic_values.
call function 'BAPI_DOCUMENT_CREATE2'
exporting
documentdata = ls_documentdata
hostname = 'content-srv'
pf_http_dest = 'SAPHTTPA'
pf_ftp_dest = 'SAPFTPA'
importing
documentnumber = lv_documentnumber
return = ls_return
tables
CHARACTERISTICVALUES = lt_bapi_characteristic_values
documentdescriptions = lt_descr
objectlinks = lt_drad
documentfiles = lt_documentfiles.
commit work.
endif.