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_COMMIT

kiran_k8
Active Contributor
0 Kudos
5,748

Hi Folks,

Can anyone please let me know the functionality of the below given functional module with an simple example.

BAPI_TRANSACTION_COMMIT.

Thanks,

K.Kiran.

3 REPLIES 3

gopi_narendra
Active Contributor
0 Kudos
784

This method executes a COMMIT WORK command. It is required for transactions developed externally to the R/3 System that change data in the R/3 System via BAPI calls. When you call BAPIs in your program that change data in the R/3 System, afterwards you must call this method to write the changes to the database.

check this sample of code,this FM is used if the BAPI return table does not have any error(messages with type E)

      call function 'BAPI_FIXEDASSET_CHANGE'
           exporting
                companycode = is_final-bukrs
                asset       = is_final-anln1
                subnumber   = is_final-anln2
                realestate  = is_realestate
                realestatex = is_realestatex
           importing
                return      = it_return.

* If Asset Master is changed with out any errors
      read table it_return with key type = 'E'.
      if sy-subrc = 0.
        flag = ' '.
      else.
        flag = 'X'.
* Call the COMMIT BAPI
        call function 'BAPI_TRANSACTION_COMMIT'
             exporting
                  wait = 'X'.
        wait up to 2 seconds.
      endif.

Regards

Gopi

Former Member
0 Kudos
784

Hi

BAPI_TRANSACTION_COMMIT :-Execute external Commit when using BAPIs

<b>

Functionality</b>This method executes a COMMIT WORK command. It is required for transactions developed outside the SAP system that change data in the SAP system by using BAPI calls.

When you call BAPIs in your program that change data in the SAP system, you must then call this method to write the changes to the database.

Messages are returned in the parameter 'Return'. The documentation for this parameter contains the return values and their meanings.

Use the method BapiService.TransactionRollback to prevent changes to the database being committed.

Parameters

WAIT

RETURN

Exceptions

Function Group

BAPT

reward if usefull

kiran_k8
Active Contributor
0 Kudos
784

Thanks a ton Gopi and Naresh,

Problem solved.

K.Kiran.