‎2009 Jun 26 3:44 PM
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
‎2009 Jun 26 3:50 PM
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
‎2009 Jun 26 3:55 PM
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.
‎2009 Jul 06 12:20 PM
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'.