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

Function module BRAN_DIR_CREATE

Former Member
0 Likes
2,478

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?

5 REPLIES 5
Read only

gouravkumar64
Active Contributor
0 Likes
1,507

Hi,

Follow this thread,u will get ur answer.

http://scn.sap.com/thread/1515129

regards

Gourav.

Read only

Former Member
0 Likes
1,507

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.
Read only

0 Likes
1,507

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 ?

Read only

0 Likes
1,507

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.

Read only

0 Likes
1,507

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