Fonction SAP ARCHIVE_GET_NEXT_STRUCT_SPECIF - Read Next Record from Data Object According to Structure

Paramètre Reférence Type Long. Valeur par déf. Facultatif Description
ARCHIVE_HANDLE SYST-TABIX I 4 Handle to the Open Archive Files
AUTOMATIC_CONVERSION 0 'X' X Automatic Conversion of the Data Record
RECORD_STRUCTURE ARC_BUFFER-RNAME C 30 Structure Name

Paramètre Reférence Type Long. Description
RECORD 0 Data Record
RECORD_CURSOR SYST-TABIX I 4 Pointer to Data Record
RECORD_FLAGS ARC_BUFFER-FLAGS C 8 Flag Bar per Data Record
RECORD_LENGTH ARCH_INT-INT4 I 4 Length of the Data Record in Parameter RECORD

Exception Description
END_OF_LEVEL End of the Hierarchy Level
END_OF_OBJECT No Further Data Record Exists
INTERNAL_ERROR Internal Error
WRONG_ACCESS_TO_ARCHIVE Incorrect Access to the Archive

Functions
This function module is intended to facilitate implementation ofarchive read operations in logical databases. It can also beused in other programs.
Since logical databases are hierarchical structures and every segmentor hierarchy level has its own name, the name of a data record'sstructure indicates its level in the hierarchy.
The PUT events in the logical database program determine the hierarchy.In these events you can use this function module in order to get onlymatching data records. If a data record does not match the selection,the exception END_OF_LEVEL is triggered.
In the PUT event of the highest segment in the hierarchy of the logicaldtabase, the function module ARCHIVE_GET_NEXT_OBJECT, whichprocures the data from the archive file, would be called up in additionto this function module.

  • Example 1

  • Extract from a logical database to read document archives
    TABLES: BKPF, BSEG, BSET, BVOR, BSEC, BSED.
    DATA: HANDLE LIKE SY-TABIX.
    ...
    FORM PUT_BSEG.
    IF HANDLE EQ 0.
    * ...
    ELSE.
    DO.
    CALL FUNCTION 'ARCHIVE_GET_NEXT_STRUCT_SPECIF'
    EXPORTING
    ARCHIVE_HANDLE = HANDLE
    RECORD_STRUCTURE = 'BSEG'
    IMPORTING
    RECORD = BSEG
    EXCEPTIONS
    END_OF_LEVEL = 01
    END_OF_OBJECT = 02
    INTERNAL_ERROR = 03
    WRONG_ACCESS_TO_ARCHIVE = 04.
    IF SY-SUBRC NE 0.
    EXIT.
    ENDIF.
    PUT BSEG.
    ENDDO.
    ENDIF.
    ENDFORM.
    • Example 2

    • A detailed example is provided in the logical database ACS.

      Weitere Hinweise
      You can also use the function module ARCHIVE_GET_NEXT_RECORD inyour logical databases. In this case you have to program the controlbreak logic for the individual hierarchy levels yourself.
      The integrated control break logic of this function module is simple.It checks whether the next data record read sequentially has the samestructure name as the name passed on in the parameterRECORD_STRUCTURE. If the name is different, the exceptionEND_OF_LEVEL is triggered. Otherwise the data record istransferred to the storage area specified by the parameterRECORD.

      Description
      The parameter RECORD_LENGTH provides the length of the datarecord passed on via the parameter RECORD.
      INCLUDE 'ARCHIVE_PARAM_AUTOMATIC_CONV' OBJECT DOKU ID TX
      INCLUDE 'ARCHIVE_PARAM_STRUCTURE' OBJECT DOKU ID TX
      In this case you specify the name of the structure for which you wantto read the next data record. If an alias was used when writing thedata, you must pass this alias.