⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ch06.htm

📁 这个是sap开发语言abap的教育文档
💻 HTM
📖 第 1 页 / 共 3 页
字号:
it. Instead, when the program's runtime object is executed, it
makes a call to the nametab to determine the table's structure
at runtime. This enables you to change a table (or structure)
without having to regenerate all the ABAP/4 programs that use
it. They dynamically determine the table characteristics at runtime
by calling the nametab.
<P>
Although you do not have to regenerate all programs every time
a change is made to a table, certain changes (such as renaming
or deleting a field) will require you to make changes to the ABAP/4
code. In these cases, you will need to find all programs that
use it.
<P>
<IMG SRC="../button/screencam.gif" tppabs="http://pbs.mcp.com/ebooks/0672312174/button/screencam.gif">
<P>
Start the ScreenCam &quot;How to Perform a Where-Used List on
a Table&quot; now.
<P>
To find all programs that use a given table:
<OL>
<LI>Begin at the Dictionary: Initial Screen.
<LI>Enter the table name in the Object Name field.
<LI>Press the Where-Used List button on the Application toolbar.
A Where-Used List dialog box appears.
<LI>Choose the Programs radio button.
<LI>Press the Continue button. The Table xxxxx in Programs screen
is displayed. A list of all programs using the table appears.
<LI>Double-click on a program name to display all lines of code
in which the table is used.
<LI>Double-click on a line to display the code starting from that
line.
</OL>
<H4>Checking the Consistency of the Nametab</H4>
<P>
The nametab obtains its characteristics from the data elements
and domains that make up the table. It is possible for the definition
of the nametab to be out of sync with the data elements and domains.
For example, when you activate a change to a domain, the tables
containing it must also be reactivated to pick up those changes.
Although this happens automatically, in certain situations a reactivation
can fail because of a database restriction or because the table
contains data and must be converted. This situation can be detected
by performing a consistency check on the runtime object.
<P>
To check for consistency between the nametab and the Data Dictionary
objects, from within the database utility choose the menu path
Extras-&gt;Runtime Object-&gt;Check. The runtime object is compared
to the DDIC source objects. The Object xxxxx: Check Active Runtime
Object screen will be displayed, and a message at the top of the
list will indicate whether the database object is consistent.
Figures 6.9 and 6.10 show an example of an inconsistency in the
nametab for table <TT>ztxlfa1</TT>.
<P>
<A HREF="javascript:popUp('f6-9.gif')"><B>Figure 6.9 :</B> <I>In this screen, a consistency check indicates
an error message that the record length, key length, and table
alignment are inconsistent</I>.</A>
<P>
<A HREF="javascript:popUp('f6-10.gif')"><B>Figure 6.10:</B> <I>Scrolling down in the list shows the fields
of the nametab and the reason for the inconsistency</I>.</A>
<P>
If a domain is changed and the table reactivation fails, an inconsistency
can exist between the nametab and the domain. 
<P>
In the case of Figure 6.10, the check found that the data type
of field <TT>lifnr</TT> is <TT>char 10</TT> in the nametab and
<TT>int4</TT> in the domain.
<P>
ABAP/4 programs only use the nametab. Therefore, they will not
know about inconsistencies, and thus are unaffected by them in
the Development system. Transporting the DDIC objects before correcting
inconsistencies can cause problems during import to Q/A or production,
or even cause ABAP/4 programs in these environments to produce
incorrect results. The reason lies in the fact that the changes
have not affected the ABAP/4 programs, and thus have not yet been
tested.
<H3><A NAME="DisplayingtheActivationLog">
Displaying the Activation Log</A></H3>
<P>
From within the database utility, you can display the activation
log by pressing the Object Log button on the Application toolbar.
This log is only generated if the activation causes SQL to be
generated. (In some cases, a table change can be activated without
affecting the database, for example, a change to the short text.)
The log contains the sequence of steps performed and all SQL statements
sent to the database during the last activation (see Figures 6.11
and 6.12).
<P>
<A HREF="javascript:popUp('f6-11.gif')"><B>Figure 6.11:</B> <I>The activation log displays the sequence
of steps performed during activation and the SQL that was generated.
This log shows that during the activation, the table was dropped
in the data-base and re-created</I>.</A>
<P>
<A HREF="javascript:popUp('f6-12.gif')"><B>Figure 6.12:</B> <I>This is the remainder of the activation
log shown in Figure 6.11</I>.</A>
<P>
To display detail information describing any message in the log,
position your cursor on the message and press the F1 key.
<H3><A NAME="DisplayingandModifyingStorageParameters">
Displaying and Modifying Storage Parameters</A></H3>
<P>
Pressing the Storage Parameters button from within the database
utility (refer to Figure 6.1) displays the DB Utility: Transparent
Tables - Database Parameters screen. Figure 6.13 shows how this
screen looks when an Oracle database is installed. This screen
is primarily for use by the DBA to alter the storage parameters
from within R/3 after a table has been activated. It is presented
here for the sake of completeness.
<P>
<A HREF="javascript:popUp('f6-13.gif')"><B>Figure 6.13:</B> <I>Database-specific parameters are shown
on the DB Utility: Transparent Tables - Database Parameters screen.
This screen shows that storage parameters for table ztxlfa1 have
been altered after activation because the DBS and CMP lines do
not match</I>.</A>
<P>
Database-specific information about the table's storage parameters
is displayed here. The <TT>Src</TT> column indicates the source
of the values. <TT>DBS</TT> means these values are the actual
values in the database. <TT>CMP</TT> means these values are computed
from the size category and data class. The <TT>USR</TT> line enables
you to enter values for <TT>NextE</TT>, <TT>MaxE</TT>, <TT>Pf</TT>,
and <TT>Pu</TT> and apply them immediately by pressing the Apply
Parameters <TT>NextE</TT>, <TT>MaxE</TT>, <TT>Pf</TT>, and <TT>Pu
Immediately</TT> pushbutton. Most of the time, the <TT>DBS</TT>
and <TT>CMP</TT> lines will be the same, unless the storage parameters
for the database table were altered manually after the table was
activated.
<P>
The <TT>InitExt</TT> and <TT>NextExt</TT> columns contain the
sizes (in blocks) of the initial and next extents. The <TT>MinE</TT>
and <TT>MaxE</TT> columns contain the minimum and maximum number
of extents allowed. The tablespace name is next, followed by the
<TT>FG</TT> and <TT>Fr</TT> columns, which contain the number
of freelist groups and the number of freelists in a group. (These
two columns are only used if Oracle is being used in parallel
processing mode.) The <TT>Pf</TT> and <TT>Pu</TT> columns contain
the percentage of free space and percentage of space used in the
data blocks. For more information on any column, position your
cursor on it and press F1.
<P>
Although the only parameters that can be changed are <TT>NextExt</TT>,
<TT>MaxE</TT>, <TT>Pf</TT>, and <TT>Pu</TT>, you must completely
fill the line before pressing the Apply pushbutton. For example,
to change the size of the next extent to 64 and to set the maximum
number of extents to 4, first select the <TT>USR</TT> radio button.
Then type <B>64</B> in the <TT>NextExt</TT> column, type <B>4</B>
in the <TT>MaxE</TT> column, copy the rest of the values from
the <TT>DBS</TT> line, and then press the Apply pushbutton.
<P>
Your changes are immediately applied in the database when you
press the Apply pushbutton. To view the results, press the Back
button to return to the ABAP/4 Dictionary: Utility for Database
Tables screen, and then press the Storage Parameters button on
the Application toolbar. The line having <TT>DBS</TT> in the <TT>Src</TT>
column will contain the updated values.
<H3><A NAME="DroppingandReCreatingTablesintheDatabase">
Dropping and Re-Creating Tables in the Database</A></H3>
<P>
The fastest way to delete the data from a table is to &quot;drop&quot;
it and then re-create it. To drop a table, from within the database
utility press the Delete Database Table pushbutton. A dialog box
will be displayed to confirm your request. The table and its contents
will be deleted from the database. To create it again, press the
Create Database Table pushbutton. The table will be re-created
using the Active version of the table. You can use the database
utility to do this instead of writing an ABAP/4 program to delete
all rows.<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>
Dropping a table causes all data within it to be permanently lost. It is a good idea to make a backup copy of the table before you delete it. If you copy the table manually, remember to copy both the table definition and the data.</BLOCKQUOTE>

</TD></TR>
</TABLE>
</CENTER>
<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>
If the table has more than one extent, dropping and re-creating a table is a fast and easy way to reorganize it. You will need to save the data to another table temporarily before dropping it, and then copy it back.</BLOCKQUOTE>

</TD></TR>
</TABLE>
</CENTER>
<P>
<H2><A NAME="Summary"><FONT SIZE=5 COLOR=#FF0000>
Summary</FONT></A></H2>
<UL>
<LI>Changes to critical data can be automatically logged in change
documents. For non-critical data, change document objects should
be used instead.
<LI>A Revised version of a table is created when you modify without
activating it. Only the Active version of an object can be used.
<LI>Using the database utility, you can examine the nametab and
compare its consistency to the Data Dictionary and to the database.
<LI>The database utility also enables you to view the activation
log for a table, the storage parameters, and to drop and re-create
a table in the database.
</UL>
<H2><A NAME="QampA"><FONT SIZE=5 COLOR=#FF0000>
Q&amp;A</FONT></A></H2>

<TABLE>
<TR VALIGN=TOP><TD WIDTH=48><CENTER><B>Q</B></CENTER></TD><TD><B>Where would a DBA go to alter the storage parameter of an activated table from within the SAP R/3 system?</B>
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=48><CENTER><B>A</B></CENTER></TD><TD>Go to the database utility and press the Storage parameters pushbutton.
</TD></TR>
</TABLE>
<H2><A NAME="Workshop"><FONT SIZE=5 COLOR=#FF0000>
Workshop</FONT></A></H2>
<P>
The Workshop provides two ways for you to affirm what you've learned
in this chapter. The Quiz section poses questions to help you
solidify your understanding of the material covered and the Exercise
section provides you with experience in using what you have learned.
You can find answers to the quiz questions and exercises in Appendix
B, &quot;Answers to Quiz Questions and Exercises.&quot;
<H3><A NAME="Quiz">
Quiz</A></H3>
<OL>
<LI>Is it possible that the definition of the table and the data
elements and domains can be out of sync?
</OL>
<H3><A NAME="Exercise">
Exercise 1</A></H3>
<OL>
<LI>What is the fastest way to delete the data from a table?
</OL>
<P>
<CENTER>
<HR SIZE=4>

<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> 

<P>&#169; <A HREF="../copy.htm" tppabs="http://pbs.mcp.com/ebooks/0672312174/copy.htm">Copyright</A>, Macmillan Computer Publishing. All rights reserved.
</CENTER>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -