Developing Read Programs

Prerequisites

Use

Read programs are used to read both archiving object and archiving class data from archive files.

Procedure

Function Module Call Sequence

  1. Open selected archive files for reading – ARCHIVE_OPEN_FOR_READ

This function module:

      • Initializes the archiving classes contained in these archive files
      • Creates an archive handle for read operations
  1. (Optional): Get structures for initialization data – ARCHIVE_GET_INIT_STRUCTURES

As of SAP Web Application Server 6.10, you use this function module to get the structures of the initialization data you passed in the write program using ARCHIVE_PUT_INIT_DATA.

  1. (Optional) Get initialization data – ARCHIVE_GET_INIT_DATA

As of SAP Web Application Server 6.10, you use this function module to get the initialization data you passed in the write program using ARCHIVE_PUT_INIT_DATA.

The following steps (4 - 7) must be called in a loop for all data objects to be read.

  1. Read next data object from archive files – ARCHIVE_GET_NEXT_OBJECT

You use this function module to read the next data object from the archive files opened.

This function module:

      • Sequentially reads all archived data objects from all opened archive files into ADK’s data container
      • For archiving class data, passes the data to the archiving class

The parameter OBJECT_ID must syntactically be CHAR.

  1. Get archiving object data – ARCHIVE_GET_NEXT_RECORD (or ARCHIVE_GET_TABLE where it makes sense)

Call this function module in a loop within the loop started in step 4 until no more records can be read from ADK’s data container.

In the Unicode context, there are two possibilities for calling this function module:

      • Assign typed field symbols to the reference returned using the new parameter RECORD_REF
        (example: SBOOKR)
      • Assign untyped field symbols
        (example: SBOOKR_2)

In the Unicode context, it is no longer possible to use the CHAR record buffer variable for generic reading of records for structures containing non-character-like fields.

  1. Read archiving class data – <CLASS>_ARCHIVE_GET_TABLE or archiving class-specific read function module(s)

For each archiving class, there may be one or two (or possibly more) read function modules. After reading the function module documentation, determine which one you want to use:

    • <CLASS>_ARCHIVE_GET_TABLE: This function module follows a naming convention. You call this function module to read the archiving class data passed by ARCHIVE_GET_NEXT_OBJECT.
    • Class-specific read function module: There is no naming convention for class-specific read function modules. Therefore, you must determine the name of the function module used by the archiving class in your archiving object.

To determine the name of the class-specific read function module,

      1. Find the function group for the archiving class using Displaying Archiving Classes Used in an Archiving Object
      2. Go to transaction SE80 (Object Navigator)
      3. Choose Repository Browser
      4. From the pull-down menu, select Function Group and choose Display
      5. Under Function Modules, look for the read function module; for help, use the relevant function module documentation.

End of loop

  1. (Optional) Pass statistics to ADK – ARCHIVE_GIVE_STATISTICS

You use this function module to pass statistics to ADK after the data is read from the archive files.

  1. (Optional) Get statistics from ADK – ARCHIVE_GET_STATISTICS

You use this function module to get the statistics ADK collected. You can then use these statistics to create your own specialized log.

  1. (Optional) Output standard statistics log – ARCHIVE_WRITE_STATISTICS

You use this function module to output the standard archiving statistics log with the relevant information for the read program. This function module must be called directly before ARCHIVE_CLOSE_FILE.

  1. End read – ARCHIVE_CLOSE_FILE

This function module:

    • Closes the archive files
    • Releases the included archiving classes
    • Discards the current archive handle

Result

When you finish developing your read program, enter it for your archiving object in transaction AOBJ.

Example

Sample programs SBOOKR, SBOOKR_2, SBOOK_3, and SFLIGHTR (for use of archiving classes)