‎2016 May 27 9:57 AM
Hello Everyone,
I have a requirement to create a directory on the application server through programming without BASIS Team approach.
Will it possible?.
‎2016 May 27 10:00 AM
Hi Shankar,
Use function module 'BRAN_DIR_CREATE' for creating folder.
‎2016 May 27 11:53 AM
Hi Shankar,
Or
Use the FM which Pranay Informed.
here is the example:
1. Copy FM 'BRAN_DIR_CREATE' to a custom FM 'ZBRAN_DIR_CREATE'.
2. Change the TYPE to STRING from BRANINT-DIRNAME for import parameter DIRNAME
3. Change/Increase the length by 50 or more for the field COMMAND1 in source code line# 11.
4. Change COMMAND1+9(55) = DIRNAME. to COMMAND1+9(105) = DIRNAME.
FUNCTION ZBRAN_DIR_CREATE.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(DIRNAME) TYPE STRING
*" EXCEPTIONS
*" ALREADY_EXISTS
*" CANT_CREATE
*"----------------------------------------------------------------------
DATA: COMMAND1(120),
SRVNAME(20),
BEGIN OF TABL OCCURS 0,
LINE(200),
END OF TABL.
DATA: BEGIN OF FILE_LIST OCCURS 0.
INCLUDE STRUCTURE MSXXLIST.
DATA: END OF FILE_LIST.
CLEAR FILE_LIST.
SRVNAME = SPACE.
CALL FUNCTION 'RZL_READ_DIR'
EXPORTING NAME = DIRNAME
SRVNAME = SRVNAME
TABLES FILE_TBL = FILE_LIST
EXCEPTIONS NOT_FOUND = 1
ARGUMENT_ERROR = 2
SEND_ERROR = 3.
IF SY-SUBRC EQ 0.
RAISE ALREADY_EXISTS.
ENDIF.
COMMAND1(9) = 'mkdir -p '.
COMMAND1+9(105) = DIRNAME.
CALL 'SYSTEM' ID 'COMMAND' FIELD COMMAND1
ID 'TAB' FIELD TABL-*SYS*.
CLEAR FILE_LIST.
SRVNAME = SPACE.
CALL FUNCTION 'RZL_READ_DIR'
EXPORTING NAME = DIRNAME
SRVNAME = SRVNAME
TABLES FILE_TBL = FILE_LIST
EXCEPTIONS NOT_FOUND = 1
ARGUMENT_ERROR = 2
SEND_ERROR = 3.
IF SY-SUBRC NE 0.
RAISE CANT_CREATE.
ENDIF.
ENDFUNCTION.
‎2016 May 27 12:04 PM
If developers are allowed to create directories, this may become a mess in the directories, and I'm surprised that you want to bypass the administrators. At least, they should be implied in the process and agress of what is done. Maybe one day, an program will mass delete the directories, that will be fun . That's a matter of domain of responsibility that you are about to break.
‎2016 May 27 12:42 PM
Talking of removing directories, I wonder if anyone will try using the function module SXPG_COMMAND_EXECUTE with a command of rm -r......
‎2016 May 31 2:50 PM
Hi Sandra Rossi,
Being a novice and lack of enough knowledge on this particular concept ,I had given a try ,Finally the issue has been solved with the help of our fellow basis team.
Regards,
Shankar