<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using BAPI_DOCUMENT_CREATE2 to create a document and checkin to VAULT in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-document-create2-to-create-a-document-and-checkin-to-vault/m-p/2961540#M698684</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Frank,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you manage to figure out what the problem was?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bruno&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Nov 2013 10:31:07 GMT</pubDate>
    <dc:creator>bruno_esperanca</dc:creator>
    <dc:date>2013-11-22T10:31:07Z</dc:date>
    <item>
      <title>Using BAPI_DOCUMENT_CREATE2 to create a document and checkin to VAULT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-document-create2-to-create-a-document-and-checkin-to-vault/m-p/2961538#M698682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In a development we are using the function module BAPI_DOCUMENT_CREATE2&lt;/P&gt;&lt;P&gt;to create a document and check in the original file into the R/3 storage&lt;/P&gt;&lt;P&gt; system in one go (see subroutine below).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, we got the requirement to use a Vault ("Tresor") as the storage&lt;/P&gt;&lt;P&gt; backend. Unfortunatly, just setting the documentfiles-storagecategory element to 'VAULT' results in 3 things:&lt;/P&gt;&lt;P&gt;- the document gets created OK&lt;/P&gt;&lt;P&gt;- the original file does NOT get checked in&lt;/P&gt;&lt;P&gt;- the error message "Original 1 wurde bereits eingecheckt und abgelegt" (...has already been checked in)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So please advise how to use the BAPI modules to achieve the checkin into&lt;/P&gt;&lt;P&gt; a Vault storage.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  l_create_doc_and_save
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;P_LG_IOTAB  text
*      &amp;lt;--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'.   " &amp;lt;-- 
  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
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Oct 2007 12:54:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-document-create2-to-create-a-document-and-checkin-to-vault/m-p/2961538#M698682</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-23T12:54:21Z</dc:date>
    </item>
    <item>
      <title>Re: Using BAPI_DOCUMENT_CREATE2 to create a document and checkin to VAULT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-document-create2-to-create-a-document-and-checkin-to-vault/m-p/2961539#M698683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Has noone ever used the DMS BAPIs to check in documents in a Vault as storage?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Oct 2007 13:55:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-document-create2-to-create-a-document-and-checkin-to-vault/m-p/2961539#M698683</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-24T13:55:06Z</dc:date>
    </item>
    <item>
      <title>Re: Using BAPI_DOCUMENT_CREATE2 to create a document and checkin to VAULT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-document-create2-to-create-a-document-and-checkin-to-vault/m-p/2961540#M698684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Frank,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you manage to figure out what the problem was?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Bruno&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Nov 2013 10:31:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-bapi-document-create2-to-create-a-document-and-checkin-to-vault/m-p/2961540#M698684</guid>
      <dc:creator>bruno_esperanca</dc:creator>
      <dc:date>2013-11-22T10:31:07Z</dc:date>
    </item>
  </channel>
</rss>

