📄 ch03.htm
字号:
be independent, create a new domain. If your field should be dependent,
reuse an existing SAP domain. Similarly, you should reuse data
elements if your field labels and documentation should change
when SAP changes theirs.
<P>
For example, assume you wish to create a new table to contain
additional vendor information. When you design the table, you
must associate the vendors in your table to those in the SAP table.
<P>
In your table, create a primary key containing the vendor number.
Use the existing data element to create your field. Both tables
are now keyed on the SAP vendor number field using the same data
elements and domains. If SAP changes the data type or length of
their field, yours will change automatically.
<H2><A NAME="NamingConventionsforTablesandTheirComponents"><FONT SIZE=5 COLOR=#FF0000>
Naming Conventions for Tables and Their Components</FONT></A></H2>
<P>
Tables, data elements, and domains created at the customer site
must follow SAP naming conventions for customer objects. These
are outlined in Table 3.1.<BR>
<P>
<CENTER><B>Table 3.1 Naming Conventions for Tables,
Fields, Data Elements, and Domains created by the Customer</B></CENTER><CENTER>
<TABLE BORDERCOLOR=#000000 BORDER=1>
<TR VALIGN=TOP><TD WIDTH=192><CENTER><B>Object Type</B></CENTER></TD><TD WIDTH=192><CENTER><B>Max Name Length</B></CENTER>
</TD><TD WIDTH=192><CENTER><B>Allowed First Character</B></CENTER>
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=192>Table</TD><TD WIDTH=192><CENTER>10</CENTER>
</TD><TD WIDTH=192><CENTER><TT>y</TT>, <TT>z</TT></CENTER></TD>
</TR>
<TR VALIGN=TOP><TD WIDTH=192>Data element</TD><TD WIDTH=192><CENTER>10</CENTER>
</TD><TD WIDTH=192><CENTER><TT>y</TT>, <TT>z</TT></CENTER></TD>
</TR>
<TR VALIGN=TOP><TD WIDTH=192>Domain</TD><TD WIDTH=192><CENTER>10</CENTER>
</TD><TD WIDTH=192><CENTER><TT>y</TT>, <TT>z</TT></CENTER></TD>
</TR>
<TR VALIGN=TOP><TD WIDTH=192>Field</TD><TD WIDTH=192><CENTER>10</CENTER>
</TD><TD WIDTH=192><CENTER>Any character</CENTER></TD></TR>
</TABLE>
</CENTER>
<P>
<P>
All names are a maximum of 10 characters long.
<P>
The names of all tables, domains, and data elements you create
must start with the character <TT>y</TT> or <TT>z</TT>. You cannot
use any other character at the beginning; all others are reserved
by SAP. The R/3 system enforces this convention; you will get
an error message if you try to create an object having a name
that doesn't conform to these conventions.
<P>
Field names can begin with any character. However, certain words
are reserved and cannot be used as field names. The DDIC table
<TT>trese</TT> contains the complete list of reserved words. The
contents of <TT>trese</TT> can be displayed using the Day 2 procedure
in the section titled "Displaying Data in the Table."
<H2><A NAME="CreatingaTransparentTableandItsComponents"><FONT SIZE=5 COLOR=#FF0000>
Creating a Transparent Table and Its Components</FONT></A></H2>
<P>
In the following sections, you will create domains, data elements,
and finally, your first transparent table-it will be a scaled-down
version of the SAP-supplied vendor master table named <TT>lfa1</TT>.
<P>
<CENTER>
<TABLE BORDERCOLOR=#000000 BORDER=1>
<TR VALIGN=TOP><TD WIDTH=600><B>NOTE</B></TD></TR>
<TR VALIGN=TOP><TD WIDTH=600>
<BLOCKQUOTE>
For the purposes of this book, please assume that the R/3 system doesn't already store any vendor master information. Assume that table <TT>lfa1 </TT>does not exist, nor do its data elements or its domains. Therefore, in these exercises we will create them.
</BLOCKQUOTE>
</TD></TR>
</TABLE>
</CENTER>
<P>
<P>
To store vendor master information you will create table -<TT>lfa1</TT>.
It will contain fields for a vendor number, a name, a region code,
and a country code. The field names and technical characteristics
you will use are shown in Table 3.2. An x in the PK column indicates
fields that form the primary key. (The install procedure created
a table named <TT>ztxlfa1</TT> in your R/3 system. It is very
similar to the -<TT>lfa1</TT> table.
Use it as a reference while reading this chapter.)<BR>
<P>
<CENTER><B>Table 3.2 Fields and Their Characteristics
for Table -</B><TT><B>LFA1</B></TT></CENTER><CENTER>
<TABLE BORDERCOLOR=#000000 BORDER=1>
<TR VALIGN=TOP><TD WIDTH=96><CENTER><B>Field Name</B></CENTER></TD><TD WIDTH=96><CENTER><B>PK</B></CENTER>
</TD><TD WIDTH=96><CENTER><B>DE Name</B></CENTER></TD><TD WIDTH=96><CENTER><B>DM Name</B></CENTER>
</TD><TD WIDTH=96><CENTER><B>Data Type</B></CENTER></TD><TD WIDTH=96><CENTER><B>Length</B></CENTER>
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=96><CENTER><TT>mandt</TT></CENTER></TD><TD WIDTH=96><CENTER>x</CENTER>
</TD><TD WIDTH=96><CENTER><TT>mandt</TT></CENTER></TD><TD WIDTH=96><CENTER> </CENTER>
</TD><TD WIDTH=96><CENTER> </CENTER></TD><TD WIDTH=96><CENTER> </CENTER>
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=96><CENTER><TT>lifnr</TT></CENTER></TD><TD WIDTH=96><CENTER>x</CENTER>
</TD><TD WIDTH=96><CENTER>-<TT>lifnr</TT></CENTER>
</TD><TD WIDTH=96><CENTER>-<TT>lifnr</TT></CENTER>
</TD><TD WIDTH=96><CENTER><TT>CHAR</TT></CENTER></TD><TD WIDTH=96><CENTER>10</CENTER>
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=96><CENTER><TT>name1</TT></CENTER></TD><TD WIDTH=96><CENTER> </CENTER>
</TD><TD WIDTH=96><CENTER>-<TT>name1</TT></CENTER>
</TD><TD WIDTH=96><CENTER>-<TT>name</TT></CENTER>
</TD><TD WIDTH=96><CENTER><TT>CHAR</TT></CENTER></TD><TD WIDTH=96><CENTER>35</CENTER>
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=96><CENTER><TT>regio</TT></CENTER></TD><TD WIDTH=96><CENTER> </CENTER>
</TD><TD WIDTH=96><CENTER>-<TT>regio</TT></CENTER>
</TD><TD WIDTH=96><CENTER>-<TT>regio</TT></CENTER>
</TD><TD WIDTH=96><CENTER><TT>CHAR</TT></CENTER></TD><TD WIDTH=96><CENTER>3</CENTER>
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=96><CENTER><TT>land1</TT></CENTER></TD><TD WIDTH=96><CENTER> </CENTER>
</TD><TD WIDTH=96><CENTER>-<TT>land1</TT></CENTER>
</TD><TD WIDTH=96><CENTER>-<TT>land1</TT></CENTER>
</TD><TD WIDTH=96><CENTER><TT>CHAR</TT></CENTER></TD><TD WIDTH=96><CENTER>3</CENTER>
</TD></TR>
</TABLE>
</CENTER>
<P>
These field names and their technical characteristics are based
on actual fields of table <TT>lfa1</TT>. <P>
<CENTER>
<TABLE BORDERCOLOR=#000000 BORDER=1>
<TR VALIGN=TOP><TD WIDTH=600><B>NOTE</B></TD></TR>
<TR VALIGN=TOP><TD WIDTH=600>
<BLOCKQUOTE>
Don't change the names shown above. The exercises later in this book rely on these field names as shown. If you don't use these exact names, subsequent exercises may not work.</BLOCKQUOTE>
</TD></TR>
</TABLE>
</CENTER>
<P>
<P>
Since this table contains application data, it should be client-dependent.
Therefore, the first field must be <TT>mandt</TT>. (See Chapter
1 if you need to review client dependent tables.)
<H3><A NAME="ApproachesforCreatingTables">
Approaches for Creating Tables</A></H3>
<P>
There are two approaches you can use when creating tables:
<UL>
<LI>bottom-up
<LI>top-down
</UL>
<P>
In the bottom-up approach, you create the domains first, then
the data elements, and then the table.
<P>
In the top-down approach, you create the table first, and then
create the data elements and domains as you go along.
<P>
The bottom-up approach is more intuitive for the first-time student,
but it quickly becomes cumbersome. The top-down approach is much
easier to use after you become somewhat familiar with the table
creation process. For these reasons, I will demonstrate both techniques,
starting with bottom-up.
<P>
As you read the following sections you will first learn about
an object-such as a domain-and then you will create one. The objects
you will create are described in Table 3.2.<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>
Remember, when creating any of the objects in this book, use your handle (···) as the first three characters of the object name. (The characters ··· represent your handle. The handle was described in <A HREF="../ch02/ch02.htm" tppabs="http://ebooks.cs.biu.ac.il/0672312174/ch02/ch02.htm" >Chapter 2</A>in the section titled "Introducing Program Naming Conventions.")
</BLOCKQUOTE>
<BLOCKQUOTE>
Do not use <TT>ztx </TT>as the first three characters. If you use <TT>ztx</TT>, it will be very difficult to determine which objects are yours.
</BLOCKQUOTE>
</TD></TR>
</TABLE>
</CENTER>
<P>
<H3><A NAME="ActivationofDDICObjects">
Activation of DDIC Objects</A></H3>
<P>
<IMG SRC="../button/newterm.gif" tppabs="http://ebooks.cs.biu.ac.il/0672312174/button/newterm.gif">
<P>
Before learning about DDIC objects in depth, you should know about
object activation. Activation applies to all dictionary objects.
<P>
After creating a Data Dictionary object, you will <I>activate</I>
it. Activating an object is simple-you will simply press the Activate
button. This changes the status of the object to Active.
<P>
An object must be Active before it can be used. For example, if
you try to use an inactive data element when creating a field,
you will get a message saying that the data element does not exist
or is not active. Your response would be to activate the data
element.
<P>
If you change an object, you must activate it again for the changes
to take effect. If you save the changes but do not activate it,
the objects that refer to it will not "know about" the
change.
<H3><A NAME="DiscoveringDomains">
Discovering Domains</A></H3>
<P>
Before actually creating a domain, I will describe the screen
you will use to create it.
<P>
In Figure 3.7 is the screen you will use to create a domain-the
Dictionary: Maintain Domain screen. On this screen you specify
short text, the data type, a field length, and optionally an output
length. These items are explained in the following sections.
<P>
<A HREF="javascript:popUp('f3-7.gif')"><B>Figure 3.7 : </B><I>The Dictionary: Maintain Domain screen is
used to create a domain</I>.</A>
<H4>Short Text Field</H4>
<P>
The Short Text field will contain a description of the domain.
The end user never sees it; it is only displayed to developers.
You will see it when you bring up a list of domains, such as when
you search for one.<P>
<CENTER>
<TABLE BORDERCOLOR=#000000 BORDER=1>
<TR VALIGN=TOP><TD WIDTH=600><B>NOTE</B></TD></TR>
<TR VALIGN=TOP><TD WIDTH=600>
<BLOCKQUOTE>
Adding the word "domain" to the end of the short text description is redundant and should be avoided. For example, the short text "Generic telephone number domain" should be avoided. Instead, type "Generic telephone number."</BLOCKQUOTE>
</TD></TR>
</TABLE>
</CENTER>
<P>
<P>
In this field, you will describe the type of data the domain is
intended to contain. For example, the description of a reusable
telephone number domain might read "Generic telephone number"
or "General telephone number."
<H4>Data Type Field</H4>
<P>
The Data Type field specifies the representation used internally
by the database to store the value for that field. For some data
types, it also determines the input format validation and output
format of the field. For example, fields of data type <TT>DATS</TT>
(date) and <TT>TIMS</TT> (time) are automatically formatted with
separators when output to a list or displayed onscreen. On input,
they must also be in date or time format, or an error message
is issued to the user.
<P>
The most commonly used data types are listed in Table 3.3.<BR>
<P>
<CENTER><B>Table 3.3 Commonly Used Data Types</B></CENTER><CENTER>
<TABLE BORDERCOLOR=#000000 BORDER=1>
<TR VALIGN=TOP><TD WIDTH=144><CENTER><B>Type</B></CENTER></TD><TD WIDTH=288><CENTER><B>Description</B></CENTER>
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=144><TT>CHAR</TT></TD><TD WIDTH=288>Character strings (maximum 255 characters)
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=144><TT>DEC</TT></TD><TD WIDTH=288>Decimal values (maximum length 31)
</TD></TR>
<TR VALIGN=TOP><TD WIDTH=144><TT>DATS</TT></TD><TD WIDTH=288>Date field</TD>
</TR>
<TR VALIGN=TOP><TD WIDTH=144><TT>TIMS</TT></TD><TD WIDTH=288>Time field</TD>
</TR>
<TR VALIGN=TOP><TD WIDTH=144><TT>INT1</TT>, <TT>INT2</TT>, <TT>INT4</TT>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -