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

To create folder in Application server

Former Member
0 Likes
1,139

hi,

How to create folder in application server from presentation server??

how is the program it??

reply me soon...

thx,

s.suresh.

6 REPLIES 6
Read only

Former Member
0 Likes
827

Hi Suresh,

Please check the below code. Hope this might be helpfull you.

**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.

Read only

0 Likes
827

hi..

its not come output...

Read only

Former Member
0 Likes
827

Hi,

call function 'GUI_CREATE_DIRECTORY'

exporting

dirname = '//<ip_address>/qfilesvr400/<host>/usr/sap/TST/SYS/Folder1'

exceptions

failed = 1

others = 2.

Read only

0 Likes
827

Hi,

call function 'GUI_CREATE_DIRECTORY'

exporting

dirname = '//10.145.14.156/safil/<give your host name >/usr/temp/myFolder'

exceptions

failed = 1

others = 2.

Read only

0 Likes
827

hi..murali,

'//<ip_address>/qfilesvr400/<host>/usr/sap/TST/SYS/Folder1'??

what is used it????

reply me soon,

s.suresh

Read only

Former Member
0 Likes
827

hi Suresh

Hope u r having nice day

here i am sending a sample report which can upload the file to Application Server which inturn automatically create folder .

REPORT ZSHR_UPLOAD_TO_APPLICATION .

DATA : BEGIN OF IT_MAT OCCURS 0,

MBRSH LIKE MARA-MBRSH,

MTART LIKE MARA-MTART,

MAKTX LIKE MAKT-MAKTX,

MEINS LIKE MARA-MEINS,

END OF IT_MAT.

DATA : W_DIR(40).

MOVE 'D:\usr\sap\DEV\DVEBMGS00\work\SHR' TO W_DIR.

  • "SHR" IS A FOLDER NAME TO BE CREATED

START-OF-SELECTION.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\MAT.TXT'

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = IT_MAT

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_READ_ERROR = 2

NO_BATCH = 3

GUI_REFUSE_FILETRANSFER = 4

INVALID_TYPE = 5

NO_AUTHORITY = 6

UNKNOWN_ERROR = 7

BAD_DATA_FORMAT = 8

HEADER_NOT_ALLOWED = 9

SEPARATOR_NOT_ALLOWED = 10

HEADER_TOO_LONG = 11

UNKNOWN_DP_ERROR = 12

ACCESS_DENIED = 13

DP_OUT_OF_MEMORY = 14

DISK_FULL = 15

DP_TIMEOUT = 16

OTHERS = 17.

OPEN DATASET W_DIR FOR OUTPUT IN TEXT MODE ENCODING UTF-8.

IF SY-SUBRC EQ 0.

LOOP AT IT_MAT.

TRANSFER IT_MAT TO W_DIR.

ENDLOOP.

ENDIF.

CLOSE DATASET W_DIR.

IF USEFUL AWARD POINTS.

REGARDS

HEMASEKHARA REDDY S