3

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.

Boghyon Hoffmann
  • 17,103
  • 12
  • 72
  • 170
guettli
  • 25,042
  • 81
  • 346
  • 663
  • 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 Apr 18 '19 at 09:46
  • @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 Apr 18 '19 at 10:22
  • You can do an authorization trace in ST01, to see, whether the problem is because of missing authorization. – József Szikszai Apr 18 '19 at 10:49
  • Have you checked whether there are some failing authorizations for this user in SU53? – Jagger Apr 19 '19 at 20:12
  • 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 Apr 20 '19 at 05:25
  • You can debug other users in SE80 by going into `Utilities` -> `Settings` -> `ABAP Editor` -> `Debugging`, then select your other user. I am not sure if it works for RFCs, but I have been successful debugging background job users. – Eduardo Copat Aug 19 '20 at 20:14

1 Answers1

9

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.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • I updated the question: I am using the windows native sap gui and se80. – guettli Apr 18 '19 at 10:31
  • This is sad. There is no easy, simple, straight-forward solution to a common situation. Nevertheless thank you very much for you help. I tried to set a break point for a different use, but this failed. – guettli Apr 18 '19 at 10:32
  • The solution is not complex, what is complex is when you're not allowed to do your job. I usually don't have any problem to get temporarily the user being changed to type "Service" (I updated my answer "use another SAP user" to say "or change it temporarily to type "Service") – Sandra Rossi Apr 18 '19 at 11:58
  • 1
    I like people, please do not get me wrong. But I don't like it if need someone to do my daily job. It is annoying to ask someone to change the user type. I hope you understand that I complain about the situation, not about you or your really helpful answers. I wish you a happy easter. Thank you for advice. – guettli Apr 18 '19 at 12:18