2009 Feb 04 1:28 PM
Hi Experts,
Please tell me how to create a sap directory via coding in application server.
Please tell me step by step n send the code also.I have tried alot using FM 'SXPG_COMMAND_EXECUTE' but i dont know how to use it n wht are d parameters i need to pass.
Also, i found that we need to create a external command in SM69 to pass in this FM...i dont know how to create this.
Please help me out.
2009 Feb 05 6:42 AM
Hi friend,
1. Goto to Transaction SM69.
2. Click on F5.
3. Click on F6.
4. Enter a name in Command Name box ex: z_com
5. Enter a os command in Operating system command box. ex: mkdir (creating a directory)
6. Give location in application server in Parameters for operating system command box ex: /C dir
7. Click Save.
Goto SE 38 and develop a report using FM 'SXPG_COMMAND_EXECUTE' .
Ex:
REPORT zawi_demodownload .
data: g_out like BTCXPM occurs 0,
z_com type SXPGCOLIST-NAME value 'mkdir'.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = z_com
TABLES
exec_protocol = g_out
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.
.......
ENDIF.
Thanks.......
2009 Feb 04 1:54 PM
Hi
You must use SM69 to define operating system command. For example ZMKDIR and then the operating system command would be mkdir. You would have to check the box additional parameters allowed.
The from your ABAP program you can call function module SXPG_COMMAND_EXECUTE passing the command ZMKDIR and the path.
Hope this helps.
Thanks
Viquar Iqbal
2009 Feb 04 2:34 PM
can u gimme a complete program code.I am askin this bcoz i have tried this earlier bt its not working.May be i am not passing the right values.Please if u gimme me, dat will be a gr8 help.
2009 Feb 04 2:44 PM
if you are system is a Unix based system.. the command in SM69 would be
mkdir --- create directory
The commands keep changing as per your server Operating system.. and the command can be executed using the FM you already have it.
2009 Feb 04 2:40 PM
Why do you want to do that?
Ask your BASIS consultant for that directory.
He will gladly do it for you. Besides, there are so many things involved, that I would not recommend to try to do it in ABAP at all. Especially, since you cannot be sure that the OS-level SAP user has the authority to create directories where you want them to be created.
Christian
2009 Feb 05 5:30 AM
2009 Feb 05 6:42 AM
Hi friend,
1. Goto to Transaction SM69.
2. Click on F5.
3. Click on F6.
4. Enter a name in Command Name box ex: z_com
5. Enter a os command in Operating system command box. ex: mkdir (creating a directory)
6. Give location in application server in Parameters for operating system command box ex: /C dir
7. Click Save.
Goto SE 38 and develop a report using FM 'SXPG_COMMAND_EXECUTE' .
Ex:
REPORT zawi_demodownload .
data: g_out like BTCXPM occurs 0,
z_com type SXPGCOLIST-NAME value 'mkdir'.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = z_com
TABLES
exec_protocol = g_out
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.
.......
ENDIF.
Thanks.......
2009 Feb 05 10:13 AM
Thanks buddy...but still its not working...i think we r very close....whn am debugging the FM, sy-subrc is 2 after pressing F6.....please check this out....
2009 Feb 06 3:45 PM
>
>sy-subrc is 2 after pressing F6.....please check this out....
EXCEPTIONS
COMMAND_NOT_FOUND = 2
The initial steps might have not been properly execution.. create a command and them call that same command thru FM... sy-subrc 2 is bcoz its not able to find the command you created...
2009 Feb 16 9:54 AM
2011 Dec 05 2:08 PM
Hi,
I am having the same problem please let me know how to solved it.
Regards,
Nee