on 10-09-2007 8:25 PM
Hi All,
I'm looking to copy files from one R3 directory to another. For example, I want to copy files from /com/out to /com/tmp, but I want to ensure that the files remain in /com/out.
I'm not an avid ABAP'er, but I just wanted to know if there's a way to do this.
Will reward with full points - Thanks,
John
Hi,
Please use FM ARCHIVFILE_SERVER_TO_SERVER or PFL_COPY_OS_FILE.
Regards,
Ferry Lianto
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All,
I feel that i will get answer here, i tried past 30 days i never found correct answer
I have a file with document no& revision in external server which is not in SAP.
I have created command line in MS-dos(os command) to get the file to SAP server.
Now the problem is how i can call this external command in SAP ABAP program because i want to get every time based on document no & revision of the document and trigger external command get the pdf from external server and print locally.
here question how to call external command in SM69 i tried but it is not working....and another question is how to pass variable in command line (external command ) by ABAP program i am getting document no & revision in SAP based on this i want to get pdf from external server.
Please help to do this in ABAP.. If you have any Sample program please provide me.
Thanks,
Harikiran
Edited by: harikiran mitnala on Nov 16, 2009 11:43 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
One year lataer...
Try the following if you are still interested and not running the program in batch mode:
CALL METHOD cl_gui_frontend_services=>file_copy
EXPORTING
SOURCE =
destination =
overwrite = SPACE
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
wrong_parameter = 3
disk_full = 4
access_denied = 5
file_not_found = 6
destination_exists = 7
unknown_error = 8
path_not_found = 9
disk_write_protect = 10
drive_not_ready = 11
not_supported_by_gui = 12
others = 13
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
this can be done easily by script at OS level rather than in ABAP, that would be the easier solution. Check with your BASIS guy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As hinted at above, I'd set up a logical command using SM69 (as "copy" would be different in Windows vs Unix), e.g. Y_FILE_COPY, and then use something like the code below.
Jonathan
data:
l_result(255) type c,
l_status like extcmdexex-status,
l_parm like sxpgcolist-parameters,
lt_prot like btcxpm occurs 10 with header line.
concatenate i_filename i_target_directory into l_parm
separated by space.
call function 'SXPG_COMMAND_EXECUTE'
exporting
commandname = 'Y_FILE_COPY'
additional_parameters = l_parm
trace = ' '
importing
status = l_status
tables
exec_protocol = lt_prot
exceptions
command_not_found = 01
no_permission = 02
parameters_too_long = 03
parameter_expected = 04
program_start_error = 05
program_termination_error = 06
security_risk = 07
too_many_parameters = 08
wrong_check_call_interface = 09
x_error = 10
others = 11.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Give this a try:
REPORT ztest .
DATA: BEGIN OF itab OCCURS 0,
field(256),
END OF itab.
DATA: dsn_o(100) VALUE '/com/out',
dsn_n(100) VALUE '/com/tmp'.
OPEN DATASET dsn_o FOR INPUT IN BINARY MODE.
DO.
READ DATASET dsn_o INTO itab-field.
IF sy-subrc = 0.
APPEND itab.
ELSE.
EXIT.
ENDIF.
ENDDO.
OPEN DATASET dsn_n FOR OUTPUT IN BINARY MODE.
LOOP AT itab.
TRANSFER itab-field TO dsn_n.
ENDLOOP.
CLOSE DATASET dsn_n.
Rob
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Like this:
REPORT ztest .
DATA: BEGIN OF itab OCCURS 0,
field(256),
END OF itab.
DATA: dsn_o(100) VALUE '/com/out/file1.txt', "<========
dsn_n(100) VALUE '/com/tmp/file1.txt'. "<========
OPEN DATASET dsn_o FOR INPUT IN BINARY MODE.
DO.
READ DATASET dsn_o INTO itab-field.
IF sy-subrc = 0.
APPEND itab.
ELSE.
EXIT.
ENDIF.
ENDDO.
OPEN DATASET dsn_n FOR OUTPUT IN BINARY MODE.
LOOP AT itab.
TRANSFER itab-field TO dsn_n.
ENDLOOP.
CLOSE DATASET dsn_n.
Rob
Use SM69 or SXDB.
Regards
Aneesh.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
check the Tcodes
CG3Y and
CG3Z
for transferring files from application to presentation and viceversa
also see the fiels in AL11 tcode
we can take the files to an harddisk/external drive and can transfer into another system also.
Regards
Anji
Message was edited by:
Anji Reddy Vangala
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.