Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Archiving file in application server

Former Member
0 Likes
1,753

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

4 REPLIES 4
Read only

Former Member
0 Likes
801

Hi Chinmou,

You can just ask your basis to move the file for you. It will be the easiest way.

Regards,

Atish

Read only

Former Member
0 Likes
801

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

Read only

former_member189059
Active Contributor
0 Likes
801

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

Read only

Former Member
0 Likes
801

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