‎2008 Mar 04 1:40 PM
Hi,
Is it possible to create a folder or directory in the server through code..Is there any function module or class there..
If there means plz give the sample code..
Another part..After creating the folder is it possible to give full access to the folder..
‎2008 Mar 04 1:46 PM
‎2008 Mar 04 1:53 PM
hi check this code ,
For browsing (checking the folder exists or not) you can use the following code:
code
CALL FUNCTION 'EPS_GET_DIRECTORY_PATH'
EXPORTING
EPS_SUBDIR = 'log'
DIR_NAME = 'DIR_TMP'
IMPORTING
DIR_NAME =
EXCEPTIONS
INVALID_EPS_SUBDIR = 1
SAPGPARAM_FAILED = 2
BUILD_DIRECTORY_FAILED = 3
OTHERS = 4
.
if sy-subrc 0.
"the directory not present.
endif.
[/code]
For creating directory, you have to know the exact path of your server, and then you can use the following code:
code
path = '
172.52.72.651\qfilesvr400\S109XXXX\usr\sap\TST\SYS\test'.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_CREATE
EXPORTING
DIRECTORY = path
CHANGING
RC = rc
EXCEPTIONS
DIRECTORY_CREATE_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
PATH_NOT_FOUND = 4
DIRECTORY_ACCESS_DENIED = 5
DIRECTORY_ALREADY_EXISTS = 6
UNKNOWN_ERROR = 7
others = 8
.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
<REMOVED BY MODERATOR>
venkat.
Edited by: Alvaro Tejada Galindo on Mar 4, 2008 12:27 PM