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

How to create directory

Former Member
0 Likes
672

Dear Experts,

Anybody have an idea about how to create a directory in unix server through ABAP code.. How it is possible ? Please give me the solution with example.

Thanks and Regards,

Hetal

Dear Experts,

Anybody have an idea about how to create a directory in unix server through ABAP code.. How it is possible ? Please give me the solution with example.

Thanks and Regards,

Hetal

2 REPLIES 2
Read only

Sm1tje
Active Contributor
0 Likes
547

One way would be to execute unix commands.

FM SXPG_COMMAND_EXECUTE can be used to call UNIX Scripts. To use SXPG_COMMAND_EXECUTE you first have to create a logical command in SM69. Here you create a command name and in our case we link it to a UNIX Script.

Then you use your logical command to call the function module.

Some documentation for this:

[SXPG_COMMAND_EXECUTE|http://help.sap.com/saphelp_nw04/helpdata/en/fa/0971fb543b11d1898e0000e8322d00/content.htm]

[Defining External Commands|http://help.sap.com/saphelp_erp2005/helpdata/en/c4/3a8023505211d189550000e829fbbd/content.htm]

Read only

Former Member
0 Likes
547

Hi Micky,

Your replied answer is really very helpfull to me .. But still i got the one error.. function returns the error no 'NO_PERMISSION'.How can i solve this problem. I had written the following code..

where : 'ZMKDIR' is commond which was created in SM69.

addpara containing /devbkp/payslip/CDV/test where test is directory name which i have to create and /devbkp/payslip/CDV/ is path where i have to create directory.

****************************************************************

data: para(60) type c VALUE '/devbkp/payslip/CDV/test'.

data: addpara like SXPGCOLIST-PARAMETERS.

data: protocol like BTCXPM OCCURS 0.

addpara = para.

CALL FUNCTION 'SXPG_COMMAND_EXECUTE'

EXPORTING

COMMANDNAME = 'ZMKDIR'

ADDITIONAL_PARAMETERS = addpara

OPERATINGSYSTEM = SY-OPSYS

TARGETSYSTEM = SY-HOST

  • DESTINATION =

  • STDOUT = 'X'

  • STDERR = 'X'

  • TERMINATIONWAIT = 'X'

  • TRACE =

  • DIALOG =

  • IMPORTING

  • STATUS =

  • EXITCODE =

TABLES

EXEC_PROTOCOL = protocol

EXCEPTIONS

NO_PERMISSION = 1

COMMAND_NOT_FOUND = 2

PARAMETERS_TOO_LONG = 3

SECURITY_RISK = 4

WRONG_CHECK_CALL_INTERFACE = 5

PROGRAM_START_ERROR = 6

PROGRAM_TERMINATION_ERROR = 7

X_ERROR = 8

PARAMETER_EXPECTED = 9

TOO_MANY_PARAMETERS = 10

ILLEGAL_COMMAND = 11

WRONG_ASYNCHRONOUS_PARAMETERS = 12

CANT_ENQ_TBTCO_ENTRY = 13

JOBCOUNT_GENERATION_ERROR = 14

OTHERS = 15

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.