2010 May 26 5:13 PM
Hi,
Essentially I want to run BAPI_ACC_ACTIVITY_ALLOC_POST in test mode.
So in a program, I execute BAPI_ACC_ACTIVITY_ALLOC_POST and say I get doc number 100.
Then I execute BAPI_TRANSACTION_ROLLBACK.
When I execute BAPI_BUPA_CREATE_FROM_DATA again, I expecte doc number 100 because I have not executed BAPI_TRANSACTION_COMMIT, but instead I get 101.
Doing the same again, and I get 102.
What's going on? Is there a way to simulate BP creation?
Thanks.
Heidi
CALL FUNCTION 'BAPI_ACC_ACTIVITY_ALLOC_POST'
EXPORTING
doc_header = dochdrp
ignore_warnings = 'X'
IMPORTING
doc_no = doc_no
TABLES
doc_items = bapiaaitm
return = return
EXCEPTIONS
OTHERS = 0.
IF test EQ 'X'.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
IMPORTING
return = wa_bapiret2_roll.
IF wa_bapiret2_roll IS NOT INITIAL.
WRITE : wa_bapiret2_roll-message.
ENDIF.
ELSE.
COMMIT WORK AND WAIT.
CALL FUNCTION 'DEQUEUE_ALL'.
ENDIF.
Edited by: Heidi Heinzberger on May 26, 2010 6:26 PM
2010 May 26 5:38 PM
Hi Heidi,
Thats a normal behavior from SAP.
When using BAPI in test run, the documents number generated in test mode will increase up the current doc. number, so the next time you create a valid document. It will be jumped.
Regards,
Gilberto Li
2010 May 26 5:50 PM
Hi,
that is the nature of all BAPIs . The creation of the object (even in a test mode) includes the (internal) number assignment.
Of course the object does not exist in the database, but the (internal) number is consumed.
Remember that BAPIs are supposed to be stateless and 'forget' the previous call, even if you send the same data again.
2010 May 27 9:46 AM
Thanks for Answers,
Is it possible that I put back the number ?
2010 May 27 9:46 PM
2010 Jun 02 2:42 PM
Thanks Mohamed for your answer. I found another solution.
other BAPI for test:
BAPI_ACC_ACTIVITY_ALLOC_CHECK
many greetings
Heidi
2011 Apr 19 8:03 AM
Hi,
What is the technical and functional difference between 'BAPI_ACC_ACTIVITY_ALLOC_CHECK' and 'BAPI_ACC_ACTIVITY_ALLOC_POST' . Are they supposed to be called in sequence ?
If yes, in what sequence?
Sorry, if this is an incorrect question , but hoping for an answer as I' totally new to this.
Thanks,
Priyanka Ashtekar
2015 Jun 11 10:39 AM
Hi Heidi,
BAPI_BUPA_CREATE_FROM_DATA call inside to another BAPI: BUPA_CREATE_FROM_DATA.
BUPA_CREATE_FROM_DATA has an export paramater called IV_TESTRUN to execute them in test mode.
You can copy the bapi BAPI_BUPA_CREATE_FROM_DATA to a Z bapi, and add a new parameter to perform the test mode. Inside Z bapi, modify the call to bapi BUPA_CREATE_FROM_DATA and pass the value of the test parameter of Z bapi.
Regards.