Ansicht
Dokumentation

SAPMSGTB - Database Utilities for DD Tables

SAPMSGTB - Database Utilities for DD Tables

General Material Data   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.
SAP E-Book

Description

The data base utility forms the interface between the Data Dictionary and the relational data base underlying the SAP System.
The data base utility could previously only be used with tables. From Release 2.1, however, all relevant Data Dictionary objects are supported in the data base utility.

These are:

  • tables
  • table indexes
  • views
  • matchcodes
  • pools/clusters

Basic functions

The basic functions implemented for the various objects are described here:

Table

  • Create
    A transparent table conforming to the active Data Dictionary definition is created in the data base. The table is given a unique index to the key fields and all secondary indexes.
  • Delete
    Transparent table: The table and all its indexes are deleted from
    the data base.
    Pooled/cluster table: The table data is deleted from the physical
    pooled/cluster table.
  • Convert
    The data is unloaded from the table, the revised table structure is activated, and the data is reloaded.

    When changes are made to the structure, conversion is generally necessary if data is taken from tables with the old structure.

    The following stuctural changes are supported:
    - Add, delete fields, change field sequence
    - Change field formats
    - Change primary key, except in the case of check tables
    - Change table category (TRANSP, POOL, CLUSTER),
    - Change physical pool/cluster, provided no data exists.

    The table is activated during conversion.
    After conversion, the relevant table screen (if one exists) must be either adapted manually or else deleted and recreated.

    In certain instances data conversion may not be necessary, for example when fields are added to a table or matchcode. In such cases, the table definition in the data base is modified and the table is activated in the Data Dictionary.
  • Delete, Create again
    This function is divided into the following steps:
    1. Delete the table.
    2. Activate the revised table structure.
    3. Create the table.
    The data is not kept !

Table index (only secondary index)

  • Create
    Create a secondary index for a transparent table in the data base.
  • Delete
    Delete a secondary index for a transparent table from the data base.
  • Delete, Create again
    Delete and recreate a secondary index and activate the index in the Data Dictionary.

View

  • Create
    Create a view in the data base.
  • Delete
    Delete a view from the data base.
  • Delete, create again
    Delete and recreate a data base view so that it conforms to the definition in the Data Dictionary. The view is activated in the process.

Matchcode

  • Create
    Matchcode object: Create the matchcode pool in the data base.
    Matchcode ID: Set up the matchcode ID for a matchcode object for
    all clients.
  • Delete
    Matchcode object: Delete the matchcode pool from the data base.
    Matchcode ID: Delete the entries for a matchcode ID from
    the matchcode pool for all clients.

Matchcode structures already containing data cannot be changed.

As the matchcode data is constructed from the data of the referenced tables, it does not require conversion.

Pool/Cluster

  • Create
    Create the (physical) pool/cluster structure in the data base.
  • Delete
    Delete the (physical) pool/cluster structure from the data base.

Pool/cluster structures containing data cannot be changed.

Processing method

The basic functions (create, delete, delete and create again, convert) can be carried out either online or in batch mode.

In order to relieve the online system and to avoid certain lock situations occurring in the data base during the day, we recommend that you make data base changes at night.
In addition, loss of data may occur when writing tables during conversion.

Processing method 'Online' should, therefore, be chosen with
care.
A program containing the desired data base changes is generated. This program is executed immediately.
The log of data base changes is output in list form.

You should normally select processing type 'Batch' which generates an entry with the corresponding function in table "TBATG".
The entry can be checked by selecting Overview → Batch requests.
The entries collected in table "TBATG" are processed in batch mode (usually overnight).
Batch conversions that terminated abnormally are indicated in the batch request overview by an 'E' in the last column ("error").
The batch program writes messages to a log file. You can display these day logs with the function 'Log display'.

If you select processing type 'Generate program', the program is generated, but not executed.
This option is available for tables, pools/clusters and matchcode objects. The generated program can be modified later. This could be useful when a table is converted and a field has been renamed, for example.

The program name is made up of '{' (phase 1) and/or '}' (phase 2) plus table name. The second phase is only generated if conversion is necessary.

If a restart log exists for a data base operation that has been carried out (see below), you can find out by looking at the point where the program terminated (last step carried out).
The object is then locked (see below).
Restarting allows you to resume the data base operation. If it does not make sense to restart or if it is not possible, the object can be unlocked (see below).

Lock mechanism

Lock table "TGTB"

A lock mechanism has been implemented that prevents a new data base operation from being triggered before an existing operation has been successfully concluded.
When processing starts, the data base utility inserts a lock entry for the object to be processed into a lock table (restart table "TGTB"), marks the steps to be carried out, and removes the lock entry once processing has been completed.
If processing terminates abnormally, the object remains locked for the data base utility (not a temporary lock).
A lock entry is written even when only the program is generated.
The function 'Unlock' (Info → Restart log → Unlock) allows you to remove a lock on a table. Once this has been done, a new data base operation can be triggered.
However, if this termination occurs at a time at which data exists only temporarily, you should choose the function 'Restart' (Info → Restart log → Restart), since in this case unlocking could lead to loss of data.
On restarting, the lock entry for the table is evaluated and processing is continued after the last completed step.
Restarting is currently only possible online.

Restart log (for interpreting lock entries)

The complete table conversion process is listed below. In certain cases, some of the steps may not be necessary.

  1. 'Unload table' (model program phase 1)
  • Step 9 delete temporary table ( QCM )

    • Step 1 create temporary table copy ( QCM
    )

    • Step 2 copy table records

    • Step 3 delete current data base table or data

    • Step 4 generate table in the Data Dictionary

    1. 'reload table' (model program phase 2)
    • Step 5 create new table

    • Step 6 create new primary index

    • Step 7 reload data backup

    • Step 8 ALTER TABLE

    Additional functions

    This functions can be executed only in online mode.

    Definition comparison

    This function allows you to establish differences between definitions of individual objects in the Data Dictionary and that in the data base or, in the case of logical objects (pooled/cluster tables), that of the run-time objects.

    • Table
    • Transparent table:
      Compares the last version of the table definition stored in the

    • Data Dictionary (revised or active version) with the current

    • definition in the data base.

    • (Logical) pooled or cluster table:
      Compares the last version of the table definition stored in the Data Dictionary (revised or active version) with the current nametab

    • definition.

    • Table index (secondary indexes only)
      Compares the last version of the table definition stored in the Data Dictionary (revised or active version) with the current definition in the data base.
    • Pool/cluster (physical)
      Compares the last version of the table definition stored in the Data Dictionary (revised or active version) with the current definition in the data base.
    • Matchcode
      Compares the last version of the table definition stored in the Data Dictionary (revised or active version) with the current table definition in the data base.
      This function can only be used for matchcode objects (not for matchcode IDs).
    • View
      Compares the last version of the table definition stored in the Data Dictionary (revised or active version) with the current definition in the data base.
      Both the structure and the selection conditions are compared.

    Check existence

    A check is carried out to see whether the relevant object is in the
    data base. This function can be used for all objects with the
    exception of the matchcode IDs.

    Data base parameters (storage parameters)

    Data base parameters for tables, matchcode objects, and physical pools/clusters can be given user-specific settings.

    The source indicates the origin of the parameters:

    • USR: user-specific settings
      These parameters can be maintained by the user.
    • DBS: storage parameters, as used by the data base
      (only when the object is in the data base)
    • DEF: standard setting, applies if no technical attributes have
      been maintained for the table.
    • CMP: Parameters calculated from technical attributes 'table
      category' and 'table type'.
      The 'use flag' determines the parameters to be used the next time the table is created (with 'Create', 'Delete', 'Create again' or 'Convert') in the data base. If no source is specified, the sequence DBS, CMP or DEF applies (depending which source exists).
      When you save the storage parameters, the use flag (if set) and the entered storage parameters (USR source, if specified) are also saved.

    When you select 'Use immediately', storage parameters indicated by the 'use flag' are activated immediately in the data base, provided this is possible without prior conversion.
    Some data bases do not allow you to use all parameters immediately without conversion. ORACLE allows you to change the maximum extent and the size of the next extent immediately. However, the tablespace, for example, cannot be changed without recreating the table.

    Requirements

    To use data base utilities, you require system authorization for administration.

    Output

    Example






    ABAP Short Reference   Vendor Master (General Section)  
    This documentation is copyright by SAP AG.

    Length: 13422 Date: 20240601 Time: 195240     sap01-206 ( 140 ms )