SAP ARCHIVE_READ_OBJECT Function Module for Read a Data Object from an Archive File
ARCHIVE_READ_OBJECT is a standard archive read object SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Read a Data Object from an Archive File processing and below is the pattern details for this FM, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.
See here to view full function module documentation and code listing for archive read object FM, simply by entering the name ARCHIVE_READ_OBJECT into the relevant SAP transaction such as SE37 or SE38.
Function Group: ARCH
Program Name: SAPLARCH
Main Program: SAPLARCH
Appliation area:
Release date: 04-Mar-1999
Mode(Normal, Remote etc): Normal Function Module
Update:
Function ARCHIVE_READ_OBJECT pattern details
In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.CALL FUNCTION 'ARCHIVE_READ_OBJECT'"Read a Data Object from an Archive File.
EXPORTING
OBJECT = "Archiving Object Name
* OBJECT_ID = ' ' "Data Object Key
* USER_EXIT_PROGRAM = ' ' "User Exit, program name
* USER_EXIT_FORM = ' ' "User Exit, Form Routine Name
* ARCHIVKEY = ' ' "Logical Name of the Archive File
* OFFSET = 0 "Data Object Address
* MOVEFLAG = ' ' "Reloading Control Indicator
IMPORTING
ARCHIVE_HANDLE = "Pointer to Open File
COMPR_OBJECT_LENGTH = "Data Object Length (Compressed)
EXCEPTIONS
NO_RECORD_FOUND = 1 NOT_AUTHORIZED = 10 FILE_NOT_FOUND = 11 FILE_IO_ERROR = 2 INTERNAL_ERROR = 3 OPEN_ERROR = 4 CANCELLED_BY_USER = 5 ARCHIVELINK_ERROR = 6 OBJECT_NOT_FOUND = 7 FILENAME_CREATION_FAILURE = 8 FILE_ALREADY_OPEN = 9
IMPORTING Parameters details for ARCHIVE_READ_OBJECT
OBJECT - Archiving Object Name
Data type: ARCH_IDX-OBJECTOptional: No
Call by Reference: No ( called with pass by value option)
OBJECT_ID - Data Object Key
Data type: ARCH_IDX-OBJECT_IDDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
USER_EXIT_PROGRAM - User Exit, program name
Data type: ARCH_GENER-EXIT_PROGDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
USER_EXIT_FORM - User Exit, Form Routine Name
Data type: ARCH_GENER-EXIT_FORMDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
ARCHIVKEY - Logical Name of the Archive File
Data type: ARCH_IDX-ARCHIVEKEYDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
OFFSET - Data Object Address
Data type: ARCH_IDX-OFFSETOptional: Yes
Call by Reference: No ( called with pass by value option)
MOVEFLAG - Reloading Control Indicator
Data type: ARCH_OBJ-INDXFLAGDefault: SPACE
Optional: Yes
Call by Reference: No ( called with pass by value option)
EXPORTING Parameters details for ARCHIVE_READ_OBJECT
ARCHIVE_HANDLE - Pointer to Open File
Data type: SY-TABIXOptional: No
Call by Reference: No ( called with pass by value option)
COMPR_OBJECT_LENGTH - Data Object Length (Compressed)
Data type: IOptional: No
Call by Reference: No ( called with pass by value option)
EXCEPTIONS details
NO_RECORD_FOUND - No Data Object Found
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
NOT_AUTHORIZED - No Authorization
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
FILE_NOT_FOUND - The Archive File Does not Exist
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
FILE_IO_ERROR - Archive File Access Error
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
INTERNAL_ERROR - Internal error
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
OPEN_ERROR - Archive File Open Error
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
CANCELLED_BY_USER - User Has Cancelled the Action
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
ARCHIVELINK_ERROR - ArchiveLink Error Occurred
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
OBJECT_NOT_FOUND - Unknown Object
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
FILENAME_CREATION_FAILURE - File Name Could not Be Created
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
FILE_ALREADY_OPEN - The System Tried Repeatedly to Open a File
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for ARCHIVE_READ_OBJECT Function Module
The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.DATA: | ||||
lv_object | TYPE ARCH_IDX-OBJECT, " | |||
lv_archive_handle | TYPE SY-TABIX, " | |||
lv_no_record_found | TYPE SY, " | |||
lv_not_authorized | TYPE SY, " | |||
lv_file_not_found | TYPE SY, " | |||
lv_object_id | TYPE ARCH_IDX-OBJECT_ID, " SPACE | |||
lv_file_io_error | TYPE ARCH_IDX, " | |||
lv_compr_object_length | TYPE I, " | |||
lv_internal_error | TYPE I, " | |||
lv_user_exit_program | TYPE ARCH_GENER-EXIT_PROG, " SPACE | |||
lv_open_error | TYPE ARCH_GENER, " | |||
lv_user_exit_form | TYPE ARCH_GENER-EXIT_FORM, " SPACE | |||
lv_archivkey | TYPE ARCH_IDX-ARCHIVEKEY, " SPACE | |||
lv_cancelled_by_user | TYPE ARCH_IDX, " | |||
lv_offset | TYPE ARCH_IDX-OFFSET, " 0 | |||
lv_archivelink_error | TYPE ARCH_IDX, " | |||
lv_moveflag | TYPE ARCH_OBJ-INDXFLAG, " SPACE | |||
lv_object_not_found | TYPE ARCH_OBJ, " | |||
lv_filename_creation_failure | TYPE ARCH_OBJ, " | |||
lv_file_already_open | TYPE ARCH_OBJ. " |
  CALL FUNCTION 'ARCHIVE_READ_OBJECT' "Read a Data Object from an Archive File |
EXPORTING | ||
OBJECT | = lv_object | |
OBJECT_ID | = lv_object_id | |
USER_EXIT_PROGRAM | = lv_user_exit_program | |
USER_EXIT_FORM | = lv_user_exit_form | |
ARCHIVKEY | = lv_archivkey | |
OFFSET | = lv_offset | |
MOVEFLAG | = lv_moveflag | |
IMPORTING | ||
ARCHIVE_HANDLE | = lv_archive_handle | |
COMPR_OBJECT_LENGTH | = lv_compr_object_length | |
EXCEPTIONS | ||
NO_RECORD_FOUND = 1 | ||
NOT_AUTHORIZED = 10 | ||
FILE_NOT_FOUND = 11 | ||
FILE_IO_ERROR = 2 | ||
INTERNAL_ERROR = 3 | ||
OPEN_ERROR = 4 | ||
CANCELLED_BY_USER = 5 | ||
ARCHIVELINK_ERROR = 6 | ||
OBJECT_NOT_FOUND = 7 | ||
FILENAME_CREATION_FAILURE = 8 | ||
FILE_ALREADY_OPEN = 9 | ||
. " ARCHIVE_READ_OBJECT |
ABAP code using 7.40 inline data declarations to call FM ARCHIVE_READ_OBJECT
The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8."SELECT single OBJECT FROM ARCH_IDX INTO @DATA(ld_object). | ||||
"SELECT single TABIX FROM SY INTO @DATA(ld_archive_handle). | ||||
"SELECT single OBJECT_ID FROM ARCH_IDX INTO @DATA(ld_object_id). | ||||
DATA(ld_object_id) | = ' '. | |||
"SELECT single EXIT_PROG FROM ARCH_GENER INTO @DATA(ld_user_exit_program). | ||||
DATA(ld_user_exit_program) | = ' '. | |||
"SELECT single EXIT_FORM FROM ARCH_GENER INTO @DATA(ld_user_exit_form). | ||||
DATA(ld_user_exit_form) | = ' '. | |||
"SELECT single ARCHIVEKEY FROM ARCH_IDX INTO @DATA(ld_archivkey). | ||||
DATA(ld_archivkey) | = ' '. | |||
"SELECT single OFFSET FROM ARCH_IDX INTO @DATA(ld_offset). | ||||
"SELECT single INDXFLAG FROM ARCH_OBJ INTO @DATA(ld_moveflag). | ||||
DATA(ld_moveflag) | = ' '. | |||
Search for further information about these or an SAP related objects