| # To create a data model This topic describes the procedure to create a data model. Important! The sections below describe the sessions that you must use to complete the procedure. However, they do not describe all details of these sessions. For detailed session information, refer to the Web Help. Procedure aim LN uses a database system to store the data required by the application. Data is stored in tables in a relational database management system (RDBMS). The data dictionary describes the data model of the data required in the application. You use Development Tools to define the data dictionary and create: Domains Table Definitions, including fields, labels, foreign key relationships and indices Tables to store data, for one or more companies, based on the table definitions You can use the Entity Relationship Diagrams (tgerm1500m000) session in the Enterprise Modeler to create a graphic design of the relational data model structure. The diagram shows a (multilevel) structure that consists of entity types and entity type relationships. For details, refer to the Web Help. Note The LN data dictionary is an active data dictionary. This means that sessions that use a table will discover the fields, domains, relationships, indices and other information about a table when the table is used at runtime, not at compile time. This feature allows you to change data dictionary items without recompiling code. Procedure result and prerequisites Result A data model for an LN application. Prerequisites To create a data model you need: A development package VRC in which you can create the domains and table definitions. Developer authorization for this VRC. Procedure summary The following list shows the procedure steps and the corresponding sessions: Create domains - Domains (ttadv4500m000) Create table definitions, including fields, labels, foreign key relationships and indices - Table Definitions (ttadv4520m000) Convert the domains and table definitions to the runtime data dictionary - Convert to Runtime Data Dictionary (ttadv5215m000) Create tables to store data - Create Tables (ttaad4230m000) Procedure details Step 1. Create domains To create a domain: Start the Domains (ttadv4500m000) session. Add a row. Enter the data type, length, format and field validation rules for the domain in the Domains (ttadv4100m000) details session. Perform this step only if the data type is Enumerated or Set: In the Domains (ttadv4500m000) overview session, select the domain and on the appropriate menu, click Enum/Set Data. The Enum/Set Constants (ttadv4501m000) session starts. Enter the values for the constants, names and descriptions. Note: The constant description should be no longer than the defined length of the domain. If a description is longer than the domain length, you can increase the domain length. Save the new data and close the sessions. Step 2. Create table definitions To create a table definition: Start the Table Definitions (ttadv4520m000) session. Click New to start the Table Definitions (ttadv4120s000) details session. Enter the basic table information, such as the table code and description. Save the changes and return to the overview session.. Define the table fields: Open the new table. The Table Definitions (ttadv4520m100) session will open. This session is a multi-main table session showing the Table Fields, Indices and Program Scripts / Libraries for the table. In the Table Fields tab, click New Table Field. The Table Fields (ttadv4122s000) details session starts. Enter the table field information. Specify, among other things, a field code, a domain, a label, and (optionally) a reference to another table. For details, refer to the session's online help. When finished, save the changes and return to the Table Definitions (ttadv4520m100) multi-main table session. Define one or more indices: In the Indices tab, click New Index. The Table Indices (ttadv4121s000) session starts. Add a row. Enter the index information, such as the index number, description and the index parts (table fields). Save the new data and close the sessions. Points of attention:
Labels | As you enter table fields, labels will be created for the table field descriptions. You can create a new labels, or use existing labels. Using existing labels provides an easy method to adapt your companies terminology and aid translation activities. After labels are created, you must compile the labels so that users can use the labels as they execute the system. You should compile labels after you create enumerate domains, tables, sessions and forms, reports, and other components. To compile labels, use the Compile Labels (ttadv1243m000) session.
Reference tables | When you specify the fields for a table, you can define references to other tables. For this reason, it is helpful to create tables, that will be referred to by other tables, first.
Combined fields | Table fields can refer to a primary key of another table. In this way, the references are built into the data dictionary. To define a reference to a table whose primary key contains more than one field, you must use combined fields. Combined fields require that you define the combined field in the reference table and in the referring table. Combined fields are only used in defining tables; actual fields are not created within the database. To create a combined field: Create a new table field and, in the field properties, select the Combined Field attribute. Click Child Fields to start the Child Fields by Combined Field (ttadv4523m000) session. Enter the table fields that make up the combined field. Use the combined field as the first index of the reference table. In the field properties of the combined field in the referring table, you can now define a reference to the reference table. Example: A purchase order line for an item can have more than one arrival at the warehouse. For this reason, the table design requires that an arrival table is a child of the purchase order line table. The primary key of the purchase order line table can be viewed as order number and position number. The arrivals table must have a field that can refer to order number and position number. Therefore, a combined field is used. The combined field “cmba” is created in both tables, with the order number and position number as the child fields. In the field properties of the "cmba" field in the arrivals table, a reference to the purchase order line table is defined.
Step 3. Convert the domains and table definitions to the runtime data dictionary The table definitions are maintained in the application data dictionary. You must make the new domains and table definitions available to the runtime environment. This process is called Convert to Runtime. A convert to runtime is performed for tables, domains and sessions based on the package combination. The process will search the Package VRCs of the packages in the package combination and create the table and domain runtime files in the runtime data dictionary directory on the application server. This directory is established when you create the package combination. To convert to runtime: Start the Convert to Runtime Data Dictionary (ttadv5215m000) session. Select the Domains and Tables check boxes. Specify the appropriate ranges of package combinations, packages and tables. Click Convert. Step 4. Create tables to store data Tables store data. In order to store data, the table definition is used to create a table in the underlying database for a specific company number. In most companies, a person designated as the system administrator or database administrator will create tables. Before you create tables, the following pre-requisites must be in place: The data dictionary must be converted to runtime for the package combination. Your LN user id must use the package combination of the company. A company must be created with your package combination. The database administration and storage requirements must be setup to create tables in the appropriate database and storage area. To create tables: Start the Create Tables (ttaad4230m000) session. Optionally, you can start this session from the appropriate menu in the Table Definitions session. Specify the appropriate ranges of companies, packages and tables. Click Create. Related topics Domains Table definitions Data dictionaries To reconfigure tables |