on 2018 Sep 19 2:38 PM
Attachments not getting open in mm01/mm02/mm03 which is attached through Webdynpro using BO BUS1001006.
I have attached PDF, TXT files in material master through webdynpro code as below,
TYPES : BEGIN OF ty_raw_line,
line(2550) TYPE x,
END OF ty_raw_line.
DATA ls_draw TYPE draw.
DATA ls_files TYPE cvapi_doc_file.
DATA lt_files TYPE TABLE OF cvapi_doc_file.
DATA ls_api_ctrl TYPE cvapi_api_control.
DATA it_drat TYPE TABLE OF dms_db_drat.
DATA wa_drat TYPE dms_db_drat.
DATA ls_message TYPE messages .
DATA lv_documentnumber TYPE draw-doknr.
DATA lv_size TYPE i.
DATA lt_bindata TYPE TABLE OF ty_raw_line.
DATA ls_bindata TYPE ty_raw_line.
* DATA: lt_bindata TYPE TABLE OF solix.
* DATA: ls_bindata TYPE solix.
DATA ls_drao TYPE drao.
DATA lt_drao TYPE TABLE OF drao.
ls_draw-dokar = 'DRW'.
ls_draw-dokvr = '00'.
ls_draw-doktl = '000'.
ls_draw-dwnam = sy-uname.
ls_draw-dappl = 'PDF'.
ls_draw-dttrg1 = 'Default'.
ls_draw-begru = '1000'.
* lv_storage_cat = 'DMS_C1_ST'. "It is a default DMS Storage category
ls_api_ctrl-tcode = 'CV01N'.
wa_drat-dokar = ls_draw-dokar.
wa_drat-dokvr = ls_draw-dokvr.
wa_drat-doktl = ls_draw-doktl.
wa_drat-langu = sy-langu.
wa_drat-dktxt = 'DMS Description'.
APPEND wa_drat TO it_drat.
CALL FUNCTION 'CVAPI_DOC_CREATE'
EXPORTING
ps_draw = ls_draw
ps_api_control = ls_api_ctrl
IMPORTING
psx_message = ls_message
pfx_doknr = lv_documentnumber
TABLES
pt_drat_x = it_drat.
MOVE lv_documentnumber TO ev_doknr.
*lv_documentnumber returns the Document number for our reference to get back our document attached to DMS Server…
* For Unpack Text : (Text Binary)
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = FILE_DATA
IMPORTING
output_length = lv_size
TABLES
binary_tab = lt_bindata.
LOOP AT lt_bindata INTO ls_bindata.
CLEAR ls_drao.
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-appnr = '1 '.
APPEND ls_drao TO lt_drao.
ENDLOOP.
DATA f_file TYPE draw-filep.
MOVE file_name TO f_file.
* For Application Determined on the basis of file extension.
CALL FUNCTION 'CV120_DOC_GET_APPL'
EXPORTING
pf_file = f_file
IMPORTING
pfx_dappl = ls_files-dappl.
ls_files-appnr = '1'.
ls_files-filename = file_name.
ls_files-updateflag = 'I'.
ls_files-langu = sy-langu.
ls_files-storage_cat = 'DMS_C1_ST'.
ls_files-description = 'Doc Description'.
APPEND ls_files TO lt_files.
* For Execute external Commit when using BAPIs
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
* For Document Check.
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
pf_ftp_dest = 'SAPFTPA'
pf_http_dest = 'SAPHTTPA'
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.
I am unable to view the document in standard which i have attached and further the same is working fine in vendor master.
I have done DMS settings also, Please give solution
ENDFUNCTION.
User | Count |
---|---|
96 | |
8 | |
6 | |
6 | |
5 | |
5 | |
5 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.