SAP Business ByDesign – Data Types

SAP Business ByDesign

In our previous article, we seen the basic concept of Business object. Here we are going to discuss about how to create your own business object in SAP Cloud Application Studio and deferent type of data types in it.
sap byd datatypes

sap byd datatypes

sap byd datatypes

 

How to create Business object?

  1. Login into SKD
  2. Choose the “Solution tab” from “My Solution” window.
  3. In Solution Explorer, right click on solution and click Add -> New Item. Now you can see Add new item screen.sap byd datatypes
  4. Enter the Business object name and click Add.                                                                                                                          sap byd datatypes

 

Data Types

sap byd datatypes

Each element of a business object must be assigned a data type. To homogenize the use of data types, SAP defines consolidated global data types (GDTs) that represent business-related content in conformance with widely used Web and business standards. All business objects and service interfaces share this same pool of GDTs. You can access the data types that are available via the Repository Explorer Data Types.

[pullquote]    SAP data types are located in the namespace: AP.Common.GDT [/pullquote]

The studio uses the following data types:

Basic Data Type

The basic data type does not contain any elements.

[table id=6 /]

Structured Data Types

There are two different structured data types. The first structured data type consists of content and one or several attributes.

[table id=7 /]

The second structured data type consists of content and technical attributes. These are hidden in the studio so that only the content is visible.

[table id=8 /]

Aggregated Data Type

The aggregated data type consists of several basic or structured data types. It does not support labels, tooltips, or default values. A typical example of an aggregated data type is Price.

[table id=9 /]

Identifier

You use the ID data type to identify a business object or business concept.

 element : ID;

The ID data type has up to 60 characters, is not structured and does not contain the Content element. The data
type supports, upper case conversion and alpha conversion. Alpha conversion fills purely numeric user
input like 4711 with leading zeros to allow better sorting in character fields.

String

Instead of a “string” data type, you use the data types Name, Description and Text, which are technically strings.
You use Name as the short text for a business object, Description as the long text, and Text for additional notes.
For rapid prototyping, you can use language-independent Name, Description, and Text to avoid language
handling, which costs extra effort in coding and on the user interface.

  element : LANGUAGEINDEPENDENT_SHORT_Name;
  element : LANGUAGEINDEPENDENT_LONG_Description;
  element : LANGUAGEINDEPENDENT_EXTENDED_Text;

The length of the string can be one of the following:

  1.  SHORT = 10 characters
  2.  MEDIUM = 40 characters
  3.  LONG = 80 characters
  4. EXTENDED = 255 characters
Boolean

You use the Indicator data type to identify a Boolean element.

 element : Indicator;
Date and Time

You use the following data types to identify dates and times:

 element : Date;
 element : Time;
Example:
 element : Date = "2012–04-24";
 element : Time = "16:35:14";
Number

You use the following data types to declare numbers, amounts, quantities, and measures:

  element : NumberValue;
  element : Amount;
  element : Quantity;
  element : Measure;
  1. Use the NumberValue data type for integers.
  2. Use the Amount data type for money. This is a structured data type that consists of a number and a currency code (for example: 25 EUR).
  3. Use the Quantity data type for all other quantities (pieces, length, weight, and so on). This is a structured
    data type that consists of a number and a code for the measurement unit (for example: 25 KGM represents
    25 kilograms).
  4. Use the Measure data type for measures (pieces, length, weight, and so on). This is a structured data type
    that consists of a number and a code for the measurement unit (for example: 25 MTR represents 25 meters).
Percent and Ratio

You use the following data types to declare percent and ratio values:

  element : Percent;
  element : Ratio;
Code Lists

A code list is a field with a set of predefined values. SAP provides a large number of code lists as data types that you can use. The data type name ends with the word “Code” to identify it as a code list.
Some common code lists are:

  element : PriorityCode;
  element : ReleaseStatusCode;
  element : ApprovalStatusCode;

You should use an SAP code list where possible. If no appropriate SAP code list is available, you can define your own code list data type with your own code list in the studio.

There are two ways to create code lists:

  1. Static code lists.
  2. Configurable code lists.

Most SAP code lists are context-independent. Some of the code lists, however, are context-dependent, that is, the code values differ depending on the context (for example, country).

E-mail Address and Web Address

You use the following data types to declare e-mail and Web addresses:

 
 element : EmailURI;
 element : WebURI;
Example:
 element : EmailURI = {content = "foobar@sap.com"};
 element : WebURI = "http://www.sap.com";

 

Look Up the Representation Term of a Data Type

Procedure
  1. In the studio, select View Other Windows Repository Explorer.
  2. In the Repository Explorer, select Data Types.
  3. In the Search data types window, search for the data type you want to use.
  4. The data type details window opens.
  5. Under Overview, you find the representation of the data type.

    sap byd datatypes

We just seen the basic concept of the Data types. If you want to add any valuable points in this article, please leave your comment and don’t forget to subscribe.