Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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.

Former Member
replied

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

0 View this answer in context

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question