Procedure documentationCreating Data Types Locate this document in the navigation structure

Prerequisites

You have:

Procedure

Creating Simple Types
  1. In the Dictionary Explorer, select the Dictionary DC where you want to store your simple type.

  2. In the context menu, choose   New   Simple Type  .

  3. Fill in the required data:

    1. Simple Type Name

    2. Simple Type Package

  4. Choose Finish.

    The SAP NetWeaver Developer Studio creates the new simple type and opens it for editing.

  5. Choose the Definition tab of the simple type editor and specify the new simple type details:

    1. Select a built-in type from the Built-In Type dropdown list, or specify an existing simple type in the Base Type field.

      If the chosen data type refers to an existing simple type, this is a type derivation. For more information, refer to Type Derivation below.

    2. Fill in the Length Constraints and Value Constraints fields.

      Depending on the chosen data type, different constraint fields are available for input.

      As length constraints, you can specify either a maximum and minimum length, or a fixed length.

      Value Constraints Input Fields

      Field Name

      Value Range

      Minimum Inclusive

      >=

      Maximum Inclusive

      <=

      Minimum Exclusive

      >

      Maximum Exclusive

      <

  6. To specify a list of allowed values for the new simple type, choose the Enumeration tab.

    • To add a new value, choose New.

    • To edit an existing value, select the value and choose Edit.

    • To change the enumeration values order, select a value and choose Up or Down.

    Note Note

    To generate a class available at runtime, select the Generate a class representation of the enumeration checkbox. The name of the class corresponds to the name of the simple type. The first letter is written in uppercase. An object of this class represents exactly one value of the enumeration. Using objects of this class ensures type security and subsequent use of the enumeration values.

    End of the note.
  7. Choose the Representation tab and complete the following fields:

    External Representation Fields

    Fields

    Description

    Field Label

    Used as a label for Simple Type Web Dynpro fields.

    Column Label

    Used as a header for Web Dynpro table columns making use of the Simple Type.

    Quick Info

    Used for Web Dynpro fields that are typed with the Simple Type. They are displayed whenever the mouse is moved over the field.

    Format

    The Format property is used to influence the screen-appearance of data and allows you to define rules for data input. You can specify a format template that is used at runtime to check data for correct input and to prepare it for output on screen. This template is effective for the built-in types STRING, DATE, TIME, and TIMESTAMP as well as for all numerical built-in types such as INTEGER, FLOAT, and DECIMAL. In case of DATE, TIME and TIMESTAMP all possible format templates are described in the JavaDoc of the java class java.text.DateFormat and java.text.SimpleDateFormat. The JavaDoc of java.text.DateFormat describes the locale-independent formats that you can choose to define input and output rules. The JavaDoc of java.text.SimpleDateFormat describes how to create templates for special locales.

    For numerical built-in types, the JavaDoc of the class java.text.DecimalFormat tells you how to produce format templates for input and output.

    For a Simple Type with built-in type STRING and numerical string input and output, you can apply the predefined format ALPHA. This format adds leading zeros when parsing external to internal data and remove them for screen output. To use this format, enter ALPHA in the format field.

    External Length

    Determines the visible length of a Web Dynpro field that is of a Simple Type. The visible length includes formatting characters (for example, separator or minus sign).

    Translatable

    The Translatable property is applicable in configuration models in Web Dynpro projects. If the simple type of an attribute in a configuration model is marked as translatable, the attribute values are language-dependent, that is, a different value is stored for each language. The language in which the simple type is generated depends on the language support that you choose when creating the Java Dictionary project itself.

    Caution Caution

    This flag is used by SAP delivered types only. Do not set it for non-SAP types or as a modification to SAP types.

    End of the caution.

    Read Only

    Determines whether a Web Dynpro field that is of a Simple Type is editable or read-only.

    Uppercase

    Indicates whether a Web Dynpro field that is of a Simple Type is displayed in upper case or not.

    Note Note

    The external representation options depend on the built-in type that you use. Some options may not be applicable to all built-in types.

    End of the note.
  8. Choose the Database tab.

    • To specify a database default value, enter that value in the DB Default field.

    • To specify if the type in the database should always have an initial value, choose Not Null.

    More information: Initial Values

  9. To save your data, choose Save.

Deriving Types from Existing Simple Types (Type Derivation)

Type derivation means that the simple type inherits the properties of the base type.

  1. To derive a simple type from a type that already exists, choose the Definition tab.

  2. Choose Browse and select the simple type you wish to derive from in the Simple Type Selection dialog box, then choose OK.

    Note Note

    You can also enter the type manually. When you manually enter the Base Type in the field, you must enter the fully qualified name of the type.

    End of the note.
  3. Enter a short text in the Description field.

    All other fields of the inherited properties are not editable. The properties of the base type are adopted into the runtime object of the simple type when the latter is generated.

  4. (Optional) Specify whether you want to override or restore type derivation for individual properties.

    • To override a property with a new value, choose the pushbutton next to the corresponding field and change the value. Next time you generate the simple type, the new value of this property is adopted into the runtime object.

    • To restore the type derivation for this property, choose the pushbutton, then choose OK.

  5. To allow only certain values for the simple type, choose Enumeration.

    The derived simple type inherits its input help from the base type. You can limit the value set of the derived simple type by deleting enumeration values. Thus, you interrupt the enumeration inheritance. However, if you delete all the enumeration values, the enumeration inheritance (and thus also the maximum value set allowed) is restored.

    • Select the enumeration values you want to delete and choose Delete selected Enumeration Elements in the context menu.

More Information

Open SQL Data Types