Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI_ACC_ACTIVITY_ALLOC_POST in test mode

Former Member
0 Likes
3,522

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

7 REPLIES 7
Read only

Former Member
0 Likes
2,348

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

Read only

0 Likes
2,348

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.

Read only

0 Likes
2,348

Thanks for Answers,

Is it possible that I put back the number ?

Read only

0 Likes
2,348

Nein, das ist nicht moeglich, soweit ich weiss.

Read only

0 Likes
2,348

Thanks Mohamed for your answer. I found another solution.

other BAPI for test:

BAPI_ACC_ACTIVITY_ALLOC_CHECK

many greetings

Heidi

Read only

0 Likes
2,348

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

Read only

Former Member
0 Likes
2,348

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.