Application Development and Automation 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: 
Read only

how i can get the sap (application server side) root dir (function module)?

Former Member
0 Likes
1,062

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

http://berardi.too.it

1 ACCEPTED SOLUTION
Read only

Lakshmant1
Active Contributor
0 Likes
666

Hi Michele,

Refer url

Check FM SUBST_GET_FILE_LIST By passing DIRNAME and FILENM as *, you can see the list of files in that directory.

Hope this helps

Thanks

Lakshman

4 REPLIES 4
Read only

Lakshmant1
Active Contributor
0 Likes
667

Hi Michele,

Refer url

Check FM SUBST_GET_FILE_LIST By passing DIRNAME and FILENM as *, you can see the list of files in that directory.

Hope this helps

Thanks

Lakshman

Read only

Former Member
0 Likes
666

TRY THIS FMS

RZL_READ_DIR_GLOBAL

RZL_READ_DIR

Read only

0 Likes
666

@ 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

Read only

Former Member
0 Likes
666

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

http://berardimichele.interfree.it