5.3Transport of Native Development Objects
In this section, we discuss how you can transport ABAP programs that use native SAP HANA objects consistently in your system landscape. For this purpose, we’ll discuss SAP HANA transport containers. We won’t outline the advanced Change and Transport System (CTS+), which offers options too.
For our descriptions, we assume that you’re already familiar with the development organization and transport in AS ABAP.
5.3.1Digression: Development Organization and Transport in SAP HANA
To understand the functioning of the SAP HANA transport container better, this section provides some background information on the development organization and transport in SAP HANA.
Development Organization
The development organization in SAP HANA is similar in many ways to AS ABAP. However, it also differs in some essential aspects. As described in Chapter 2, the SAP HANA repository is the central storage of the SAP HANA database development objects.
Within the repository, SAP delivers content below the sap root package. Thus, no customer developments can be created under this package because they might be accidentally overwritten. You can build a parallel package hierarchy for customer developments instead. As a root package, for example, use your domain name.
The system-local package represents a special case. It’s similar to the concept of local packages of AS ABAP. You can use it for development objects that won’t be transported.
Transport
A transport usually takes place in SAP HANA on the basis of a delivery unit. A delivery unit combines packages that are to be transported or delivered together. Conceptually, it broadly corresponds to a software component in the sense of AS ABAP. While you usually work in AS ABAP with the HOME software component, you must always create your own delivery units for customer developments in SAP HANA. To do so, you or an administrator are required to have maintained, in advance, the content_vendor system parameter in the indexserver.ini file using the Administration Console of SAP HANA Studio.
Let's consider the assignment of a delivery unit and the subsequent transport using an AT_CUSTOMER attribute view. When you create the AT_CUSTOMER attribute view, you assign a package to it. You can maintain a delivery unit in the package properties. To do so, use the context menu entry Edit of the package. You see all existing delivery units in the system in the Quick View using the menu entry Delivery Units. You can also create new delivery units there. Figure 5.5 shows the relationships among the development object, package, and delivery unit using the example of the AT_CUSTOMER attribute view (the ZA4H_BOOK_CHAPTER05 delivery unit isn’t part of the examples provided with this book).
Figure 5.5Development Object, Package, and Delivery Unit
In SAP HANA Studio, you have two options to transport development objects, that is, you can export and import them in the target system:
-
Exporting/importing a delivery unit (optionally coupled with CTS+)
For a consistent transport of SAP HANA content (which isn’t closely coupled with an ABAP development) in a production system landscape, we always recommend exporting/importing based on delivery units and CTS+.
Schema Mapping
Schema mapping is a special feature in transporting SAP HANA content. Schema mapping is necessary when the database schemas differ in the source system and target system of a transport. This involves mapping an authoring schema to a physical schema.
You maintain a schema mapping in the Quick View via the menu option Schema Mapping. Before we discuss more precisely when and how the system evaluates the mapping, we need to explain the need for schema mapping using the AT_CUSTOMER attribute view. Let’s consider Figure 5.6 for this purpose.
Figure 5.6Principle of Schema Mapping
Remember that the AT_CUSTOMER attribute view reads customer data from database table SCUSTOM. This table is part of the flight data model of AS ABAP and is located in the development system in the SAPABD database schema (because the system ID of the ABAP system is ABD). As a result, the attribute view refers to SAPABD.SCUSTOM.
Table SAPABD.SCUSTOM doesn’t exist in the quality assurance system or production system. Due to the different system IDs, the database table resides in the SAPABQ schema in the quality assurance system and in the SAPABP schema in the production system.
Schema mapping enables you to map the SAPABD schema to the SAPABQ schema in the quality assurance system and to the SAPABP schema in the production system.
When maintaining schema mapping, you must consider the following:
-
Schema mapping ultimately controls where—that is, in which database schema—an SAP HANA repository development object searches for a database catalog object.
-
If no schema mapping is maintained, the authoring schema and physical schema are identical.
-
You can map multiple authoring schemas to the same physical schema.
-
You cannot assign multiple physical schemas to an authoring schema.
-
The SAP HANA content stores references to database objects with the authoring schema. If this can’t be clearly determined (due to a multiple assignment), the system stores the reference with the physical schema.
[»]Schema Mapping When Installing SAP NetWeaver AS ABAP 7.4
If you install AS ABAP 7.4 on a SAP HANA database, the installation program creates the SAP<SID> ABAP schema. Furthermore, the installation program also creates at least one schema mapping—that is, from the ABAP authoring schema to the SAP<SID> physical schema.
If you’re interested in further information on the development organization and transport in SAP HANA, please refer to the documentation of the SAP HANA database.
5.3.2Using the SAP HANA Transport Container
Let’s now discuss the transport of ABAP programs that use native SAP HANA objects via the SAP HANA transport container. For this purpose, we use Program ZR_A4H_CHAPTER5_LIST_CUSTOMER, which accesses the AT_CUSTOMER attribute view of the SAP HANA repository via the ZEV_A4H_CUSTOMER external view of DDIC. The source text of the program is available in Listing 5.8.
DATA: lt_customer TYPE STANDARD TABLE OF
zpv_a4h_customer,
ls_customer TYPE zpv_a4h_customer.
IF cl_db_sys=>dbsys_type = 'HDB'.
SELECT * FROM zev_a4h_customer
INTO TABLE lt_customer.
ELSE.
SELECT * FROM zpv_a4h_customer
INTO TABLE lt_customer.
ENDIF.
LOOP AT lt_customer INTO ls_customer.
WRITE: / ls_customer-id, ls_customer-name.
ENDLOOP.
Listing 5.8Sample Report to Be Transported
Both Program ZR_A4H_CHAPTER5_LIST_CUSTOMER and the ZEV_A4H_CUSTOMER external view can be transported readily using the change recording and the transport system of AS ABAP (in principle, this occurs automatically). The AT_CUSTOMER attribute view that forms the basis of the external view, however, isn’t subject to the change recording and transport system of the application server. For this reason, it isn’t available in the target system after a transport (unless you take appropriate measures). Thus, a runtime error occurs in the target system when calling the report. The SAP HANA transport container provides relief here.
Basic Functions
The SAP HANA transport container is available in SAP NetWeaver 7.31 as of SP 5 and as of Release 7.4. It can be used if SAP HANA is the primary database.
The SAP HANA transport container allows you to transport development objects created via SAP HANA Studio using the mechanisms of the CTS of the ABAP AS (and without the need for a Java stack, which is required for CTS+).
From a technical perspective, the SAP HANA transport container is a logical transport object that acts as a proxy object for exactly one delivery unit. Figure 5.7 illustrates how the SAP HANA transport container works.
Figure 5.7How the SAP HANA Transport Container Works
You can only create a SAP HANA transport container using the ABAP Development Tools. In the ABAP perspective, for example, choose the menu path, File • New • Other • ABAP • SAP HANA Transport Container. Then enter the name of the delivery unit for which you want to create the transport container. The system automatically derives the name of the transport container (see Figure 5.8; the SAP HANA transport container ZA4H_BOOK_CHAPTER05 isn’t part of the examples provided with this book).
If you want to use a prefix namespace in ABAP, you must assign the desired prefix name to the name of the content_vendor (refer to Section 5.3.1) before creating the transport container. To do so, you can fill database table SNHI_VENDOR_MAPP using the Table View Maintenance dropdown.
If the transport properties of the package that is used—in the example, TEST_A4H_BOOK_CHAPTER05—are maintained accordingly, the system records the creation of the transport container in a transportable change request.
Figure 5.8Creating a Transport Container
When you create a transport container, the system automatically synchronizes the contents of this container (once) with the contents of the delivery unit. This means that all objects of the delivery unit are loaded as a packed file on the ABAP AS and are stored there as a byte string in a database table (i.e., table SNHI_DU_PROXY). Strictly speaking, the content of the delivery unit then appears twice in the SAP HANA database:
-
In the SAP HANA repository
-
Via database table SNHI_DU_PROXY
If, after creating the transport container, you want to synchronize it with the delivery unit—because you’ve made changes to the AT_CUSTOMER attribute view, for example—you must do so manually. Use the Take Snapshot and Save link in this case. You can view the current content of the transport container using the Contents tab (Figure 5.9).
Figure 5.9Synchronization and Content of a Transport Container
The transport from the development system to the quality assurance and production systems takes place via the CTS mechanisms:
-
When exporting (more precisely, during export release preprocessing), the system writes the content of the transport container in the data file to the common transport directory of the systems involved in the transport.
-
When importing (more precisely, in an after-import method), the system reads the transport container’s content from the data file and imports the delivery unit in the SAP HANA database of the target system. Activation of content occurs only if you’ve activated this for the software component of the transport container in table SNHI_DUP_PREWORK (in the target system).
You can reproduce the two steps at any time using the transport log.
Mixed System Landscapes
Mixed system landscapes represent a special case of the ABAP development on SAP HANA. Imagine that as an ABAP developer, you want to optimize a program for SAP HANA and make use of specific SAP HANA database options. At the same time, however, this program should also be able to run on traditional databases, for example, because your employer uses SAP HANA as a database only in certain areas of the company. In this case, a simplified system landscape might look like that shown in Figure 5.10.
Using a case distinction, you can—to stick with the example of Program ZR_A4H_CHAPTER5_LIST_CUSTOMER—call the ZPV_A4H_CUSTOMER projection view once and the ZEV_A4H_CUSTOMER external view once (see Listing 5.8). As a result, you ensure that no errors occur at runtime.
Figure 5.10Mixed System Landscape
The implementation of the transport container ensures that no errors occur during the transport, and the SAP HANA content is only imported if the target system of the import is a SAP HANA-based system.
Recommendations for Using the Transport Container
When using the transport container, you should note some restrictions:
-
When using the transport container, you always transport the complete delivery unit. You can’t transport only the contents of a delivery unit that were changed in a specific time interval.
-
Unlike development objects that are managed in AS ABAP, the system doesn’t automatically record changes to the content of a delivery unit, and the objects of a delivery unit aren’t locked exclusively for a transport request. It’s thus your responsibility to synchronize the transport container with the delivery unit manually.
-
When exporting the development objects from the source system, the transport considers only the active objects.
-
The transport system doesn’t recognize any dependencies between multiple transport containers that are transported simultaneously.
Within the restrictions, the transport container allows you to transport applications consistently that consist partly of ABAP objects and partly of SAP HANA content. We recommend its use if the prerequisites that are described at the start of Section 5.3.2 are fulfilled.
You don’t require the SAP HANA transport container if you use the options described in Chapter 6.