cancel
Showing results for 
Search instead for 
Did you mean: 

How to update characteristics of DMS document

Former Member
0 Kudos

Hello, I have a requirement to update characteristics right after document creation.

I use BAPI_DOCUMENT_CREATE2 to create the document:


CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'

     EXPORTING

       documentdata    = ls_doc

     IMPORTING

       documenttype    = lv_document_type

       documentnumber  = lv_document_number

       documentpart    = lv_document_part

       documentversion = lv_document_version

       return          = ls_return.


CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

         EXPORTING

wait = abap_true.


And then when I try to change it:



CALL FUNCTION 'BAPI_DOCUMENT_CHANGE2'

     EXPORTING

       documenttype         = iv_document_type

       documentnumber       = cv_document_number

       documentpart         = iv_document_part

       documentversion      = iv_document_version

       documentdata         = ls_document_data

       documentdatax        = ls_document_data_x

     IMPORTING

       return               = ls_return

     TABLES

       classallocations     = lt_cl_alloc

       characteristicvalues = lt_char.


The following error is raised: Object TYPE/NUMBER/PART/VERSION does not exist.


I pass the type, number, part and version right from BAPI_DOCUMENT_CREATE into corresponding arguments for the second call, and into documentdata fields as well. ClassAllocations table contains a single row with class type and name for characteristics in CharacteristicValues table.


Could you suggest me, what can be wrong here?

Accepted Solutions (1)

Accepted Solutions (1)

jogeswararao_kavala
Active Contributor
0 Kudos

Hi Nikolay,

In the FM your variables are prefixed with ' iv ' . Whether it is a typo? Is 'lv' to be used instead?

Former Member
0 Kudos

Thank you for the quick answer and attentiveness.

Actually document change is performed using a subroutine call, so naming is correct here.

Answers (1)

Answers (1)

Former Member
0 Kudos

I found a solution for my problem. In a short, everything is OK except one thing:

Field STATUS=1 should be also filled in CLASSALLOCATIONS table in addition to CLASSTYPE and CLASSNAME.

In total I had to make my call conform to the following points:

  1. Document type, number, version and part must be filled into DOCUMENTDATA structure and not only in direct parameters of the BAPI
  2. CHARACTERISTICSVALUES must include class name and class type, these can be found from tcode CL03
  3. CLASSALLOCATIONS must include the same CLASSNAME and CLASSTYPE as from previous point, plus STATUS field set to «1»