📄 ch06.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function popUp(pPage) {
popUpWin = window.open('','popWin','resizable=yes,scrollbars=no,width=525,height=394');
figDoc= popUpWin.document;
zhtm= '<HTML><HEAD><TITLE>' + pPage + '</TITLE>';
zhtm += '</head>';
zhtm += '<BODY bgcolor="#FFFFFF">';
zhtm += '<IMG SRC="' + pPage + '">';
zhtm += '<P><B>' + pPage + '</B>';
zhtm += '</BODY></HTML>';
figDoc.write(zhtm);
figDoc.close();
popUpWin.focus();
}
//-->
</SCRIPT>
<META NAME="GENERATOR" Content="Symantec Visual Page 1.0.1">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=iso-8859-1">
<TITLE>Sams Teach Yourself ABAP/4® in 21 Days -- Day 6- The Data Dictionary, Part 4</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF">
<CENTER>
<H1><IMG SRC="../button/sams.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/sams.gif" BORDER="0"></H1>
</CENTER>
<CENTER>
<P><A HREF="../ch05/ch05.htm" tppabs="http://pbs.mcp.com/ebooks/0672312174/ch05/ch05.htm"><IMG SRC="../button/previous.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/previous.gif" BORDER="0"></A>
<A HREF="../index.htm" tppabs="http://pbs.mcp.com/ebooks/0672312174/index.htm"><IMG SRC="../button/contents.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/contents.gif" BORDER="0"></A>
<A HREF="../ch07/ch07.htm" tppabs="http://pbs.mcp.com/ebooks/0672312174/ch07/ch07.htm"><IMG SRC="../button/next.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/next.gif" BORDER="0"></A>
<H1>Sams Teach Yourself ABAP/4<sup>®</sup> in 21 Days</H1></CENTER>
<HR SIZE=4>
<H1>Day 6</H1>
<H1>The Data Dictionary, Part 4</H1>
<UL>
<LI><A HREF="#ChapterObjectives">
Chapter Objectives</A>
<LI><A HREF="#AutomaticTableHistoryandChangeDocuments">
Automatic Table History and Change Documents</A>
<UL>
<LI><A HREF="#ChangeDocuments">
Change Documents</A>
<LI><A HREF="#KnowingWhentoUseAutomaticTableHistory">
Knowing When to Use Automatic Table History</A>
</UL>
<LI><A HREF="#SummarizingtheTechnicalSettings">
Summarizing the Technical Settings</A>
<LI><A HREF="#RevisedandActiveVersions">
Revised and Active Versions</A>
<UL>
<LI><A HREF="#AdditionalVersions">
Additional Versions</A>
<LI><A HREF="#DiscardingaRevisedVersion">
Discarding a Revised Version</A>
</UL>
<LI><A HREF="#UsingtheDatabaseUtility">
Using the Database Utility</A>
<UL>
<LI><A HREF="#ConsistencyChecks">
Consistency Checks</A>
<LI><A HREF="#DisplayingtheActivationLog">
Displaying the Activation Log</A>
<LI><A HREF="#DisplayingandModifyingStorageParameters">
Displaying and Modifying Storage Parameters</A>
<LI><A HREF="#DroppingandReCreatingTablesintheDatabase">
Dropping and Re-Creating Tables in the Database</A>
</UL>
<LI><A HREF="#Summary">
Summary</A>
<LI><A HREF="#QampA">
Q&A</A>
<LI><A HREF="#Workshop">
Workshop</A>
<UL>
<LI><A HREF="#Quiz">
Quiz</A>
<LI><A HREF="#Exercise">
Exercise 1</A>
</UL></UL>
<HR>
<H2><A NAME="ChapterObjectives"><FONT SIZE=5 COLOR=#FF0000>
Chapter Objectives</FONT></A></H2>
<P>
After you complete this chapter, you should be able to:
<UL>
<LI>Display and compare active and revised versions of DDIC objects
<LI>Use the database utility to perform consistency checks, display
database-specific table information, and drop and re-create tables
in the database
</UL>
<H2><A NAME="AutomaticTableHistoryandChangeDocuments"><FONT SIZE=5 COLOR=#FF0000>
Automatic Table History and Change Documents</FONT></A></H2>
<P>
<IMG SRC="../button/newterm.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/newterm.gif">
<P>
Changes to data within a table can be automatically logged. Such
automatic logging of changes is called <I>automatic table history.</I>
To turn on logging, tickmark the Log Data Changes check box on
the Technical Settings screen (refer to Figure 5.4). If not already
done, the Basis consultant must also specify the client number(s)
for which logging is to take on the system profile parameter <TT>rec/client</TT>.
<P>
<CENTER>
<TABLE BORDERCOLOR=#000000 BORDER=1>
<TR VALIGN=TOP><TD WIDTH=600><B>TIP</B></TD></TR>
<TR VALIGN=TOP><TD WIDTH=600>
<BLOCKQUOTE>
To display the <TT>rec/client </TT>setting in your system, follow the procedure used to display <TT>rdisp/bufreftime </TT>in the section titled "Buffer Synchronization" in Day 5.
</BLOCKQUOTE>
</TD></TR>
</TABLE>
</CENTER>
<P>
<H3><A NAME="ChangeDocuments">
Change Documents</A></H3>
<P>
<IMG SRC="../button/newterm.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/newterm.gif">
<P>
For each insert, update, or delete to a table enabled for automatic
table history, a record is created in table <TT>dbtabprt</TT>.
Each record is called a <I>change document</I>. Each change document
contains the date and time of the change, the userid of the user
who made the change, the transaction code and program name used
to make the change, and the type of change performed. The type
of change will be <TT>INS</TT> if the record was inserted, <TT>UPD</TT>
if the record was updated, or <TT>DEL</TT> if the record was deleted.
<P>
Using transaction code <TT>SCU3</TT> or <TT>OY18</TT> (see Figure
6.1), you can display the change documents and compare them to
current values in the table. There is no difference between these
two transaction codes; they both run the same program.
<P>
<A HREF="javascript:popUp('f6-1.gif')"><B>Figure 6.1 :</B> <I>The Table History transaction displays change
documents from tables with automatic table history enabled</I>.</A>
<P>
From the Table History - Choose Function screen, you can perform
the following functions:
<UL>
<LI>To display the current day's change documents, choose the
Change Docs: Daily Analysis radio button and press the List pushbutton.
A list is displayed containing all changes for the current day.
<LI>To search for change documents by date range or table name,
choose the Change Docs: Selective radio button and press the List
pushbutton. The Analysis of Table Log Database screen is displayed.
Type your search criteria and press the Execute button. A list
of change documents for the specified criterion is displayed.
At the top of the list is a summary of information about the list,
then a Notes section, and then the analysis. For each table, the
fields of it are displayed first (see Figure 6.2) and the change
documents for it follow (see Figure 6.3).
</UL>
<P>
<A HREF="javascript:popUp('f6-2.gif')"><B>Figure 6.2 :</B> <I>The fields of table HPR1007 appear before
the change documents, showing the field names, primary key indicator,
data type, length, column name, and description</I>.</A>
<P>
<A HREF="javascript:popUp('f6-3.gif')"><B>Figure 6.3 :</B> <I>The change documents of table HPR1007 appear
after the field list. The primary key of each record appears first
(in turquoise) followed by the data (in white)</I>.</A>
<UL>
<LI>To display a count of the number of change documents that
exist for a given date range or table range, press the No.of Docs.
(Select) pushbutton.
<LI>To display the list of tables for which automatic history
is kept, choose the Tables With History Management radio button
and press the List pushbutton. This list shows all tables that
have a tickmark in the Log Data Changes check box.
<LI>To display the total number of change documents in table <TT>dbtabprt</TT>,
press the Total No. Documents pushbutton on the Application toolbar.
<LI>To compare field values in change documents with current field
values in a table, choose the History <-> Current radio
button and press the Compare pushbutton. The Table History screen
is displayed. Enter search criteria for change documents and press
the Compare pushbutton. The Table History - Comparison With Current
State screen is displayed. The primary key of each record appears
on the left and differences appear on the right (see Figure 6.4).
</UL>
<P>
<A HREF="javascript:popUp('f6-4.gif')"><B>Figure 6.4 :</B> <I>Here, the data in dbtabprt is compared to
the current contents of each record</I>.</A>
<P>
The primary key appears in turquoise on the left half of the screen.
The right half of the screen is divided into current values and
history values. Gray lines indicate that a difference exists.
To display the meaning of the codes in the left-most column, place
your cursor there and press F1. This report shows that four records
exist in table <TT>EKPA</TT> but no history records exist for
them.
<H3><A NAME="KnowingWhentoUseAutomaticTableHistory">
Knowing When to Use Automatic Table History</A></H3>
<P>
Automatic table history should be used for tables that contain
critical information and when every change must be tracked without
fail, regardless of the update program used. Unfortunately, updates
to the table are slowed down because a record is written to <TT>dbtabprt</TT>
for each record changed. In most cases when table history is needed,
Change Document Objects provides a faster and more efficient alternative,
and so should instead be used. For more information on Change
Document Objects, see the R/3 Library (Menu path Help->R/3
Library, Basis Components, ABAP/4 Development Workbench, Extended
Applications Function Library, Change Documents.)<P>
<CENTER>
<TABLE BORDERCOLOR=#000000 BORDER=1>
<TR VALIGN=TOP><TD WIDTH=600><B>CAUTION</B></TD></TR>
<TR VALIGN=TOP><TD WIDTH=600>
<BLOCKQUOTE>
If the primary key of your table is longer than 86 bytes, or if the remainder of the row is longer than 500 bytes, you cannot use automatic table history. You will get an error when you try to activate the table and changes will not be logged. The reason for these restrictions lies in table <TT>dbtabprt</TT>. The <TT>vkey </TT>field contains the key of the record that was changed and is 86 bytes long. The <TT>vdata </TT>field contains the remainder of the record and is 500 bytes long.
</BLOCKQUOTE>
</TD></TR>
</TABLE>
</CENTER>
<P>
<H2><A NAME="SummarizingtheTechnicalSettings"><FONT SIZE=5 COLOR=#FF0000>
Summarizing the Technical Settings</FONT></A></H2>
<P>
The following summarizes the technical settings for buffering,
table extents, and the automatic logging of updated information:
<UL>
<LI>The data class determines the tablespace in which a table
is created. The database administrator uses tablespaces to organize
and maintain the database. Choosing the proper tablespace makes
database administration easier, increases system performance,
and to some extent even increases system availability because
the database is usually taken offline for reorganizations.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -