Different behaviour of BAPI's inside BADI when triggered from WEB UI and SAP GUI
When ever a new bank account is added to a BP then I need to set the previously added bank account's valid to date to sy-datum -1 and add the new bank account on business agreement present on BP.
1. Use BUPA_BANK_CALLBACK FM to get the added bank data inside BADI BUPA_BANK_UPDATE~CHANGE_BEFORE_UPDATE method as it gets called from both WEB UI and GUI.
2. change old banks valid to date using FM: BAPI_BUPA_BANKDETAIL_CHANGE.
3. add the bank to the business agreement by calling FM BAPI_BUPA_FRG0130_CHANGE in update task, Why update task? because if I use the same FM without update task then it throws an error that the bank id I am trying to assign to business agreement doesn't exist.
My approach works fine in case of GUI but when same BADI is triggered from WEB UI the BAPI's I have used inside this BADI give different result than what they gave when ran from GUI side.
1. BUPA_BANK_CALLBACK FM gives all the bank account in old table and all the bank accounts along with new bank a/c added in new table while when executed from GUI side BUPA_BANK_CALLBACK gives no result in old table and only newly added account in new table. This can be the case because when called from WEB UI BOL buffer is loaded and FM picks from buffer.
2. FM BAPI_BUPA_FRG0130_CHANGE gives error that the BP is locked by me.
3. FM: BAPI_BUPA_BANKDETAIL_CHANGE gives error( no specific error just that error occurred while call to this FM ) while changing bank validity when called from WEB UI but not when called from GUI.
Please suggest why same FM's behave in a different manned when called from WEB UI and GUI inside a BADI.
Thanks in advance.