2007 Jul 26 8:41 AM
Hi
Can anybody of you please let me know how to archive a file from one directory to other in the application server?
I dont want to read one file into an internal table and then loop on that to create a new file.
Looking for some FM or command that would do this in one shot.
Any clue is very appreciated
Best Regards
Chinmou
Hi
Can anybody of you please let me know how to archive a file from one directory to other in the application server?
I dont want to read one file into an internal table and then loop on that to create a new file.
Looking for some FM or command that would do this in one shot.
Any clue is very appreciated
Best Regards
Chinmou
2007 Jul 26 8:50 AM
Hi Chinmou,
You can just ask your basis to move the file for you. It will be the easiest way.
Regards,
Atish
2007 Jul 26 8:52 AM
My friend there is no such one program which will do archive or one function module which will do as you wanted .
Basicall for archiveing the data into file it requesite 4 basic function modules as .
code] "ARCHIVE_OPEN_FOR_WRITE'
"ARCHIVE_NEW_OBJECT'
"ARCHIVE_GET_STRUCTURES'
"ARCHIVE_SAVE_OBJECT[/code]
so based up on the archive obect it will have own write program which will use above 4 function modules and collects the table data from the basic archiveing obecjt from the AOBJ tcode archive object structure then creates struture for that data and then write's it .
so below is the logic .
CALL FUNCTION 'ARCHIVE_OPEN_FOR_WRITE'
EXPORTING
call_delete_job_in_test_mode = 'X'
create_archive_file = 'X'
object = v_arch_obj
comments = 'ILM test FILE'
* DO_NOT_DELETE_DATA = ' '
* OUTPUT_SEL_SCREEN_WHEN_DIALOG = 'X'
* OUTPUT_SEL_SCREEN_WHEN_BATCH = ' '
IMPORTING
archive_handle = v_handle
* EXCEPTIONS
* INTERNAL_ERROR = 1
* OBJECT_NOT_FOUND = 2
* OPEN_ERROR = 3
* NOT_AUTHORIZED = 4
* OTHERS = 5
.
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 function module should always be called when a new data object is
*to be prepared for writing to an archive.
CALL FUNCTION 'ARCHIVE_NEW_OBJECT'
EXPORTING
archive_handle = v_handle
* OBJECT_ID = ' '
* EXCEPTIONS
* INTERNAL_ERROR = 1
* WRONG_ACCESS_TO_ARCHIVE = 2
* OTHERS = 3
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
** get the structures for the archiving object
*** loop through that
CALL FUNCTION 'ARCHIVE_GET_STRUCTURES'
EXPORTING
archive_handle = v_handle
TABLES
record_structures = it_structures
* EXCEPTIONS
* WRONG_ACCESS_TO_ARCHIVE = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
i_stru-PARLIST[] = i_par_list[].
* writing data object into the archive file
CALL FUNCTION 'ARCHIVE_SAVE_OBJECT'
EXPORTING
archive_handle = v_handle
* IMPORTING
* OBJECT_OFFSET =
* ARCHIVE_NAME =
* EXCEPTIONS
* FILE_IO_ERROR = 1
* INTERNAL_ERROR = 2
* OPEN_ERROR = 3
* TERMINATION_REQUESTED = 4
* WRONG_ACCESS_TO_ARCHIVE = 5
* OTHERS = 6
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.reward points if it is usefull ...
Girish
2007 Jul 26 8:59 AM
Hello,
I havn't used them myself, but there are methods in the '<b>CL_GUI_FRONTEND_SERVICES</b>' class to do what you require
see the methods '<b>FILE_COPY</b>' and then '<b>FILE_DELETE</b>'
that should enable you to move the file
2007 Jul 26 9:19 AM
Hi Chinmoy,
Please try with ZFTP transaction.
Here you will get the application server files and u can copy as well.try pasting the samething in the different location.
Although I am not sure about the solution.
Thansk
Yuvaraj
| User | Count |
|---|---|
| 6 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |