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 Function module with commit work

Former Member
0 Likes
4,877

Hello,

I have called 2 BAPI functio modules one by one and said commit work after function modules.

If first is succussful and 2nd one fails, will commit work save data to database.

COMMIT WORK is written after 2 BAPI'S.

Regards,

Satya

3 REPLIES 3
Read only

Former Member
0 Likes
3,875

No, It will not get updated. I mean to say the first bapi is failed then the first bapi data is not updated.

If the second BAPI is not dependent on first BAPI then the data gets updated.

Regards,

Bharagava

Edited by: Bhargava TC on Jun 26, 2009 4:51 PM

Read only

Former Member
0 Likes
3,875

Hi,

It depends on the Bapi's which you are using...some of bapi's have internal commit for which there is not required to call the BAPI_TRANSACTION_COMMIT fm to update the database.

If there is no internal commit then they will not get updated.

Read only

dhirendra_pandit
Active Participant
0 Likes
3,875

Hi,

Yes It is poosible however make sure there is no dependency between both the bapi

if there is anything like header or item then you need to take care of that.

i have one sample code you can refer that

  • Create Terratory

CALL FUNCTION 'BAPI_TERRITORY_CREATE'

EXPORTING

territory_data = wa_terr_creat

IMPORTING

terrid = w_terr_id

TABLES

territory_t = t_terr_txt[]

return = t_msgtab[].

IF NOT w_terr_id IS INITIAL.

  • IF Employee assigment record avails

IF NOT wa_terr-objid IS INITIAL

AND NOT wa_terr-partner IS INITIAL.

  • Populate the employee assignment record in internal table

wa_terr_emp-employee = wa_terr-partner. "Business Partner ID

wa_terr_emp-pos_code = wa_terr-objid. "Employee position

  • Append description in internal table

APPEND wa_terr_emp TO t_terr_emp.

  • Set indicator for employee assignment

wa_change-employees = c_x.

CALL FUNCTION 'BAPI_TERRITORY_CHANGE'

EXPORTING

terrid = w_terr_id

valid_date = wa_terr-valid_from

objects_to_be_changed = wa_change

TABLES

employee = t_terr_emp[]

return = t_msgtab[].

ENDIF.

  • Save the Changes

CALL FUNCTION 'CRM_TERRMAN_COMMIT'

EXPORTING

iv_and_wait = c_x.

ELSE.

w_error_counter = w_error_counter + 1.

CALL FUNCTION 'CRM_TERRMAN_ROLLBACK'.