‎2009 Oct 22 3:04 PM
I am trying to see if there is any easier way to use the OS path environment varibale from my abap program. Any suggesions will be highly appreciated.
Thanks
Ram
‎2009 Oct 22 3:07 PM
‎2009 Oct 22 3:08 PM
the registry path
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment
data : path type string.
CALL METHOD cl_gui_frontend_services=>registry_get_value
EXPORTING
root = cl_gui_frontend_services=>HKEY_LOCAL_MACHINE
key = 'SYSTEM\ControlSet001\Control\Session Manager\Environment'
value = 'Path'
IMPORTING
reg_value = path
EXCEPTIONS
get_regvalue_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
others = 5
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE : path.this fetches value in path
Edited by: Soumyaprakash Mishra on Oct 22, 2009 7:45 PM
‎2009 Oct 22 3:31 PM
Thanks Soumyaprakash for the quick response. I appreciate it.
Just to test, I tried copying and pasting your code in a se38 program and when i tried to run it crashed. Is there anything that i need to change here before running?
‎2009 Oct 22 5:31 PM
what does the crash say?
in windows, in start menu->run give regedit.
now in that, keep the cursor at the top node on the left hand side, search for 'Environment'.
check if you are getting the same key position or not..
‎2009 Oct 26 5:52 PM