‎2013 Jan 12 8:57 PM
Iam using function module BRAN_DIR_CREATE to create a custom folder.
This FM created a folder in directory SAP_SAPUSERS (Here application server is on Unix operating system).
Question.... does this function module works the same way in all operating systems?
‎2013 Jan 13 4:11 AM
‎2013 Jan 13 4:24 AM
BRAN_DIR_CREATE won't work if application server is not UNIX.
You can ascertain this by looking at the code below, copied from BRAN_DIR_CREATE function, where UNIX style command line option "-p" is used on "mkdir" command that is hard coded. This "mkdir" command syntax with "-p" option will not be valid on a Windows based application server.
| COMMAND1(9) | = 'mkdir -p '. |
COMMAND1+9(55) = 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. |
‎2013 Jan 14 3:27 PM
I actually have 2 systems available where one application server is on Unix and the other one on windows NT. I tested on windows NT today and it works just like it did on Unix.
both the places, it created the new folder in SAP_SAPUSERS directory.
Is the directory SAP_SAPUSERS is a default one which exists no matter on which OS the application server is ?
‎2013 Jan 14 4:23 PM
Well, since that function is based on "mkdir" command and since that command is available on both UNIX and Windows NT and accepts folder name as argument it will create the directory on both UNIX and Windows NT application server.
However, on Windows NT it will also create a folder with name "-p" as Windows doesn't recognize the UNIX command line option "-p" which means to create a parent directory if it doesn't exist)
SAP_SAPUSERS may be the home directory of the SAP user on your system, so that is why your new directory is getting created there. You can always give an absolute path.
‎2013 Jan 14 8:25 PM
Thanks Vishnu,
The program we are developing will be given to different customers of ours to install.
Each customer may have different OS for their application servers. What do you think would be the best option to use that would create a new folder the same way no matter which OS their application server is on?
thanks