05-31-2005 1:36 PM
Hi
Can anyone let me know how to move a file from source directory to target directory in an unix/windows NT system and how to do error handling.
Please let me know the code.There was a thread which desscribed this but am not able to locate it
Thanks
Panda<b></b>
05-31-2005 1:48 PM
05-31-2005 1:57 PM
Hi
Thanks for the reply but am looking at the option in application server
Regards
Panda
05-31-2005 2:06 PM
05-31-2005 2:13 PM
05-31-2005 2:46 PM
Hi Andreas
In the below code what is the significance of
'TAB' FIELD TABM-SYS.
and how will I handle error
DATA: COMMAND(200).
DATA: BEGIN OF TABL OCCURS 0,
LINE(255),
END OF TABL.
command = 'mv /home/prd/file.in /home/prd/processed/file.out'.
CALL 'SYSTEM' ID 'COMMAND' FIELD COMMAND ID 'TAB' FIELD TABM-SYS.
05-31-2005 3:12 PM
Hi Panda,
Sorry, but system call isn't secure
but if you're looking for a secure solution
-> please insert a os-command with ta SM49 and use fm SXPG_COMMAND_EXECUTE
You get errors with the exceptions of that fm
*" NO_PERMISSION
*" COMMAND_NOT_FOUND
*" PARAMETERS_TOO_LONG
*" SECURITY_RISK
*" WRONG_CHECK_CALL_INTERFACE
*" PROGRAM_START_ERROR
*" PROGRAM_TERMINATION_ERROR
*" X_ERROR
*" PARAMETER_EXPECTED
*" TOO_MANY_PARAMETERS
*" ILLEGAL_COMMAND
*" WRONG_ASYNCHRONOUS_PARAMETERS
*" CANT_ENQ_TBTCO_ENTRY
*" JOBCOUNT_GENERATION_ERROR
*"----------------------------------------------------------------------
And Have a look here:
http://help.sap.com/saphelp_47x200/helpdata/EN/c4/3a6047505211d189550000e829fbbd/frameset.htm
Regards Andreas
06-01-2005 7:27 AM
Hi Guys
I tried the following code for Windows NT to move a file from one directory to another but its not working.Can you please suggest what is going wrong
am using operating system command 'MOVE' while creating external command
ws_file_path = 'D:\usr\sap\UKR\DVEBMGS00\work\ENQLOG00.DAT'.
p_tg_dir = 'D:\usr\sap\UKR\DVEBMGS00\data'.
Forming the command
concatenate ws_file_path p_tg_dir into ws_comm_winnt
separated by space.
Call function to execute 'ZMV' command defined in SM69 CALL FUNCTION
call function 'SXPG_COMMAND_EXECUTE'
exporting
commandname = 'ZMV'
additional_parameters = ws_comm_winnt
operatingsystem = sy-opsys
stdout = 'X'
stderr = 'X'
terminationwait = 'X'
importing
status = ws_zstat
exitcode = ws_zexit
tables
exec_protocol = t_move
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.
06-01-2005 7:40 AM
We are using this code
check whether its useful for you.
move:'/cidata/sysid/conversions/'
into dir_from.
move: '/cidata/sysid/archive/'
into dir_to.
when 'COPY'.
operation = 'cp'.
when 'MOVE'.
operation = 'mv'.
when 'REMV'.
operation = 'rm'.
concatenate operation dir_from dir_to
into command separated by space.
call 'SYSTEM' id 'COMMAND' field command.
Regards
Raja
06-01-2005 7:56 AM
Hi Raja
move:'/cidata/sysid/conversions/'
into dir_from.
move: '/cidata/sysid/archive/'
into dir_to.
In the above code where is your filename and I believe you are using Unix system am having the requirement in WindowsNT system
Thanks and Regards
Panda
06-01-2005 8:20 AM
i am sorry i should have had the file name. (copy paste error).
yes its for unix system.
for windows NT if you map it to PC drive then you could simply use cl_gui_frontend_service=>file_copy method.
Regards
Raja
06-01-2005 8:39 AM
Hi,
You can also try to use:
OPEN DATASET 'source.txt'
FILTER 'ren source.txt dest.txt'.
CLOSE DATASET 'source.txt'.
Check documentation for FILTER clause.
Krzys
01-28-2013 11:33 PM
Hi Panda,
In the below link step by step explanation for how to move file another file.
hope this will help you.
Regards,
Santhoshi.