Key Concepts Refresher

As noted, there are two modeling tools available in SAP HANA. We will now look at both tools and how you can use them to create your SAP HANA information models.

We will start by looking at SAP HANA studio.

SAP HANA Studio

SAP HANA studio is built in a development environment based on Eclipse, an open-source framework by IBM. (For more information about Eclipse, visit http://www.eclipse.org.) This development environment is written in Java, so it only runs on your desktop or laptop.

Eclipse originally started out as a Java development environment, but was later adapted into other programming languages, such as JavaScript, PHP, HTML, Cascading Style Sheets (CSS), Ruby, and many others.

That IBM called the product Eclipse proves that IBM has a good sense of humor. During the time of the Eclipse release, IBM was in competition with Sun over their respective Java Virtual Machines. We all know what happens to the sun during an eclipse!

Figure 5.1 shows an overview screen of SAP HANA studio in an Eclipse environment, with the different work areas indicated.

Figure 5.1   SAP HANA StudioSAP HANA studioscreen

Figure 5.1 SAP HANA Studio

On the top right is an area called perspectives. On the left of the screen is an area in which you can see the different SAP HANA systems you work with, and the components for each system. In the middle is the main working area. On the right-hand side, you’ll see a tab called Quick View, which is specifically used in the modeler perspective.

In this section, we will look at the different working areas of SAP HANA studio, including the SAP HANA studio perspectives, main workspace, system views, two primary consoles (the SQL Console and Administration Console), and the application function modeler (AFM). Finally, we’ll discuss the steps to set up the session client.

Perspectives

The Eclipse environment uses different perspectives to give you different layouts for different development tasks. In SAP HANA studio, there are perspectives for information modeling, administrators, plan visualization, and SAP HANA development. When you select another perspective, it changes the screen layout, menu options, and so on. In Eclipse, you can even create your own perspectives or change the available perspectives to suit your requirements.

To select or change to another perspective, simply click the name of that perspective in the top right-hand side of the SAP HANA studio screen, as shown in Figure 5.1. If you want to select a perspective that is not on that list, click the Icon button to the left side of these names. This will open a menu from which you can select the perspective that you want to use.

To get a better idea of how these perspectives vary in look and available options, Figure 5.2 shows the differences between the modeler and development perspectives.

Figure 5.2   Development vs. Modeler PerspectiveModeler perspectiveDeveloper perspectivePerspectivesmodeler vs. developer

Figure 5.2 Development vs. Modeler Perspective

The left-hand side of Figure 5.2 shows the development perspective. In this perspective, three different tabs appear: Systems, Repositories, and Project Explorer.

When you select the modeler perspective (right-hand side), you only have one tab: Systems. This means that you cannot access the repositories or projects from the modeler perspective.

[+] Tip

In SAP HANA, we prefer the development perspective, even when performing modeling tasks, because it has a lot more features than the modeler perspective.

The only thing that the modeler perspective has that the development perspective does not is the Quick View tab shown on the right-hand side. We will discuss the functionality available in the Quick View tab throughout this book.

Main Workspace

In the middle of Figure 5.1, the main workspace is displayed. In this case, you can see a calculation view with a union. You can see the mapping of the different fields in the union.

When you open table definitions, stored procedures, or different views, or just preview the output of an information model, you will see the results in this main workspace. Each of the SAP HANA objects that you open will be displayed inside its own tab.

Systems View

You can see the systems view on the left side of Figure 5.1. Figure 5.3 provides a more detailed look.

Figure 5.3   Systems View

Figure 5.3 Systems View

All your different SAP HANA systems are shown this area. From SAP HANA studio, you can work with multiple SAP HANA systems—for example, with both a development and production system.

Within each SAP HANA system, you will find different areas shown as folders in the systems view. The following areas are found in the systems view:

In this chapter, we will focus on the Catalog and Content areas.

Catalog Area

The Catalog area houses most of the artifacts for the SAP HANA database. It is divided into schemas. SAP HANA schemas are groupings of tables and other artifacts. The main database objects we find here are tables. Inside SAP HANA, we can also find items such as column views, functions, indexes, procedures, synonyms, and triggers.

If you have an SAP BW on SAP HANA system or an SAP ERP on SAP HANA system, you will find a schema inside the Catalog area of the SAP HANA database that corresponds to the system identity (SID) of the SAP system. For example, if the SID of your SAP BW system is BW1, you will find a schema inside the SAP HANA database called BW1 that contains all the SAP BW system’s tables.

When you open the tree structure—for example, down to the tables—you’ll find a list of all the tables inside that schema. Check the icon in front of each table to determine if it’s a column or a row table. The Icon icon indicates that this table is a row-based table, the Icon icon indicates a column-based table, and the Icon icon indicates a virtual table. In SAP HANA, column-based tables are the preferred table type. They compress much better than row-based tables and do not need indexes.

When you right-click on a table, a context menu appears (sometimes referred to as a right-click menu) for that table. Through that menu, you can look at the table definition, table contents, or open a data preview for that specific table. In the Catalog area, you can also delete tables, import more tables, and export tables.

Let’s look more closely at table definitions and the data preview:

Content Area

The Content area is where you perform all your SAP HANA modeling. This area is divided into packages, which can again be divided into subpackages, up to as many levels as you want. These packages and subpackages are then used to transport your information models from the development system to testing and production systems. (We discuss this in Chapter 12.)

As an example, let’s say you’re working on a project, and you create a main package for your project. In this package, you create three subpackages: one for financial modeling, one for HR modeling, and one for logistics modeling. You will assign your financial modelers to work in the financial subpackage, HR modelers to work in the HR subpackage, and logistics modelers to work in the logistics subpackage. Your project lead will have access to the main package, including the three subpackages. You can then take the main project package and transport all of your project’s models from the development system to the production system with just a few clicks.

Figure 5.8 shows an example of SAP HANA models created inside a subpackage. Here, you can see attribute views, analytic views, and calculation views. This example is from the SHINE package of SAP HANA SPS 09. (The newer versions of SHINE do not have any attribute views and analytic views.) We discussed SHINE in Chapter 2.

Figure 5.8   Content Area

Figure 5.8 Content Area

[»] SHINE Package

When possible, we will use examples from the SHINE package in this book. This package is freely available, and you can easily use it in your own SAP HANA system.

When you right-click on a package or a subpackage, you will see a context menu, as illustrated in Figure 5.9.

Figure 5.9   Context Menu to Create New Modeling ObjectsContentcreate modeling object

Figure 5.9 Context Menu to Create New Modeling Objects

At the top of the menu, click New to display all the SAP HANA model types that you can create. You can create another subpackage, attribute views, analytic views, calculation views, analytic privileges, procedures, and decision tables via this option.

Now that we’ve looked at the available system views, in the next two sections we will discuss the two primary consoles in SAP HANA studio.

SQL Console

As with any other database, you can use SQL statements when working with the SAP HANA database. Figure 5.10 shows the different ways to open the SQL Console: You can either use the context menu of a schema, or click the SQL button in the top menu of the Systems view. This will open the SQL Console in your main work space. You can now enter different SQL statements to perform tasks such as creating tables, inserting data, maintaining data, creating a schema, assigning authorizations, and more.

Figure 5.10   SQL Console

Figure 5.10 SQL Console

Enabling line numbers in your editor is helpful if, for example, you’re troubleshooting and an error message tells you that the error is in line 35. With line numbers enabled, you can see where line 35 is instead of having to count down 35 lines.

To enable this functionality, go to the Window menu at the top of the screen, and then to Preferences. Go to GeneralEditorsText Editors, and then enable Show Line Numbers.

There’s another method to view line numbers, too. Something not everyone knows is that when you right-click on the little gray line to the left of the SQL statements, a menu appears from which you can select Show Line Numbers.

[+] Tip

Pressing Ctrl + Spacebar in SAP HANA studio automatically completes your typing for you. This autocomplete feature saves you time and minimizes typing errors.

We recommend that you only use the SQL Console for one-off SQL statements. If you want to create functions or procedures, instead use the steps we discuss in the Development Perspective section.

We will look at SQL and stored procedures in more detail in Chapter 8.

Administration Console

The Administration Console is used primarily by data administrators (see Figure 5.11). From here, admins can get a good view of all the technical aspects of an SAP HANA system.

As an information modeler, there are two subtabs that might be helpful to you: the Performance tab and the Diagnosis Files tab. These tabs will help you with troubleshooting, which we will look at in more detail in Chapter 10.

Figure 5.11   Administration Console

Figure 5.11 Administration Console

In Figure 5.11, you can see that this SAP HANA system seems to be healthy as everything is shown in green. The bars are only partly filled, which means this system has plenty of spare capacity. You can also see information such as the current status, when the system was started, what version number is installed, what operating system is used, and what is happening with the memory and CPU inside the system. This is all shown on the Overview screen of the Administration Console.

Next, we will look at the developer perspective and how to create your own repository for SAP HANA modeling work.

Development Perspective

We mentioned earlier that we prefer the development perspective, even when modeling in SAP HANA. This perspective has a lot more functionality available than the modeler perspective. In this perspective, you can create repositories as well as projects and SAP HANA development objects that simply are not available in the modeler perspective.

Let’s look at one of these objects—namely, a flowgraph model. Flowgraph models are used in a number of places in SAP HANA. We will quickly go through the steps to build a flowgraph model and then look at where it is used.

Creating a Repository

Before you can create any SAP HANA development objects, you first have to create a repository, also called a repository workspace or a workspace. This is an area in which your objects will be stored. Figure 5.12 illustrates the three steps of creating a repository workspace in SAP HANA studio:

  1. First, select the Repositories tab, and click on the Repository icon Icon. Note that the system shows that no repository has been created yet via the Icon icon.
  2. The Create New Repository Workspace window will open. Here, specify the SAP HANA system, whether this is the default workspace, and the Workspace Root. When you’re done, click Finish.
  3. Once you have created the repository workspace, the system now shows the Icon icon, indicating that a repository exists. You only have to do this once. You can now use the workspace.
Figure 5.12   Creating a New Repository Workspace in SAP HANA Studio

Figure 5.12 Creating a New Repository Workspace in SAP HANA Studio

Creating a Project

Next, you have to create an SAP HANA XS project. You can think of an SAP HANA XS project as a folder in which your development objects will be created. The three steps to create the project are illustrated in Figure 5.13:

  1. Start by right-clicking in the Project Explorer tab, and select NewOther.
  2. In the New window, under the Application Development folder, select XS Project.
  3. In the New XS Project window, enter the Project name, Location, and so on. Upon completion, click Finish.
Figure 5.13   Creating a New ProjectSAP HANA studioXS project in SAP HANA Studio

Figure 5.13 Creating a New Project in SAP HANA Studio

You only have to create the SAP HANA XS project once. You can now create your SAP HANA development objects in this project.

Creating an SAP HANA Development Object

Finally, create the SAP HANA development object (flowgraph model) via the following steps:

  1. In the Project Explorer tab, right-click your project, as shown in Figure 5.14. Select the New menu option from the context menu, and then select Other.
    Figure 5.14   Creating a New SAP HANA Development ObjectDevelopmentobject

    Figure 5.14 Creating a New SAP HANA Development Object

  2. In the next dialog box, choose which type of SAP HANA development object you want to create. There are two main subareas to choose from: An Application Development area, as shown in step two of Figure 5.13, and a Database Development area, as shown in step two of Figure 5.14. For this example, select the Flowgraph Model object type.
  3. As shown in Figure 5.15, the New Flowgraph Model window appears, providing options for naming and selecting the type of flowgraph model that you require. Click Finish after you’ve selected the correct settings.

At this point, SAP HANA studio will place you into the editor for creating and editing the appropriate type of SAP HANA development object you’ve created. For a flowgraph model, you are placed in the SAP HANA AFM. Note that a file with the extension .hdbflowgraph was created (see the top tab of the right-side screen in Figure 5.15). In the AFM graphical editor, you can create several nodes with inputs and outputs. You can, for example, connect a table to the input of a node, and then connect the output to another node.

Figure 5.15   Creating and Editing a New Flowgraph in the AFM

Figure 5.15 Creating and Editing a New Flowgraph in the AFM

There are a few places where we will use the AFM in the course of this text:

Session Client

In SAP systems, we work with the concept of different clients. This use of client does not have the same meaning as the word client used to mean customer or as in client server. In this case, we are talking about an SAP system database being subdivided into different so-called clients. When you log in to an SAP system, it asks not only for your user name and password but also for a client number. You then are logged into the corresponding client. You can only see the data in that client—not everything inside the SAP database. You can think of a client in SAP systems as a “filter” that prevents you from seeing all the data.

Because SAP HANA is used as the database for many different SAP systems, SAP HANA must also allow for this concept of limiting data to a specific client. By setting the session client, you can say what the default client number is for your SAP HANA studio.

There are several ways to set the session client. One option in SAP HANA studio is to go to the Window menu at the top of the screen, and go to Preferences. Figure 5.16 shows you what the Preferences screen looks like. By drilling down into SAP HANA and then Modeler, you will reach a screen called Default Model Parameters where you can set the default client.

Where it now says Session Client on the screen, you just type the client number—for example, 100.

Figure 5.16   Session Client SettingsSession clientsettings in SAP HANA Studio

Figure 5.16 Session Client Settings in SAP HANA Studio

In this section, we looked at the different aspects of SAP HANA studio as a modeling tool. In the next section, we will look at the other tool available in SAP HANA for modeling.

SAP HANA Web-Based Development Workbench

The second main modeling tool for SAP HANA is a web-based development environment. Today, SAP is focusing more on cloud and mobile technologies. Tablets can’t run desktop Java and therefore can’t use SAP HANA studio. In addition, some people don’t like to use desktop Java Virtual Machines due to various security issues.

To address these issues, SAP introduced the SAP HANA web-based development workbench, which runs from inside SAP HANA and only requires the use of a browser.

[+] HTML5 Browser

You have to use an HTML5 browser for the development workbench to work properly. All newer browsers, including all mobile browsers, are acceptable: Just avoid Internet Explorer 8 and earlier.

Based on the current trends at SAP, this modeling environment is getting a lot of attention and development effort. Already, you can do almost everything in this web-based environment that you can currently do in SAP HANA studio.

Figure 5.17 shows how to open the SAP HANA web-based development workbench in your browser. The URL you use looks like http://server:8000/sap/hana/ide/.

Figure 5.17   SAP HANA Web-Based Development WorkbenchSAP HANA web-based development workbench

Figure 5.17 SAP HANA Web-Based Development Workbench

You start with the server’s host name or IP address, a colon, and then a port number. This port number is 8000 plus whatever the instance number is of your specific system. For example, if your system is using instance number 10, then the port number should be 8010. You then type in “/sap/hana/ide/” as a web server path.

You can see a part of this path in Figure 5.8, looking at the subpackages. You will notice that there is an sap subpackage with a hana subpackage underneath. This means you can actually see the code used for this development environment in your SAP HANA system.

Once you have logged on, you will see the main screen (as shown in Figure 5.17), which has four different areas:

Clicking on any of these four blocks will open another tab in your browser and allow you to work in the selected area.

In this chapter, we will look primarily at the Catalog area and the Editor area as security and traces are discussed in Chapter 13.

Catalog Area

In the Catalog area, your browser-based screen will look fairly similar to the same functionality we saw in SAP HANA studio (see Figure 5.18).

Figure 5.18   CatalogCatalogtable preview Area, with Table Preview

Figure 5.18 Catalog Area, with Table Preview

The layout of the screen is similar as well. For example, you will find that you can right-click to access menus with the same options, such as to open the definition of a table, to run a data preview, or to view the content of a table’s data.

Figure 5.18 shows a table and the data contents being previewed. In this case, you will notice something that you can do in the web-based development environment that you cannot do in SAP HANA studio. By clicking on the menu, you have the option of creating a schema. In SAP HANA studio, there is no such menu option. You can only create a schema there using a SQL command.

[+] Maintain Table Data

As of SAP HANA SPS 10, you can maintain table data when you view the table data in the SAP HANA web-based development workbench. You can insert data and update data while you preview the table contents, as illustrated in Figure 5.18. This obviously can be dangerous in a production system: It can be prevented through security settings.

Editor Area

Compare Figure 5.19 to Figure 5.1 at the start of this chapter and you’ll notice that the screen layout and functionality are similar. Both figures present a graphical calculation view with a union mapping.

Figure 5.19   Editor Area

Figure 5.19 Editor Area

However, there is one big difference between SAP HANA studio and the SAP HANA web-based development workbench: In SAP HANA studio, you can graphically create and edit attribute views and analytic views. When you look at the context menu (right-click menu) in Figure 5.19, you will notice that you can only create and edit calculation views graphically in the SAP HANA web-based development workbench.

[+] Tip

Modeling in SAP HANA is geared towards doing everything with graphical calculation views. Attribute views and analytic views are fading quickly and are not even available in the newer SAP HANA web-based development workbench. We will discuss this in more detail in Chapter 6.

When you try to edit existing attribute views and analytic views that you previously created in SAP HANA studio in the SAP HANA web-based development workbench, the workbench only shows them as XML files (see Figure 5.20).

Figure 5.20   Analytic Views Not Shown Graphically in SAP HANA Web-Based Development Workbench

Figure 5.20 Analytic Views Not Shown Graphically in SAP HANA Web-Based Development Workbench

As of SAP HANA SPS 10, the web-based development environment can also use the new Performance Analysis Mode option for graphical calculation views. In this mode, SAP HANA suggests ways that you can improve your model.

Please note that this mode is only available for graphical calculation views. When you select a graphical calculation view, the Icon icon will appear in the menu at the top, as illustrated in Figure 5.19.