GeneXus for SAP Systems First Objects

Official Content

Once the Knowledge Base has been created, the next step is to describe the objects of reality using GeneXus objects.

GeneXus objects, such as transaction, procedure, web panel etc, are the building blocks of applications and allow developers to describe application requirements as knowledge representation.

Transaction objects allow developers to describe the entities and associated attributes of the application in a declarative manner using which GeneXus automatically creates database tables in SAP HANA Database. Transaction objects also create responsive web forms (pages) to insert, update and delete record. The default web forms created by transaction objects can be customized.

Illustration: In a travel agency application that shows tourist attractions recommended by the travel agency and the countries and cities in which the agency offers tours, the following entities (actors of reality) will be defined using transaction objects.

  • Clients
  • Tourst attractions
  • Countries
  • Cities

All entities have attributes that provide detailed information about the entity. A customer has attributes: first name, last name, email address and phone number.

For each entity, you will have to create a GeneXus object of transaction type.

To create a new object, select File / New / Object

GeneXusForSAPSystems_NewObject

Once you select the option to create a new object, you can choose the type of object that will be created from the following dialog box.

GeneXusForSAPSystems_NewObjectDialog

Select web in the categories section of the dialog box and select the transaction object type.  Name it “Customer” and click on the ‘Create’ button.

GeneXusForSAPSystems_NewObjectDialog2

Click on the “Create” button ...

The transaction will be created as a new tab in the main window.

GeneXusForSAPSystems_Transaction

All transactions have sections such as Structure, Web Form, Rules, Events, Conditions, Variables, Documentation and Pattern. These sections are highlighted in the image below. You can define the attributes of the transaction in the structure section, which is open by default when a transaction is created.

A customer has attributes such as first name, last name, phone, email and address. In the transaction structure, you have to specify name and data type of each attribute of the transaction.

{
CustomerId*
CustomerName
CustomerLastName
CustomerAddress
CustomerPhone
CustomerEmail
}

GeneXusForSAPSystems_TransactionStructure

Note that the first line is created for us to enter the first attribute...

In every transaction, an attribute or set of attributes must be able to uniquely identify each record. In other words, one cannot enter two customers with the same identifier value. For this reason, a key icon that distinguishes identifier attribute from other attributes is associated with the first line.

Customer’s passport number or ID card numbers could be candidates for identifier roles. Since the application is not required to store passport number or id card number, you can create an attribute called "CustomerId". You can configure the identifier attribute to automatically increment in steps of 1 for every record added to the transaction by setting the auto-number property of the attribute to true.

If you press the “dot” key on the keyboard, GeneXus automatically shows the transaction name as a prefix in the attribute name field.

GeneXusForSAPSystems_TransactionStructureCustomer

You only have to type "Id" after the "Customer" prefix.

GeneXusForSAPSystems_TransactionStructureCustomerType

After entering the name of the attribute, press the Tab key and choose the data type.

GeneXusForSAPSystems_TransactionStructureCustomerType2

Clicking on the arrow displays the data types available in GeneXus. For this attribute, leave the default data type: Numeric of 4 digits (with no decimals).

Press ENTER and start creating the second attribute.

A new line will open.

The second attribute to be entered is ‘CustomerName’.

GeneXusForSAPSystems_TransactionStructureCustomerName

Once again, type “.” and complete the attribute name by typing “Name”.

GeneXusForSAPSystems_TransactionStructureCustomerName2In the data type section for the CustomerName attribute, type ‘Character’.

GeneXusForSAPSystems_TransactionStructureCustomerName3

Note that if you type an opening bracket, the default length is 20 characters; you can leave it unchanged.

Follow the same steps to enter the ‘CustomerLastName’ attribute, which will also be of Character type, length 20.

Now, add the CustomerAddress attribute. In this case, the data type ‘Address’ was automatically assigned. GeneXus realized that you want to create an attribute whose name partially matches the name of the existing data type ‘Address’.

GeneXusForSAPSystems_TransactionStructureCustomerAddress

Continue with ‘CustomerPhone’. GeneXus will automatically assign it the data type ‘Phone’

Lastly, enter the ‘CustomerEmail’ Attribute, which is automatically assigned the Email data type by GeneXus. In particular, the data types Address, Phone and Email are special data types called semantic domains. Semantic domains include features that are specific to an address, a phone number or an email address, respectively.

GeneXusForSAPSystems_TransactionStructureCustomerPhone

Lastly, enter the ‘CustomerEmail’ Attribute, which is automatically assigned the Email data type by GeneXus. In particular, the data types Address, Phone and Email are special data types called semantic domains. Semantic domains include features that are specific to an address, a phone number or an email address, respectively.

GeneXusForSAPSystems_TransactionStructureComplete

Note that an asterisk is being displayed in the Customer transaction tab.

GeneXusForSAPSystems_TransactionDirtyAsterisk

This means that the transaction is being edited. When you save the changes, the asterisk will disappear, and the transaction will be displayed in the KB Explorer window. Click on File/Save or press Ctrl + S to save the transaction.

GeneXusForSAPSystems_TransactionInKBExplorer

Select the “Web Form” section.

GeneXusForSAPSystems_WebForm

For web applications, GeneXus automatically designs responsive Web Forms according to the defined structure. This form will allow users to add, change and delete customers.

Form Preview shows you how the web form will look at runtime according to the screen size. To open the Form Preview window, click on View / Other Tool Windows / Form Preview.

GeneXusForSAPSystems_WebFormPreview

GeneXusForSAPSystems_WebFormPreviewPhone

Note that Form Preview window shows the screen size for the preview in the footer of the window.

GeneXus supports the following screen size catgories.

  1. Large size devices that have width more than 1200px
  2. Medium size devices that have width more than 992 px but less than 1200 px.
  3. Small size devices that have width more than 768 px but less than 992 px.
  4. Extra small size devices that have width less than 768 px

GeneXusForSAPSystems_WebFormPreviewTablet

You can change the size for the preview by enlarging or reducing the size of the Form Preview window.

When you change the screen size, the controls will be adapted to show the data according to that size.

Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.