2

I was asked by the IT Department to write an ABAP program that switches the profile parameter login/server_logon_restriction from 0 to 1 and back automatically triggered (time etc) on all of our SAP servers.

I am not very familiar in the SAP environment yet and until now I managed to get the wanted parameter by using:

RSAN_SYSTEM_PARAMETERS_GET

and

RSAN_SYSTEM_PARAMETERS_READ

But I cannot find anything to change and save them dynamically. Is this even possible?

Cheers, Nils

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Nils
  • 23
  • 2

2 Answers2

4

login/server_logon_restriction parameter dynamic so you can change it via cl_spfl_profile_parameter=>change_value class method.

You can configure background job for automatically trigger it in t-code SM36.

The method don't save the given value to profile file, so the parameter turn back profile value after system restart.

Current logged-in users can continue to use system. May be you can want to inform them with TH_POPUP function then kick from the system.

mkysoft
  • 5,392
  • 1
  • 21
  • 30
  • 3
    Note that it works only for one application server at a time, you need to call it for each application server of your SAP system. The list of application servers may be obtained by calling the function module `TH_SERVER_LIST`. – Sandra Rossi Jun 12 '20 at 13:54
0

Example of code using cl_spfl_profile_parameter=>change_value, which works well on ABAP 7.40 SP 23 (NB: sapgui/user_scripting is a dynamic parameter i.e., it can be changed at runtime).

Note that it works along with the function module TH_SERVER_LIST, in case the SAP instance runs with several application servers (for load distribution):

REPORT z_activate_sap_gui_scripting.

TYPES tt_server TYPE STANDARD TABLE OF msxxlist WITH EMPTY KEY.

DATA(lt_server) = VALUE tt_server( ).
CALL FUNCTION 'TH_SERVER_LIST' TABLES list = lt_server.

LOOP AT lt_server REFERENCE INTO DATA(ls_server).
  cl_spfl_profile_parameter=>change_value(
    EXPORTING
      name        = 'sapgui/user_scripting'
      value       = 'TRUE'
      server_name = CONV #( ls_server->name )
    IMPORTING
      msg         = DATA(msg)
    RECEIVING
      rc          = DATA(rc) ).
  WRITE : / ls_server->name, rc, msg.
ENDLOOP.

The effect of dynamic switching can be seen via the transaction code RZ11: RZ11 profile parameter value of sapgui/user_scripting

NB: not related to the topic, only specific to sapgui/user_scripting, the effect can be also seen by logoff and logon again > SAP GUI options > Script Recording and Playback is activated:

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48