cancel
Showing results for 
Search instead for 
Did you mean: 

Setting/changing environment variables

Former Member
0 Kudos

Hi all,

Environment Variables are widely used in SAP Systems to partially configure an application server or components of it.

You may also be asked by a developer to set an environment variable to turn off/on functionality within a process in order to activate alternative code paths for error analysis.

In this context SAP Note 31559 has been revised and does cover now all available methods and scope description to set/change environment variables on a Windows box running an SAP application server.

kind regards

Peter

PS: feedback is highly appreciated (missing stuff, hard to understand sections...)

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Clicking on the link displays the message:

  Translation is possibly not up-to-date

  Document is not released

William

Former Member
0 Kudos

Hi,

the master language of this note is german.

The message you got is just a warning telling you that the language version of the note you are currently reading is older than the master one.

In other words: The translation is not up-to-date.

regards

Peter

Former Member
0 Kudos

Oh, thanks Peter. I never saw that message before.

Thanks,

William

ACE-SAP
Active Contributor
0 Kudos

Hello,

Thank a lot for that question, it is great to be able to discuss the content of a note with its creator !

There is something that seems unclear to me either in the old and the new version (may be because English is not my native language)

SAP service is running under SAPService<SID> user I thought it should inherit from the environment of that user (but no SAP specific env. var are set for that user) but it is not the case.

Does the note means that when the SAP instance is started the variables defined under the registry key HKEY_LOCAL_MACHINE\SOFTWARE\SAP\<sid>\Environment are append (or replace) the existing environment variables set from the ones defined for account <SID>adm ?

I've done some testing and it seems that only the env. variables defined for <SID>adm account are effective.

What is wrong with my test ?

Create an env var for sapserviceSID:

FOR /f %u in ('wmic useraccount where name^= ^'sapserviceSID^' get sid ^| find "S-"') do set USID=%u
Reg add "HKU\%USID%\Environment " /v TEST /t REG_SZ /d "SAP_SVC"/f
Stop/start services + SAP instance

Test with set command in prog RSBDCOS0 => var TEST is not set


Create an env var for SAP env. reg key:

Reg add "HKLM\SOFTWARE\SAP\SID\Environment" TEST /t REG_SZ /d "SAP_ENV" /f

Stop/Start services + SAP instance

Test with set command in prog RSBDCOS0 => var TEST is not set

Create an env var for <SID>adm

Reg add "HKU\Environment" TEST /t REG_SZ /d "USR_ENV" /f

Stop/Start service + SAP instance

Test with set command in prog RSBDCOS0 => var TEST is set to USR_ENV

Best regards

ACE-SAP
Active Contributor
0 Kudos

Feedback on feedback is highly appreciated

Thanks for your answer...

Former Member
0 Kudos

Hi,

As described in the note SAP System specific environment variable are defined by reading HKEY_LOCAL_MACHINE\Software\SAP\<SID>\Environment. All (or most) environment variables defined in the windows user environment for the user running the service (default: SAPService<SID>) are overwritten.

The content of HKEY_LOCAL_MACHINE\Software\SAP\<SID>\Environment is overwritten by the environment variables defined for the user specified in HKEY_LOCAL_MACHINE\Software\SAP\<SID>\admUser everytime a SAP System is started.

regards

Peter