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

Create directory

Former Member
0 Likes
1,871

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

1 ACCEPTED SOLUTION
Read only

michael-john_turner
Active Participant
0 Likes
1,786

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

5 REPLIES 5
Read only

Former Member
0 Likes
1,786

Hi,

Try with the Function Module GUI_CREATE_DIRECTORY.

Satya

Read only

Former Member
0 Likes
1,786

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.

Read only

0 Likes
1,786

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

Read only

michael-john_turner
Active Participant
0 Likes
1,787

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

Read only

Former Member
0 Likes
1,786

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