on 06-19-2014 8:08 AM
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?
Hi Nikolay,
In the FM your variables are prefixed with ' iv ' . Whether it is a typo? Is 'lv' to be used instead?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
102 | |
12 | |
11 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.