Application Development 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: 

make unix directory with an abap comand

Former Member
0 Kudos

Hi,

does anybody know, how to create a unix directory using an abap command.

I couldn't find a matching fm like EPS_GET_FILE_ATTRIBUTES.

Maybe SXPG_CALL_SYSTEM with a new external command (for example: md &) defined in SM69 could work, but I don't know, how to define the starting directory and the new subdirectory using additional parameters.

And how should the fm-call look like?

Thanks for any hint.

Olaf

1 ACCEPTED SOLUTION

FredericGirod
Active Contributor
0 Kudos

Hi,

the starting directory is not important, in Unix you create a directory specify the whole directory :

mkdir /mnt/SAP/data_1 for example

Rgd

Frédéric

7 REPLIES 7

former_member188685
Active Contributor
0 Kudos
data: begin of tabl occurs 500,
        line(400),
      end of tabl.
data: unixcom like   rlgrap-filename.
data: lines type i. 
unixcom = 'mkdir dirname'.
refresh tabl.

  call 'SYSTEM' id 'COMMAND' field unixcom
                id 'TAB'     field tabl[].

  describe table tabl lines lines.
  loop at tabl.
    write:/01 tabl-line.
  endloop.
  skip 2.
  if lines = 0.
    write:/ 'NO Occurances were found'.
  endif.

the above one is one create a directory...

check it.

regards

vijay

0 Kudos

I tried this solution and it works! Thanks.

FredericGirod
Active Contributor
0 Kudos

Hi,

the starting directory is not important, in Unix you create a directory specify the whole directory :

mkdir /mnt/SAP/data_1 for example

Rgd

Frédéric

0 Kudos

Thanks Frédéric,

that was my problem: I tried to create a unix-directory with a dos-command

When using mkdir everything works fine!

Bye

Olaf

Former Member
0 Kudos

Hi Olaf,

Yes for creating a unix directory, maintain a OS command in SM69 as what you have written 'md'. Then use the function module SXPG_COMMAND_EXECUTE. For this function module you can pass the starting directory inside which you need to create the new directory. This should be passed in the additional_parameters importing parameter of this Function Module.

Cheers

JK

PS: Award points if this helps you

vinod_gunaware2
Active Contributor
0 Kudos

RSBDCOS0 Execute UNIX commands. Looks similar to the old SAPMSOS0 program that disappeared in 3.0

  • Executing Unix command from ABAP

REPORT ZUNIX.

data: unix_command(50) type c value 'ls -ls /usr/sap/trans/data'.

data: begin of internal_table occurs 0,

line(200),

end of internal_table.

PARAMETERS UNIXCOMM LIKE unix_command

DEFAULT 'ls -ls /usr/sap/trans/data' LOWER CASE.

call 'SYSTEM' id 'COMMAND' field UNIXCOMM

id 'TAB' field internal_table-SYS.

EDITOR-CALL FOR INTERNAL_TABLE DISPLAY-MODE.

*--- End of Program

regards

vinod

Former Member
0 Kudos

Hi olaf,

1. in this fm,

COMMANDNAME

will come from sm69

2. sm69 is used to define

external operating system commands

like ls (for unix) , md etc.

dir (for window)

3. In additional parameters,

u will specify,

what the os command expects.

eg.

MD d:\abc\def

where md = command name

d:\abc\def = additional paramters

regards,

amit m.