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 folder in application server

Former Member
0 Likes
15,012

Hi friends,

I have to create a folder in application server and create files in the folder. I am using function module 'BRAN_DIR_CREATE' for creating folder. It is working fine but it is accepting path of max. 55 characters.

But my requirement needs path of > 55 characters. Is there any alternative for this function module which accepts path > 55 characters.

Thanks in advance.

Regards

Vasu

8 REPLIES 8
Read only

Former Member
0 Likes
5,274

hi,

use this fm .

WBMR_CREATE_APPL_FOLDER

rgrds,

Shweta

Read only

Former Member
0 Likes
5,274

Hi,

Refer

Read only

Former Member
0 Likes
5,274

Hi Vasu,

you can create folder in application server by using transaction code ' AL11' .

Check the link given to create:

Hope it helps you.

Thanks,

Sarita Singh

Read only

Former Member
0 Likes
5,274

Hi,

Use this FM.

FM: - SO_FOLDER_INSERT_API1

Regards,

Shamma

Read only

Former Member
0 Likes
5,274

Hi Vasu,

Do one thing. Try to write the statemnt

w_command type c value 'mkdir testdir'.

CALL 'SYSTEM' ID 'COMMAND' FIELD w_command.

Hope this helps...

Thanks,

Babu Kilari

Read only

Former Member
0 Likes
5,274

Did not get the required answer. Closing thread as of now.

Read only

0 Likes
5,274

Hi Vasu,

The following code for create folder in application server.

DATA: l_com TYPE rlgrap-filename.

CALL FUNCTION 'PFL_CHECK_DIRECTORY'

   EXPORTING

     directory         = directory " Application server path(\\test\test1\test2)

   EXCEPTIONS

     pfl_dir_not_exist = 1.

IF sy-subrc = 1.

   CONCATENATE 'cmd /c mkdir' directory INTO l_com SEPARATED BY space.

   CALL 'SYSTEM' ID 'COMMAND' FIELD l_com.

ENDIF.

Read only

Former Member
0 Likes
5,274

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.