‎2008 Jul 03 11:35 AM
* 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")
it's easy to adapt the code to any os with the
right modifications (use this as a sort of exercise)..
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
‎2008 Jul 03 11:52 AM
Hi Michele Berardi,
If you use the Function Module
RZL_READ_DIR_GLOBAL ,You willl get all the directories on the aplliction server.
Among those The common prex in all the paths gives you the root directory of your application server.
Hope this logic solves your probelm.
Regards,
Rama.
‎2008 Jul 03 12:19 PM
@Rama
as i explained in my old post:
the
RZL_READ_DIR_GLOBAL function module
consider the SAP root path as implicit...
and you don't have a way to retreive it..
i need the "Absolute Path" instead of a simple list
of "relative paths" (in case of you must pass the path
to external programs...)
this is the reason behind my workaround ...
Michele