on 2013 Oct 16 9:50 AM
Hi
I need to send a document via web service to the DMS.
What standard bapi receives Xstring or file object and writes
it to the DMS (without using a specific path to the file system) ?
Thank you for your help.
Regards
yuval
Request clarification before answering.
The only way I found is
BAPI_DOCUMENT_CREATE2 gives you the document
call function 'BAPI_DOCUMENT_CREATE2'
exporting
documentdata = documentdata
importing
documenttype = dokar
documentnumber = doknr
documentpart = doktl
documentversion = dokvr
return = return.
and to upload/replace the file contents use something like this
data: ps_api_control type cvapi_api_control.
data: pt_files_x like cvapi_doc_file occurs 0 with header line.
data: pt_messages like messages occurs 0 with header line,
bapi_message like messages occurs 0 with header line.
ps_api_control-commit_flag = 'X'.
ps_api_control-save_flag = 'X'.
if not replace is initial.
call function 'CVAPI_DOC_GETDETAIL'
exporting
pf_batchmode = 'X'
pf_dokar = doctype
pf_doknr = docnr
pf_dokvr = docversion
pf_doktl = docpart
tables
pt_files = pt_files_x
exceptions
not_found = 1
no_auth = 2
error = 3
others = 4.
if sy-subrc <> 0.
replace = space.
endif.
endif.
if replace = space.
pt_files_x-dappl = dappl.
pt_files_x-storage_cat = storage_cat.
pt_files_x-filename = filename.
pt_files_x-description = filename.
pt_files_x-content_description = filename.
append pt_files_x.
endif.
call function 'CVAPI_DOC_CHECKIN'
exporting
pf_dokar = doctype
pf_doknr = docnr
pf_dokvr = docversion
pf_doktl = docpart
pf_ftp_dest = 'SAPFTPA'
pf_http_dest = 'SAPHTTPA'
ps_api_control = ps_api_control
pf_replace = replace
pf_content_provide = 'TBL'
importing
psx_message = pt_messages
tables
pt_files_x = pt_files_x
pt_content = pt_content.
You need to move your xstring to an internal table pt_content.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hh Alejandro
if I understand you correctly to upload a file (using only XTSRING)
I can use
call function 'CVAPI_DOC_CHECKIN'
exporting
pf_dokar = doctype
pf_doknr = docnr
pf_dokvr = docversion
pf_doktl = docpart
pf_ftp_dest = 'SAPFTPA'
pf_http_dest = 'SAPHTTPA'
ps_api_control = ps_api_control
pf_replace = replace
pf_content_provide = 'TBL'
importing
psx_message = pt_messages
tables
pt_files_x = pt_files_x
pt_content = pt_content.
where in pt_content I put the xstring respresenting the file.
regards
Yuval
No, if you have an xstring you have to convert it into a dra0 structure..... like this for example. Also the first part of the previous code (fm CVAPI_DOC_GETDETAIL call) allows you to replace existing content in the dms document
assuming your content is included in lf_content
TYPES: BEGIN OF t_binary,
line(2550) TYPE x,
END OF t_binary.
FIELD-SYMBOLS: <fs> TYPE t_binary.
DATA: lf_content TYPE xstring,
lf_size TYPE i,
pt_content TYPE TABLE OF drao,
ls_drao TYPE drao,
lt_binary TYPE TABLE OF t_binary,
lf_size = XSTRLEN( lf_content ).
*Convert xstring to binary format
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING: buffer = lf_content
IMPORTING: output_length = lf_size
TABLES: binary_tab = lt_binary.
LOOP AT lt_binary ASSIGNING <fs>.
CLEAR ls_drao.
ls_drao-orblk = <fs>-line.
ls_drao-orln = lf_size.
APPEND ls_drao TO pt_content.
ENDLOOP.
Hi Alejandro
Sorry for my late reply.
As far as I understand this mechanism
is not suited for silent upload since it
uses the Upload/Download UI elements
where the user has to select the
file and the UI element passes the
data source (file object) to web dynpro.
For silent upload download I guess we have to
use ACFUploadDownload ....
regards
yuval
No, you can run it in a batch mode, independently of the UI used, as far as you will be able to get the file information into a xstring. The user doesn't selects anything in the previous code. In fact I have a program running with a similar schema that performs batch upload of 5000 files each night.
Hi
I think I made myself misunderstood. What I am trying to
do is to silently
upload a file using web dynpro's ACFUPDOWNLOAD.
In the demo app I do not see how I get the XSTRING
representation of the file I just uploaded.
Further, although I managed to use ACF and I
get no error while uploading the file, it is not stored
on my KPRO.
regards
Yuval
User | Count |
---|---|
93 | |
13 | |
11 | |
5 | |
5 | |
5 | |
3 | |
2 | |
2 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.