Wednesday, August 31, 2011

Do you need to execute a transaction you are not authorized for?

You need to execute a transaction for which you don't have authorization. You need to test something urgentely and you can wait to be authorized. What can you do?

You can set a breakpoint in function module AUTH_CHECK_TCODE, change the value of a variable when the breakpoint is reached and go on! Let see with an example:

I am not authorized for transaction MB11:


Go to SE37 and display the code of function module AUTH_CHECK_TCODE and set a breakpoint here:

  call 'AUTH_CHECK_TCODE'
       id 'TCODE' field tcode.

  if sy-subrc = 0. <--Set your breakpoint in this line*   auth_check_tcode enthält die Prüfungen von tcode_executable,
*   daher im OK-Fall keine Aufruf nötig.
  else.
    perform tcode_executable using tcode.
*   Keine Berechtigung für Transaktion &
    message i077(s#) with tcode raising not_authorized.
  endif.

This is a system function module, so execution won't stop at one breakpoint on it if you don't have System Debug activated. To activate System Debug: System --> Utilities --> Debug System

Once activated, we execute MB11 and the debugger is started:

Press F8 to continue until breakpoint is reached. When it is reached
double click over sy-subrc to be able to change its value from 4 to 0:

Change sy-subrc field content from 4 to 0, press the button with the pencil:
and F8 to continue with the execution and... 

Great! MB11 transaction's initial screen is showed:

  

No comments:

Post a Comment