Search code examples
abapsaprfc

How to get the name of the calling program in an asynchronous background task?


How to get the name of the calling program from within an asynchronous remote function call (aRFC) ?

CALL FUNCTION 'BAPI_MATERIAL_SAVEREPLICA' STARTING NEW TASK lv_taskname
  DESTINATION IN GROUP DEFAULT

The called BAPI triggers a user exit that I need to disable for this particular calling program. However, the local part of the stack is lost after the RFC and the name of the calling program on the local system is unknown.

The closest solution I could think of was disabling the user exit when the calling program is SAPMSSY1 (RFC calls), but that it not as accurate.


Solution

  • Maybe the parameter CALLER_PROGRAM of the function module RFC_GET_ATTRIBUTES. I'm not sure it works in all kinds of RFC calls.