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_FIXEDASSET_CHANGE does not work except in debug

Faaiez
Product and Topic Expert
Product and Topic Expert
0 Likes
424

This is strange and I hope someone can assist me.

I'm calling BAPI BAPI_FIXEDASSET_CHANGE to update the serial number and Inventory number on an asset. Here is the code:

call function 'BAPI_FIXEDASSET_CHANGE'
      exporting
        companycode  = companycode
        asset        = asset
        subnumber    = subnumber
        generaldata  = generaldata
        generaldatax = generaldatax
      importing
        return       = l_bapiret2.
    if l_bapiret2-type ne 'E'.
      call function 'BAPI_TRANSACTION_COMMIT'
        exporting
          wait   = 'X'
        importing
          return = l_bapiret2.
    else.
      call function 'BAPI_TRANSACTION_ROLLBACK'
        importing
          return = l_bapiret2.
    endif.

When I am in debug mode the BAPI updates the assets exactly the way it should. But when debugging is switched off the Asset is not updated.

Any assistance in solving this issue would be appreciated.

Regards

Message was edited by: Faaiez Sallie

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
363

Hi,

I Think the condition "if l_bapiret2-type ne 'E'." is not correct and hence the commit it not happening.

In debug, the commmit happens automatically after every F5 and hence it is working in debug.

Try to commit irrespective of the return structure.

Regards,

ravi

1 REPLY 1
Read only

Former Member
0 Likes
364

Hi,

I Think the condition "if l_bapiret2-type ne 'E'." is not correct and hence the commit it not happening.

In debug, the commmit happens automatically after every F5 and hence it is working in debug.

Try to commit irrespective of the return structure.

Regards,

ravi