Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

problem with BAPI_DOCUMENT_CREATE2

former_member246786
Participant
0 Likes
1,233

Hi,

I have a probleme using BAPI_DOCUMENT_CREATE2. The goal of the development is to create a document that will be linked to the activity of a network in PS module.

So I first tried to create a similar doc using CN22 transaction (network change).

After this, I look at table DRAD to have the data concerning the created doc , this is what i see :

DOKAR = ZCL

DOKNR = the aufnr of my network

DOKVR = 00

DOKOB = VORGNET

OBJKY = SUY10010 ( = aufnr of network + vornr of activity)

So I try to create an empty document the following source code :

* Fill Document ID
    ls_doc-documentnumber = lw_aufnr.
    ls_doc-documenttype = 'ZCL'.
    ls_doc-documentversion = '00'.
    ls_doc-documentpart = '000'.
*    ls_doc-description = 'Morgan test Dir Creation'.

* Determin Link Between Document And Network Activitie
    li_objectlinks-objectkey = lw_dockey.
    li_objectlinks-objecttype = lk_dokob_vorgnet.
    APPEND li_objectlinks.

*
    CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
      EXPORTING
        documentdata               = ls_doc

     IMPORTING
*    DOCUMENTTYPE               =
*    DOCUMENTNUMBER             =
    DOCUMENTPART               = lw_docpart
    DOCUMENTVERSION            = lw_docversion
       return                   = ls_return
     TABLES
       objectlinks                = li_objectlinks.


    IF ls_return IS INITIAL .


                CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
                 EXPORTING
                   WAIT          = 'X'.
                          .

    ENDIF.

But in ls_return I have this message : E26 Version assigned automatically for document type ZCL

So, I conclude that I musn't specify the DocVersion and Doc Part and I comment these 2 lines :

*    ls_doc-documentversion = '00'.
*    ls_doc-documentpart = '000'.

But the result is exactly the same and I don't understand why ...please help.

regards,

Morgan

4 REPLIES 4
Read only

Former Member
0 Likes
810

Hi ,

Try to find out this bapi in "BAPI" t-code.

There you can find the usefull information about this bapi .

cheers.

santosh.

Read only

Former Member
0 Likes
810

Hi,

The same problem i faced some days back.

Version is sutomatically assigned to the document and is always 1 more than the version present.

DOCUMENT FROM EXISTING -

use BAPI_DOCUMENT_CREATENEWVERSION this will create copy of the existing document with new version.

NEW DOCUMENT -

use BAPI_DOCUMENT_CREATE instead.

*...Create new document record for the given Document type, Document

*...number and Document Version

CALL FUNCTION 'BAPI_DOCUMENT_CREATE'

EXPORTING

documentdata = gw_documentdata

IMPORTING

doctype = lw_outdocdata-documenttype

docnumber = lw_outdocdata-documentnumber

docpart = lw_outdocdata-documentpart

docversion = lw_outdocdata-documentversion

return = gw_bapiret2

TABLES

objectlinks = gi_linked_material.

other useful BAPIS in this regard:

BAPI_DOCUMENT_CHANGE

BAPI_TRANSACTION_COMMIT

BAPI_DOCUMENT_GETOBJECTDOCS

BAPI_DOCUMENT_CREATEFROMSOURCE

All the best

regs,

AGS...

Read only

0 Likes
810

I tried with the BAPI_DOCUMENT_CREATE instaed of BAPI_DOCUMENt_CREATE2 as you said but now I have an other error message I don't understand at all :

E26 ID 300:

The Knowledge Provider is using document type ZCL as a storage system

Message was edited by: Morgan Bourgeois

Read only

Former Member
0 Likes
810

I'm facing the same problem "The Knowledge Provider is using document type DRW as a storage system". Can you tell me how to solve this issue?