Hello
You have two options-
1. You can call the following FM in User Exit and read the program stack to know that control is coming from BAPI.
SYSTEM_CALLSTACK
2. You are set the memory ID in interface where you are calling the BAPi and read the memory ID in User exit.
Regards
Sandy