‎2008 May 07 2:20 PM
hi,
i need to get the sap root installation folder (for ex: "C:\MiniWAS")
is there any function modules ?
for sap gui directory i use:
"
DATA PS_WORKDIR TYPE STRING.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_SAPGUI_DIRECTORY
CHANGING
SAPGUI_DIRECTORY = PS_WORKDIR.
"
but i need also the root path of the SAP application server too!
thanks in advice
Michele Berardi
System Developer
‎2008 May 07 2:26 PM
‎2008 May 07 2:26 PM
‎2008 May 07 2:29 PM
‎2008 May 07 3:35 PM
@ Lakshman Tandra
@ moazam hai
thanks for the quick answers ( i known the RZL_* class..)...
anyway
why i must use function modules that list files and let consider the sap root folder as implicit
(i need to extract it!!...)?
why waste resources building a table extracting paths cutting filenames , etc... (because i list files..
instead simply get the physical SAP root path!) ??
there isn't a function module as:
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_SAPGUI_DIRECTORY
that simply return into a string (as GET_SAPGUI_DIRECTORY do..) the correct installation path of SAP?
Thanks
Michele
‎2008 Jun 11 11:50 PM
forget to paste (could be usefull ..)
my solution to this lack of sap function modules..:
* assume sap home for ex. "C:\MiniWAS\" as implicit
DATA AS_FSYSTEM_SEPARATOR type C
VALUE '\'.
DATA AS_GET_TRIDEDSK_CMD_file type string
VALUE 'gethome.cmd'.
DATA AS_GET_TRIDEDSK_TMP_file type string
VALUE 'TRIDEDSK.tAS'.
DATA: BEGIN OF AS_TRIDEDSKREC,
PATH(256) type C,
END OF AS_TRIDEDSKREC.
DATA AS_TRIDEDSK_path type string.
* TOOL AS GET AS_TRIDEDSK_path ---------BEGIN
CONCATENATE AS_GET_TRIDEDSK_CMD_file INTO
AS_GET_TRIDEDSK_CMD_file SEPARATED BY AS_FSYSTEM_SEPARATOR.
CONCATENATE AS_GET_TRIDEDSK_CMD_file AS_GET_TRIDEDSK_TMP_file INTO
AS_GET_TRIDEDSK_CMD_file SEPARATED BY ' '.
OPEN DATASET AS_GET_TRIDEDSK_TMP_file FOR OUTPUT
IN TEXT MODE ENCODING DEFAULT.
CLOSE DATASET AS_GET_TRIDEDSK_TMP_file.
* FILTER[1]: this file must exist (needed by the filter option)
Open Dataset AS_GET_TRIDEDSK_TMP_file for input
in text mode
encoding default
filter AS_GET_TRIDEDSK_CMD_file.
CLOSE DATASET AS_GET_TRIDEDSK_TMP_file.
* FILTER[2]: read the result of the system command "echo"
Open Dataset AS_GET_TRIDEDSK_TMP_file for input
in text mode
encoding default.
DO.
READ DATASET AS_GET_TRIDEDSK_TMP_file INTO AS_TRIDEDSKREC.
IF SY-SUBRC NE 0.
EXIT.
ELSE.
AS_TRIDEDSK_path = AS_TRIDEDSKREC-PATH.
ENDIF.
ENDDO.
CLOSE DATASET AS_GET_TRIDEDSK_TMP_file.
* TOOL AS GET AS_TRIDEDSK_path -----------END
this is an example of the "gethomecmd.cmd"
called by sap (retreive the full path of sap root),
save it under the SAP ROOT (for ex. "C:\MiniWAS")
gethomecmd.cmd
-
rem echo %~dp0> TRIDEDSK.tAS
echo %~dp0> %1
rem echo %~dp0> TRIDEDSK.tAS
rem echo %~dp0> c:\TRIDEDSK.tAS
-
Hope this help the comunity ;.-D !
-
Michele Berardi
System Developer