11-17-2006 12:28 PM
Hello all.
How can i create a directory using the servers point of view and not the frontend point of view?
Thank you
Nuno Silva
11-17-2006 12:38 PM
The easiest way to do it programmatically is to call an external command, as configured in SM69. You can use the various function modules in function group SXPT to execute the defined commands (eg SXPG_COMMAND_EXECUTE).
To create a directory, create a command that calls, eg, "cmd /c mkdir directoryname" (assuming Windows, for Unix you'll need to call eg "/bin/sh mkdir directoryname") and then call that with function module SXPG_COMMAND_EXECUTE.
MJ
11-17-2006 12:31 PM
11-17-2006 12:31 PM
ru referring to as creation of directory in application server....this will be normally done by the basis guys and the authorization is limited according to user requirements.
11-17-2006 12:33 PM
What i mean is the same way you use OPEN DATASET to create files i need to create directorys.
GUI_CREATE_DIRECTORY won't do, because it's the frontend that creates the directory. What i need is the server to create the directory.
Thank you
Nuno Silva
11-17-2006 12:38 PM
The easiest way to do it programmatically is to call an external command, as configured in SM69. You can use the various function modules in function group SXPT to execute the defined commands (eg SXPG_COMMAND_EXECUTE).
To create a directory, create a command that calls, eg, "cmd /c mkdir directoryname" (assuming Windows, for Unix you'll need to call eg "/bin/sh mkdir directoryname") and then call that with function module SXPG_COMMAND_EXECUTE.
MJ
11-17-2006 12:44 PM
data:v_ path type string.
data: v_rc type sy-subrc.
path = '
<SERVER_IP_ADDRESS>\PATH\DIRECTORY_NAME'.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_CREATE
EXPORTING
DIRECTORY = v_path
CHANGING
RC = v_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.
Regards
Kathirvel