Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Turning sapgui/user_scripting on and off in code

Former Member
0 Kudos

Hi All, we have a requirement to turn GUI scripting on and off at certain times of the day. Rather than making the basis guys do it by hand using rz11, I want to do it automatically.

The best way seems to be to write ABAP programs to turn the parameter on and off and schedule them as jobs to run at particular times. However, I can't figure out what database table the value of the sapgui/user_scripting parameter is held in, or any other way of getting and setting the parameter value. It's not in TPYFYPROPTY, which is where I thought it would be.

Can anyone give me a clue how to do this?

Cheers,

Mark

5 REPLIES 5

Former Member
0 Kudos

Hi,

The table is TPFYPROPTY, not TPYFYPROPTY and the parameter sapgui/user_scripting exists there.

Svetlin

0 Kudos

Hi Svetlin,

you're right, I misspelled the table name. However, I cannot see a field in the TPFYPROPTY table which holds the actual value of the parameter. Can you point me in the right direction?

Mark

0 Kudos

Hi Mark,

If you check the table content you can find the record mentioned by Svetlin. Goto SE16 and enter this table and give the following value.

OBJ_NAME(Object Name) = SAPGUI/USER_SCRIPTING

But you can use the transaction RZ11 to maintain this. How about writing a BDC program using this?

For more info please have a look at this document.

http://www.synactive.com/download/sap%20gui%20scripting/sap%20gui%20scripting%20security%20settings....

Cheers

Vinod

Message was edited by: Vinod C

0 Kudos

Hi Mark,

Actually take a look at program RSPFLDOC and subroutine CHANGE_VALUE.

From what I can see they use the following logic to change value..

<b> IF ON_ALL_HOSTS = 'X'.

CALL FUNCTION 'TH_SERVER_LIST'

TABLES

LIST = SRVLIST

EXCEPTIONS

NO_SERVER_LIST = 1

OTHERS = 2.</b>

RC = SY-SUBRC.

IF SY-SUBRC = 0.

DESCRIBE TABLE SRVLIST LINES NO_SERVER.

ELSE.

  • Keine Server-Liste erhalten

MESSAGE E623(00).

ENDIF.

ELSE.

<b> NO_SERVER = 1.

CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'rdisp/myname'

ID 'VALUE' FIELD MYNAME.

SRVLIST-NAME = MYNAME.

APPEND SRVLIST.</b>

ENDIF.

LOOP AT SRVLIST.

MSG = TEXT-310.

REPLACE '&' WITH TPFYPROPTY-PARANAME INTO MSG.

REPLACE '$' WITH SRVLIST-NAME INTO MSG.

MSG+400 = '...'.

CONDENSE MSG.

PROZENT = SY-INDEX * 100 / NO_SERVER.

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = PROZENT

TEXT = MSG.

<b> PERFORM CHANGE_VALUE_ON_HOST USING SRVLIST-NAME

CHANGING RC MSG EXIT_LOOP.</b>

CASE RC.

WHEN 0.

MSG = TEXT-312.

REPLACE '&' WITH TPFYPROPTY-PARANAME INTO MSG.

REPLACE '$' WITH SRVLIST-NAME INTO MSG.

CONDENSE MSG.

WHEN 110.

LEAVE_SCREEN = SPACE.

ENDCASE.

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

PERCENTAGE = PROZENT

TEXT = MSG.

IF RC = 0. MSG = TEXT-318. ENDIF.

IF EXIT_LOOP = 'X'.

EXIT.

ENDIF.

ENDLOOP.

Similarly take a look at subroutine READ_VALUE.

They use the following C call to read parameter values..

CALL 'C_SAPGPARAM' ID 'NAME' FIELD TPFYPROPTY-PARANAME

ID 'VALUE34' FIELD USR_PARVALUE

ID 'VALUE44' FIELD SHM_PARVALUE.

ON_ALL_HOSTS = TPFYPROPTY-CHECKALL.

Try using this as a reference and arrive at a solution..

Hope this helps..

Sri

0 Kudos

Hi Sri,

thank you for your message, it was very interesting. The example you gave of how to read parameter values was very useful. However, I found a better way of setting the parameter value, which you may find useful:

---

write:/ 'Switching GUI Scripting OFF...'.

call function 'TH_CHANGE_PARAMETER'

exporting:

PARAMETER_NAME = 'sapgui/user_scripting'

PARAMETER_VALUE = 'FALSE'

EXCEPTIONS COMMUNICATION_FAILURE

UNKNOWN_OPCODE = 101

NOT_AUTHORIZED = 106

NOT_IN_SAME_SYSTEM = 107

NOT_CHANGEABLE = 108

NOT_FOUND = 109

INVALID_VALUE = 110

SHMPRF_ERROR = 111

OTHERS = 112.

---

I can't find any documentation about how this function works, but it does work.

Cheers,

Mark