3
votes

I have written an ABAP function module, which works fine if I execute it with my developer account.

If another user executes it, he gets an empty result. The other user is an RFC-account which cannot log in with the SAP GUI.

I am clueless how to debug this. How can I execute/debug a function module and pretend to be a different user?

I am using the Windows-native SAP GUI and transaction code SE80.

1
Is there any authorization check in function module? If yes, this could be one possible reason, why the result is different, than with your own user. - József Szikszai
@JozsefSzikszai a report gets called. In my example an ad-hoc query named AQA0SYSTQV000058TEST========== I guess some auth checks get done inside this report. - guettli
You can do an authorization trace in ST01, to see, whether the problem is because of missing authorization. - József Szikszai
Have you checked whether there are some failing authorizations for this user in SU53? - Jagger
While Sandra answer is completely correct (external debugging can be done only via dialog user) I suppose your problem lies elsewhere. Execution of RFC is possible by any authorized user, not only dialog, and the empty table that is returned is probably caused by the lack of authorizations on remote system - Suncatcher

1 Answers

9
votes

If the SAP user is defined as type "Dialog" or "Service" (transaction code SU01) then it's technically feasible to use the SAP GUI (log in with that user and debug).

If the SAP user is defined as type "Communication" or "System" then it's not possible at all.

You can see that as a security measure: if you have a Web Service which runs under a given SAP user, it should not be possible that this user is used for direct SAP GUI usage, to limit possible attacks.

So, I think the only reasonable solution is to use temporarily another SAP user of type "Service" for instance, or change the type of the SAP user, for the duration of the debug.

It's possible to debug another user by selecting the user to debug, either via Eclipse ADT debug properties, or via the ABAP Workbench ABAP Debug Settings, depending on the Integrated Development Environment you are using.

Another solution is, if you have the possibility to change your code temporarily, to add an endless loop (DO. ENDDO.), debug the running program via the transaction SM50, menu Administration -> Program -> Debugging, which should open a debug dialog which points at the loop, place the cursor on the line after the loop and press F12 to continue from there.