09-05-2014 12:28 PM
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.
09-05-2014 12:44 PM
Sorry, but i understood correctly?
In the badi you are calling a bapi that update the same document??
09-05-2014 12:44 PM
Sorry, but i understood correctly?
In the badi you are calling a bapi that update the same document??
09-05-2014 12:48 PM
Hi Simone,
Yeah you are correct , I am calling the BAPI mentioned in the BADI before_save method to update the document.
Thanks,
Amitesh
09-05-2014 12:58 PM
then it cannot work.
You are still locking the doc, so the bapi will never update it.
09-06-2014 8:58 AM
Hi,
Just make the data change directly in the BADI itself. Don't call a BAPI!
Why are you calling a BAPI anyway - what did you want to change?
cheers
Paul