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_FIXEDASSET_CREATE1 with equipment synchronization

oppenheim_jm
Participant
0 Kudos

Hi experts,

How do I "reset" the BAPI_FIXEDASSET_CREATE1 function module between executions?

I am creating a number of assets via BAPI_FIXEDASSET_CREATE1 FM via a loop successfully, until I turn on asset synchronisation. 

To test the error handling, I have created one bad equipment category configuration (linked to an asset class) which must fail. The issue is that all subsequent BAPI_FIXEDASSET_CREATE1 executions after that first failure fail with the same error code even though the data for subsequent executions is different.

Asset ClassResultError
1Success 
1Success 
2FailureA - ITOP error
1FailureA - ITOP error
1FailureA - ITOP error

I am clearing AND refreshing all input structures at the end of the FM execution in the loop. I am using both a BAPI_TRANSACTION_COMMIT and a COMMIT work.

How do I loop through multiple executions of BAPI_FIXEDASSET_CREATE1 (with equipment sync) and resetting the FM between executions?

Thanks

2 REPLIES 2

raymond_giuseppi
Active Contributor
0 Kudos

Did you look for OSS notes relevant for your versions (notes such as 2999629 - Japan: CSMD - Time-dependent Fields Are Incorrect When You Execute BAPI_FIXEDASSET_CREATE1... )

if you don't find any suitable notes, you could try to execute the BAPI in another session

* Execute in a separate session
CALL FUNCTION 'BAPI_FIXEDASSET_CREATE1'
  DESTINATION 'NONE'
    " (...)
    TABLES
      return         = lt_return.
* Commit the changes within this session
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  DESTINATION 'NONE'
    EXPORTING wait = 'X'.
* Close the session.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
  EXPORTING destination = 'NONE'
  EXCEPTIONS OTHERS = 0.

So no data will be shared between successive calls due to explicit close.

0 Kudos

Thanks @raymond_giuseppi . I did a scan of notes, but didnt look at that one.
RFC disconnect. Interesting. Let me try that.