2011 Aug 01 6:23 PM
Hi Friends,
I have requirement from my client.
When we execute a high volume campaign a folder is generated with a CSV file in it.
This folder is created in "
server\MARKETING_HV\" directory.
For each execution of a campiagn the folder is created in "
server\MARKETING_HV\" directory now we want the folder to be deleted after the execution of the campign.
I debugged the backgroung job of campaign execution and found the below FM that creates the folder
CALL FUNCTION 'SXPG_CALL_SYSTEM'
EXPORTING
commandname = lv_commandname
additional_parameters = lv_additional_parameters
trace = lv_trace
IMPORTING
status = lv_status
exitcode = lv_exitcode
TABLES
exec_protocol = lt_exec_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
OTHERS = 12.
here in "lv_commandname" parameter a command 'MKTMKDIR" is passed to create the folder.
There is also a table which stores the SAP external commands "SXPGCOTABE" but i am not getting any command for deletion of the folders.
Can any body tell me do we have any function module through which i can delete a folder from the application server or do we have any other way how i can achieve this.?
Thanks Regards,
Sandipan Jena
2011 Aug 03 10:23 AM
2011 Aug 01 7:03 PM
Hello sandipan jena ,
You can make sure of the FTP_CONNECT,, FTP_COMMAND and FTP_DISCONNECT function modules and can use the os level commands to the Function call "FTP_COMMAND.
Or you can use the same fm that you found in your debugging and use the command "RMTMKDIR".
Hope this answers your question.
Thanks,
Greetson
2011 Aug 02 7:23 AM
Hi Greetson,
I tried using the command ( RMTMKDIR ) but it is giving a message as "COMMAND_NOT_FOUND".
Thanks Regards,
Sandipan Jena
2011 Aug 02 8:11 AM
Hi,
you can create FM for deleting files on server.
*" IMPORTING
*" VALUE(IV_FILENAME) TYPE STRING
" ...
DATA:
ls_mess TYPE string.
" ...
TRY.
OPEN DATASET IV_FILENAME FOR OUTPUT IN BINARY MODE MESSAGE ls_mess.
DELETE DATASET IV_FILENAME.
CATCH CX_SY_FILE_OPEN. " The file is already open
" ...
CATCH CX_SY_FILE_AUTHORITY. " No authorization to access a file
" ...
CATCH CX_SY_TOO_MANY_FILES. " The maximum number of open files has been exceeded
" ...
" ...
" ...
CATCH CX_ROOT. " Unknown error
" ...
ENDTRY.
2011 Aug 02 8:17 AM
Hi,
I dont have a FM for you, but you can ask your middle ware to delete that folder if not required.
If you just do not require the data inside a file in the folder. just try writing nothing into the same file. This will delete all the existing data in the files or replaces.
Thanks,
Venkatesh.
2011 Aug 03 10:23 AM