‎2007 Oct 23 1:54 PM
In a development we are using the function module BAPI_DOCUMENT_CREATE2
to create a document and check in the original file into the R/3 storage
system in one go (see subroutine below).
However, we got the requirement to use a Vault ("Tresor") as the storage
backend. Unfortunatly, just setting the documentfiles-storagecategory element to 'VAULT' results in 3 things:
- the document gets created OK
- the original file does NOT get checked in
- the error message "Original 1 wurde bereits eingecheckt und abgelegt" (...has already been checked in)
So please advise how to use the BAPI modules to achieve the checkin into
a Vault storage.
Could this have something to do with the undocumented documentfiles-originaltype element? What does this have to be set instead of the '1', thats working with SAP-SYSTEM storage?
*&---------------------------------------------------------------------*
*& Form l_create_doc_and_save
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_LG_IOTAB text
* <--P_YRAD_DOCFIELDSIOT text
*----------------------------------------------------------------------*
*AP 001 ins
FORM l_create_doc_and_save
TABLES x_iotab STRUCTURE ccihs_am07iot
CHANGING x_yrad_docfields STRUCTURE yrad_docfieldsiot.
* create a new document in DMS with data from x_yrad_docfieldsiot
* and set the new document in x_iotab
DATA: l_files_tab LIKE bapi_doc_files2 OCCURS 0,
l_drat_tab LIKE bapi_doc_drat OCCURS 0.
DATA: l_docdata_wa LIKE bapi_doc_draw2,
l_files_wa LIKE bapi_doc_files2,
l_drat_wa LIKE bapi_doc_drat,
l_return_wa LIKE bapiret2.
DATA: l_doctype LIKE bapi_doc_draw2-documenttype,
l_docnumber LIKE bapi_doc_draw2-documentnumber,
l_docpart LIKE bapi_doc_draw2-documentpart,
l_docversion LIKE bapi_doc_draw2-documentversion.
*fill document data
CLEAR l_docdata_wa.
l_docdata_wa-documenttype = x_yrad_docfields-dokar.
l_docdata_wa-statusintern = x_yrad_docfields-statusintern.
* l_docdata_wa-documentnumber = x_yrad_docfields-doknr.
CLEAR l_files_wa.
* l_files_wa-storagecategory = lc_database. " 'SAP-SYSTEM'
l_files_wa-storagecategory = x_yrad_docfields-storagecategory.
l_files_wa-docfile = x_yrad_docfields-docpath.
l_files_wa-originaltype = '1'. " <--
l_files_wa-wsapplication = x_yrad_docfields-wsapplication.
APPEND l_files_wa TO l_files_tab.
CLEAR l_drat_wa.
l_drat_wa-language = lc_d. " 'DE'
l_drat_wa-description = x_yrad_docfields-description_de.
APPEND l_drat_wa TO l_drat_tab.
CLEAR l_drat_wa.
l_drat_wa-language = lc_e. " 'EN'
l_drat_wa-description = x_yrad_docfields-description_en.
APPEND l_drat_wa TO l_drat_tab.
CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
EXPORTING
documentdata = l_docdata_wa
* HOSTNAME =
* DOCBOMCHANGENUMBER =
* DOCBOMVALIDFROM =
* DOCBOMREVISIONLEVEL =
IMPORTING
documenttype = l_doctype
documentnumber = l_docnumber
documentpart = l_docpart
documentversion = l_docversion
return = l_return_wa
TABLES
* CHARACTERISTICVALUES =
* CLASSALLOCATIONS =
documentdescriptions = l_drat_tab
* OBJECTLINKS =
* DOCUMENTSTRUCTURE =
documentfiles = l_files_tab
* LONGTEXTS =
* COMPONENTS =
.
* error occured?
IF l_return_wa-type CA 'EA'.
ROLLBACK WORK.
MESSAGE ID '26' TYPE 'I' NUMBER '000'
WITH l_return_wa-message.
ELSE.
COMMIT WORK.
CLEAR x_iotab.
x_iotab-zzdokar = l_doctype.
x_iotab-zzdoknr = l_docnumber.
x_iotab-zzdokvr = l_docversion.
x_iotab-zzdoktl = l_docpart.
x_iotab-linemod = ic_linemode-insert.
IF sy-langu = lc_d.
x_iotab-zzdktxt = x_yrad_docfields-description_de.
ELSEIF sy-langu = lc_e.
x_iotab-zzdktxt = x_yrad_docfields-description_en.
ELSE.
x_iotab-zzdktxt = x_yrad_docfields-description_de.
ENDIF.
APPEND x_iotab.
CALL FUNCTION 'YRAD_LB34_SAVE_PEND_SET'
EXPORTING
i_flg_save_pend = true.
CLEAR x_yrad_docfields.
ENDIF.
ENDFORM. " l_create_doc_and_save
‎2007 Oct 24 2:55 PM
Has noone ever used the DMS BAPIs to check in documents in a Vault as storage?
‎2013 Nov 22 10:31 AM
Hi Frank,
Did you manage to figure out what the problem was?
Thank you.
Regards,
Bruno