on 03-18-2014 3:04 PM
Hi,
I have a requirement to upload files in DMS using Web Dynpro. I have written the code by the hint of the following thread:-
My code is uploading all files but when I try to view them from CV03N only txt files are displaying , Images and PDF files are not
showing there.
Please help me. It's urgent requuirement.
Thanks
Amit
TYPES : BEGIN OF zst_ts_raw_line,
line TYPE orblk,
END OF zst_ts_raw_line.
DATA : ls_draw TYPE draw ,
ls_api_ctrl TYPE cvapi_api_control,
ls_message TYPE messages,
lv_documentnumber TYPE draw-doknr,
it_objectlinks TYPE STANDARD TABLE OF dms_db_drad,
ig_objectlinks TYPE dms_db_drad ,
it_documentdescriptions TYPE STANDARD TABLE OF bapi_doc_drat,
ig_documentdescriptions TYPE bapi_doc_drat ,
it_originals_of_doc TYPE STANDARD TABLE OF cvapi_doc_file,
ig_originals_of_doc TYPE cvapi_doc_file ,
lv_storage_cat TYPE cv_storage_cat,
lv_size TYPE i ,
lt_bindata TYPE STANDARD TABLE OF zst_ts_raw_line," STANDARD TABLE OF zst_ts_raw_line,
ls_bindata TYPE zst_ts_raw_line ,"SOLISTI1,"sdokcntbin ,
ls_drao TYPE drao,
lt_drao TYPE TABLE OF drao,
lt_DRAT TYPE TABLE OF DMS_DB_DRAT,
ls_DRAT TYPE DMS_DB_DRAT,
lt_files TYPE cvapi_tbl_doc_files,
ls_files TYPE cvapi_doc_file,
l_string TYPE string.
DATA : ex_pf_ftp_dest TYPE rfcdes-rfcdest.
DATA : ex_pf_http_dest TYPE rfcdes-rfcdest.
DATA lo_nd_upload TYPE REF TO if_wd_context_node.
DATA lo_el_upload TYPE REF TO if_wd_context_element.
DATA ls_upload TYPE wd_this->element_upload.
DATA lo_nd_upload1 TYPE REF TO if_wd_context_node.
DATA lo_el_upload1 TYPE REF TO if_wd_context_element.
DATA ls_upload1 TYPE wd_this->element_upload1.
DATA lo_nd_upload2 TYPE REF TO if_wd_context_node.
DATA lo_el_upload2 TYPE REF TO if_wd_context_element.
DATA ls_upload2 TYPE wd_this->element_upload2.
* navigate from <CONTEXT> to <UPLOAD> via lead selection
lo_nd_upload = wd_context->get_child_node( name = wd_this->wdctx_upload ).
lo_el_upload = lo_nd_upload->get_element( ).
lo_el_upload->get_static_attributes( IMPORTING static_attributes = ls_upload ).
* navigate from <CONTEXT> to <UPLOAD1> via lead selection
lo_nd_upload1 = wd_context->get_child_node( name = wd_this->wdctx_upload1 ).
lo_el_upload1 = lo_nd_upload1->get_element( ).
lo_el_upload1->get_static_attributes( IMPORTING static_attributes = ls_upload1 ).
* navigate from <CONTEXT> to <UPLOAD2> via lead selection
lo_nd_upload2 = wd_context->get_child_node( name = wd_this->wdctx_upload2 ).
lo_el_upload2 = lo_nd_upload2->get_element( ).
lo_el_upload2->get_static_attributes( IMPORTING static_attributes = ls_upload2 ).
DATA : lv_file_name TYPE filep.
ls_draw-dokar = 'Document Type'.
ls_draw-dokvr = '00'.
ls_draw-doktl = '000'.
ls_draw-dwnam = sy-uname.
lv_storage_cat = 'Storage space'.
ls_DRAT-doknr = 'Document Type'.
ls_DRAT-dokvr = '00'.
ls_DRAT-doktl = '000'.
ls_DRAT-dktxt = 'Test Document'.
ls_drat-dktxt_uc = 'Test Document'.
append ls_drat to lt_drat.
ls_api_ctrl-tcode = 'CV01N'.
ls_api_ctrl-commit_flag = 'X'.
ls_api_ctrl-save_flag = 'X'.
ls_api_ctrl-api_mode = 'X'.
ls_api_ctrl-no_update_task = 'X'.
ls_draw-filep = ls_upload-filename. "l_string. *
ig_objectlinks-dokar = doc type
ig_objectlinks-dokvr = '00'.
ig_objectlinks-doktl = '000'.
ig_objectlinks-dokob = 'LFA1'.
ig_objectlinks-objky = lifnr.
APPEND ig_objectlinks TO it_objectlinks.
CALL FUNCTION 'CVAPI_DOC_CREATE'
EXPORTING
ps_draw = ls_draw
*• PF_STATUSLOG = ' '
*• PF_REVLEVEL =
ps_api_control = ls_api_ctrl
*• PF_FTP_DEST = ' '
*• PF_HTTP_DEST = ' '
*• PF_HOSTNAME = ' '
*• PF_CONTENT_PROVIDE = ' '
IMPORTING
psx_message = ls_message
*• PFX_DOKAR =
pfx_doknr = lv_documentnumber
TABLES
pt_drad_x = it_objectlinks
pt_drat_x = lt_drat
* pt_files_x = lt_files.
* documentdescriptions = it_documentdescriptions.
.
IF sy-subrc NE 0.
WRITE: 'no number'.
ENDIF.
IF ls_message-msg_type CA 'EA'.
ELSE.
ls_draw-doknr = lv_documentnumber.
COMMIT WORK.
ENDIF.
DATA lv_count TYPE i.
DO 3 TIMES.
REFRESH : lt_files,lt_bindata,lt_drao.
lv_count = lv_count + 1.
ls_files-appnr = lv_count."'1'.
CASE lv_count.
WHEN '1'.
ls_files-filename = ls_upload-filename. "wa_general-REF_FILE_NAME1. "
ls_upload-filecontent = ls_upload-filecontent.
WHEN '2'.
ls_files-filename = ls_upload1-filename. "wa_general-REF_FILE_NAME1. "
ls_upload-filecontent = ls_upload1-filecontent.
WHEN '3'.
ls_files-filename = ls_upload2-filename. "wa_general-REF_FILE_NAME1. "
ls_upload-filecontent = ls_upload2-filecontent.
ENDCASE.
MOVE ls_files-filename TO lv_file_name.
CALL FUNCTION 'CV120_DOC_GET_APPL'
EXPORTING
*•PF_DIALOG =
*•PF_DISPLAY =
* PF_FILE = 'DO.TXT'
pf_file = lv_file_name "wa_general-REF_FILE_NAME1 "
*•PF_TYPDT =
IMPORTING
pfx_dappl = ls_files-dappl.
ls_files-updateflag = 'I'.
ls_files-langu = sy-langu.
ls_files-storage_cat = 'Srotage ID'.
ls_files-description = 'DMS'.
APPEND ls_files TO lt_files.
*******************************************************************************************
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = ls_upload-filecontent "wa_general-ref_doc1 "
*• APPEND_TO_TABLE = ' '
IMPORTING
output_length = lv_size
TABLES
binary_tab = lt_bindata.
DATA : lv_zaehl TYPE obzae.
CLEAR lv_zaehl.
LOOP AT lt_bindata INTO ls_bindata.
CLEAR ls_drao.
lv_zaehl = lv_zaehl + 1.
ls_drao-orblk = ls_bindata-line.
ls_drao-orln = lv_size.
* ls_drao-dokar = ls_draw-dokar.
* ls_drao-doknr = lv_documentnumber.
* ls_drao-dokvr = ls_draw-dokvr.
* ls_drao-doktl = ls_draw-doktl.
ls_drao-zaehl = lv_zaehl.
* ls_drao-appnr = lv_count."'1'.
APPEND ls_drao TO lt_drao.
ENDLOOP.
*********************************************************************
CALL FUNCTION 'CVAPI_DOC_CHECKIN'
EXPORTING
pf_dokar = ls_draw-dokar
pf_doknr = lv_documentnumber
pf_dokvr = ls_draw-dokvr
pf_doktl = ls_draw-doktl
ps_api_control = ls_api_ctrl
pf_content_provide = 'TBL'
IMPORTING
psx_message = ls_message
TABLES
pt_files_x = lt_files
pt_content = lt_drao.
COMMIT WORK.
ENDDO.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gokul,
I have got the solution actually Popup is blocked so file was not downloading.
Thanks,
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gokul,
One more problem related to file attachment that Microsoft office related files are not opening.
Thanks,
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.