Application Development 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: 

BAPI_TRANSACTION_ROLLBACK

MariaJoãoRocha
Contributor
0 Kudos

Hi SDN,

In mode test (without commit work): Is it necessary to perform BAPI_TRANSACTION_ROLLBACK, after calling the BAPI?

In this case BAPI_ASSET_RETIREMENT_POST

in what circumstances?

Even without commit, the number range FI_DOCUMNT was used.

Best regards,

Maria João Rocha

1 ACCEPTED SOLUTION

Former Member
0 Kudos

The BAPI transaction model must afford the user explicit transaction control. Therefore, if several BAPIs are called together, the caller can decide him/herself when to execute a COMMIT WORK (or, as the case may be, a ROLLBACK WORK). This means that BAPIs themselves cannot (generally) execute a COMMIT WORK command.

Source: help.sap

Hope this link helps you to get answer to your question:

[BAPI_TRANSACTION_ROLLBACK|;

Edited by: Mishra.Manas on May 5, 2010 7:31 PM

6 REPLIES 6

Former Member
0 Kudos

The BAPI transaction model must afford the user explicit transaction control. Therefore, if several BAPIs are called together, the caller can decide him/herself when to execute a COMMIT WORK (or, as the case may be, a ROLLBACK WORK). This means that BAPIs themselves cannot (generally) execute a COMMIT WORK command.

Source: help.sap

Hope this link helps you to get answer to your question:

[BAPI_TRANSACTION_ROLLBACK|;

Edited by: Mishra.Manas on May 5, 2010 7:31 PM

MariaJoãoRocha
Contributor
0 Kudos

Hi,

In this case I have a program that calls BAPI_ASSET_RETIREMENT_POST, for each record in a file (excel).

The question is; as the BAPI_ASSET_RETIREMENT_POST has not the commit work inside, must be the program that class the bapi to execute the commit. So i put an option on the selection screen "test mode" and the program in this case calls the bapi BAPI_ASSET_RETIREMENT but doesn't commit, just whe the option "test mode" is not checked.

The problem is that several numbers int the number range FI_DOCUMNT are lost.

Must I execute BAPI_TRANSACTION_ROLLBACK, on this test mode?

Regards,

Maria João Rocha

0 Kudos

> The problem is that several numbers int the number range FI_DOCUMNT are lost.

> Must I execute BAPI_TRANSACTION_ROLLBACK, on this test mode?

Have you tried it ? Is this not working ?

I think this should answer your queries:

DATA v_num TYPE anln1.

CALL FUNCTION 'NUMBER_GET_NEXT'
  EXPORTING
    nr_range_nr             = `01`
    object                  = `ANLAGENNR`
    subobject               = `0001`
  IMPORTING
    number                  = v_num
  EXCEPTIONS
    interval_not_found      = 1
    number_range_not_intern = 2
    object_not_found        = 3
    quantity_is_0           = 4
    quantity_is_not_1       = 5
    interval_overflow       = 6
    buffer_overflow         = 7
    OTHERS                  = 8.
IF sy-subrc = 0.
  WRITE / v_num.
  CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF.

Edited by: Suhas Saha on May 5, 2010 11:53 PM

0 Kudos

Hi,

Even if you use ROLL BACK, i think your number range wont be reverted. But can you give a try and see what happens?

Thanks,

Vinod.

MariaJoãoRocha
Contributor
0 Kudos

Hi,

Thanks for your replies.

I delivered the program for testing to our KUser on AM module.

I hope that BAPI_TRANSACTION_ROLLBACK results, because FI number range can not be lost; the numbering must be sequential.

At the worst, I will cancel the test mod option.

Best Regards,

Maria João Rocha

MariaJoãoRocha
Contributor
0 Kudos

Hi,

It worked with BAPI_TRANSACTION_ROLLBACK - the number range is not used.

In this case when "test mode" is used the number of the FI document is always the same. I think, problably when the bpi retuns warning this also prevent the namber usage.

The bapi documentation should refer this point, wich is very important on FI number range.

Thanks.

Maria João Rocha