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: 

EDIT REGISTRY from ABAP

Former Member
0 Kudos

Good morning to all,

I want to read the registry settings of the User's machine (presentation server) and edit the registry accordingly. Am using the following code but am getting Sy-subrc = 2 (control error).

Any suggestions will be highly appreciated.

Code snippet :

Data : CreationType_value type string.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>REGISTRY_GET_VALUE

EXPORTING

ROOT = CL_GUI_FRONTEND_SERVICES=>HKEY_CURRENT_USER

KEY = 'Software\SAP\SAPLogon\Settings\System\Wizard'

VALUE = 'CreationType'

IMPORTING

REG_VALUE = CreationType_value

EXCEPTIONS

GET_REGVALUE_FAILED = 1

CNTL_ERROR = 2

ERROR_NO_GUI = 3

NOT_SUPPORTED_BY_GUI = 4

others = 5

.

WRITE / WorkOffline_value.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

1 ACCEPTED SOLUTION

alejandro_bindi
Active Contributor
0 Kudos

Maybe the logged-on user (on Windows) must have admin rights to allow the method to modify registry? Just an idea, try with an administrator if you didn't yet...

3 REPLIES 3

alejandro_bindi
Active Contributor
0 Kudos

Maybe the logged-on user (on Windows) must have admin rights to allow the method to modify registry? Just an idea, try with an administrator if you didn't yet...

0 Kudos

Are you sure the value for ROOT = is correct in your code?

Seem like you have a typo. Should it not just be

Root = 'HKEY_CURRENT_USER'

0 Kudos

Correction. You code is quite fine. The global parameter is correct that you use for root.

Olivier