Skip to Content
avatar image
Former Member

BAPI 'BAPI_DOCUMENT_CHANGE2' is not updating document data

Hi Experts ,

I am using BAPI 'BAPI_DOCUMENT_CHANGE2' to update the document status and ecn no of the document but its failing to do the same.

i am calling this BADI in BEFORE_SAVE method of BADI 'DOCUMENT_MAIN01'. I checked this BAPI in se37 by setting the test sequence calling BAPI_TRANSACTION_COMMIT' after this BAPI and it works.

But when I used the same parameters in the BADI its not updating the status. Please suggest.

lcl_doc_data-documenttype = draw-dokar.

lcl_doc_data-documentnumber = draw-doknr.

lcl_doc_data-documentversion = draw-dokvr.

lcl_doc_data-documentpart = draw-doktl.

lcl_doc_data-statusextern = 'IW'.

lcl_doc_data-statusintern = 'IW'.

lcl_doc_data-ecnumber = lv_fieldvalue.

lcl_doc_datax-statusextern = 'X'.

lcl_doc_datax-statusintern = 'X'.

lcl_doc_datax-ecnumber = 'X'.

CALL FUNCTION 'BAPI_DOCUMENT_CHANGE2'

EXPORTING

documenttype = draw-dokar

documentnumber = draw-doknr

documentpart = draw-doktl

documentversion = draw-dokvr

documentdata = lcl_doc_data

documentdatax = lcl_doc_datax

IMPORTING

return = gs_return_error.


IF gs_return_error-type CA 'EA'.

MESSAGE gs_return_error-message TYPE 'E'.

ELSE.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = c_x.

ENDIF.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Sep 05, 2014 at 11:44 AM

    Sorry, but i understood correctly?
    In the badi you are calling a bapi that update the same document??

    Add comment
    10|10000 characters needed characters exceeded