Accessing and Editing ABAP Repository Objects

Objectives

After completing this lesson, you will be able to:
  • Compare different options to adjust the data structure in an AS ABAP based SAP system
  • List tools of the ABAP Workbench that support the software development cycle
  • Explain the significance of the ABAP Dictionary
  • Use ABAP development tools to access and edit ABAP repository objects

Changing and Adjusting the Data Structure

You can change the SAP software based on AS ABAP by using customizing functions, or you can create and edit objects in the ABAP repository.

Note

This lesson assumes that you run your AS ABAP based SAP system as an on-premise system. For SAP systems running in the cloud (such as SAP S/4HANA Cloud), the options for changing the SAP standard may be different. Concerning the extension options for SAP S/4HANA Cloud (and in particular SAP S/4HANA Cloud, extended edition), see SAP Note 2920697Extensibility Guide for SAP S/4HANA Cloud, extended edition and its attached PDF.

The SAP software is standard business software, which you adjust according to the enterprise-specific needs at the implementation. Such adaptations are called customizing and include client-specific settings and cross-client settings. In SAP systems based on AS ABAP, there is a special implementation guide: The SAP Reference IMG (call via transaction SPRO).

Hint

After an upgrade of the SAP system, you may need to adjust customizing to a minor extent.

Changes to repository objects are not required to use an SAP system. But you can create or change individual objects as needed. Changes or enhancements to the repository are possible in various ways, as shown in the following interaction:

Modification – Enhancement – Customer Development

Software Development Cycle

You can plan and carry out the entire ABAP software development cycle in the SAP system.

Software Development Cycle

SAP's ABAP Workbench is a programming environment for developing enterprise-wide business solutions. SAP supports the entire software development cycle. There are tools for modeling, for ABAP programming, for defining data structures and table structures and for developing graphical user interfaces. An extensive array of tools for testing, optimizing, and maintaining software, as well as supporting development in large teams, are also available.

In the concept phase of a project, you enter the results of your analysis into the SAP data model. Then the models are converted into tables and programs. You can develop individual program components like the user interface, ABAP code, and so on, in any time-related sequence by using the development tools especially intended for the respective function. You only need to combine the different elements into a single application when you want to run it. Program tests in the test system and the transport to the production system conclude the development cycle.

Complementary to the tools, SAP delivers a library of predefined business and general software components, which you can just use in your own developments.

The ABAP Workbench and its Tools

In AS ABAP, you can use the ABAP Workbench to write application programs. The ABAP Workbench is a graphical programming environment, where you can use programming tools, push buttons, the context menu (secondary mouse button) or the forward navigation (double-click object names).

The individual Workbench tools combine to form an integrated system. If, for example, you are working with program objects in the ABAP Editor, then the editor recognizes objects created using other tools. When you double-click an object, the system calls the relevant tool to edit an object. Then you can edit this object.

When working in the ABAP Workbench, you distinguish between development objects and packages:

  • Development objects are objects that you can edit using the ABAP Workbench, such as programs, transactions, or screens.

  • A package contains logically related development objects, for example, all objects for a specific application.

The Object Navigator (transaction SE80) enables you to organize development processes in the integrated environment of the ABAP Workbench. This means you can access repository objects and the related development tools in a simple and uniform manner.

The ABAP Dictionary

The ABAP Dictionary is a central component of the ABAP Workbench. It contains both business and technical definitions and descriptions of SAP data. The ABAP runtime environment (such as the ABAP Interpreter and Dynpro Processor) frequently accesses the information in the ABAP Dictionary.

The ABAP Dictionary enables all the data definitions used in the SAP system to be centrally described and managed. It is an integrated and active dictionary, which means the ABAP Dictionary is completely integrated in the SAP development and runtime environment. The dictionary information is created only once, but is available throughout the SAP system at all times. The ABAP Dictionary (transaction SE11) automatically provides all the information that has been created or modified, ensuring that runtime objects are up-to-date and data is consistent and secure.

The tasks of the ABAP Dictionary can be subdivided into:

  • Database object definitions (tables, views, and so on)

  • Type definitions (structures, data elements, domains and so on)

  • Services definitions (search helps, lock objects, and so on)

Tables, views, lock objects, and domains are important object types in the ABAP Dictionary:

  • The definition of tables in the ABAP Dictionary is database-independent. This table definition then serves as the basis for the creation of a table with the same structure in the underlying database.

  • Views are logical views of one or more tables. View structures are defined in the ABAP Dictionary. This structure is then the basis for the creation of a view on the database.

  • Lock objects coordinate attempts by several users to access the same dataset. Function modules are generated from the lock object definition in the ABAP Dictionary; you can then use these function modules in application programs.

  • You can use domains to group fields that have similar technical or business purposes. A domain defines the value range for all table fields and structure components that refer to that domain.

The documentation (F1 help) and the input help (also called F4 help) for a field on an input screen are provided by the ABAP Dictionary as well.

ABAP Dictionary

The integration of the ABAP Dictionary in the program flow is based on the interpretative method of the AS ABAP runtime environment. Instead of working with the original of an ABAP program, the ABAP processor interprets a runtime object generated from the program text before its first execution. If time stamp comparison reveals that runtime objects are no longer consistent with the current status of the ABAP Dictionary, they are automatically generated again before execution.

The ABAP Dictionary also allows you to manage database tables relevant to the SAP system within the SAP system. Detailed, product-typical database knowledge is therefore not needed in application development. During activation of the table definition, the ABAP Dictionary transfers the definitions to the database level.

The interaction between the ABAP Dictionary on one side and the development environment or runtime environment on the other is shown in the figure "ABAP Dictionary".

Hint

Every database system also contains a dictionary. This dictionary is not the dictionary referred to in this lesson.

Table Definition and the Two-Level Domain Concept

The definition of tables in the ABAP Dictionary is database-independent. When you activate the table definition in the ABAP Dictionary, the table definition in the ABAP Dictionary is converted into a definition for the database used and a physical table definition is created in the database based on the table definition stored in the ABAP Dictionary.

A table is a two-dimensional matrix consisting of columns (fields) and rows (entries). It has a name and attributes, such as the table type. Every table in the ABAP Dictionary has a primary key. This is a combination of columns that uniquely identifies every row in the table. Primary key values therefore cannot exist twice in a table.

A field (that is, a column in a table) has a name and attributes, for example, it may be a primary key field. A field is not an independent object; it depends on the table and can only be maintained within that table. You can use domains and data elements to define table fields:

  • The domain is used to technically define the table field. The field length, field type, output properties, and possible value restrictions are defined in the domain using fixed values.

  • Data elements are used to describe the semantic attributes of a field in the context of the table. These attributes are only significant within the table, but not generally (as technical attributes are). In the data element, you can, for example, define a short description of the table field that is displayed on the screen when you call the F1 help. You can also specify in the data element the text that is displayed on input fields that refer to the data element (field label, for example, Destination Airport).

The two-level domain concept (consisting of the data element level and the domain level) allows technical field attributes to be defined and maintained at the domain level. A domain can pass its field attributes on to any number of fields, and you only need to explicitly change the domain itself, but not the individual fields, when modifying the field attributes thus described. Basing fields on the same domain ensures that field values can be compared safely and without conversion.

Tables, data elements, and domains are managed centrally in the ABAP Dictionary.

Hint

If you want to check where in the SAP system a particular data definition (data element, domain, table, or similar) is used, then you can look in the Where-Used List in transaction SE11 for that data definition.

Excursus: Core Data Services Views (CDS Views)

The ABAP Dictionary also allows the creation of views. A view is a grouping of columns in one or more database tables in accordance with an application-specific view. When multiple tables are joined, a view usually implements a join with statically defined join conditions. The columns of a view make a flat structure that can be used as a data type. In Open SQL, a view can usually be used as a database table.

There are limitations of ABAP Dictionary views, however. The main reason for these limitations was to keep the load away from the database and to ensure that a query would return the same results on any database.

But to benefit the most from SAP HANA's capabilities, especially from its use of parallelism and optimized data structures and transfer, it is better to do expensive calculations and aggregations on the database itself rather than transferring huge amounts of data onto the ABAP application server. This is a fundamental change to the ABAP programming paradigm. Now it becomes "logic to data", or "code-to-data" as it is frequently called, rather than "data to logic".

With the dawn of SAP HANA and the possibility to develop applications directly on the database, not using an application server any more, the need arose to create a meta model repository directly on the database. As with the ABAP Dictionary on the application server, there should be more in the box for you than using native SQL's CREATE TABLE or CREATE VIEW, especially considering the need for enriching pure technical definitions with semantics. And that's one of the main reasons for SAP's Core Data Services.

For more information on ABAP Core Data Services Views, see the class S4D430 – Building Views in ABAP Core Data Services (ABAP CDS).

Work with the ABAP Dictionary

Display table definitions and table content.

The ABAP Language

ABAP is SAP's programming language for business applications. Most business applications in an SAP system are written in ABAP. An ABAP program consists of individual statements. Every statement begins with a keyword and ends with a period.

For example:

Code Snippet
12345
REPORT first_program. WRITE 'My first ABAP program!'.

This piece of code contains two statements, one on each line. The keywords are REPORT and WRITE. The program issues a list. In this case, the list contains the line My first ABAP program!.

Illustration or code snippet representing the ABAP programming language.

The figure above shows an excerpt from an ABAP program. You can use special commands or keywords in ABAP programs to create selection screens (keyword PARAMETERS), to print lists (keyword WRITE), or to access table contents (for example, using the keyword SELECT). The ABAP command CALL SCREEN calls a screen (consisting of a screen image and its flow logic) defined in the Screen Painter.

For ABAP-based SAP systems of SAP Business Suite, ABAP generally uses Open SQL commands to access the database. Open SQL consists of a set of ABAP statements that execute operations on the central database of the SAP system. Open SQL is used in an identical way for all supported database platforms for SAP systems based on AS ABAP. This means that the programs developed are independent of the type of database used.

Note

This is different in the context of SAP S/4HANA: In order to benefit the most from SAP HANA's capabilities, it is better to do expensive calculations and aggregations on the database itself, rather than transferring huge amounts of data onto the ABAP application server. This is a fundamental change to the ABAP programming paradigm. It is very often referred to as Code-to-Data as opposed to the classic Data-to-Code approach. One way of approaching the code-to-data paradigm is to use native SQL to access SAP HANA-specific functionality, such as built-in functions.

Some characteristics of the ABAP programming language are:

  • Multilingual capability (text elements, such as list headers or input field texts are stored separately for each supported language)

  • Simple and effective development of graphical user interfaces

  • Object-oriented programming (ABAP Objects)

  • Platform independence (using Open SQL and the database interface)

  • Efficient access to data structures (tables, data elements, and so on)

Accessing ABAP Source Code

SAP delivers the source code for all ABAP programs. You can view the code and use it, for example, as a template for your own programs.

In any application based on SAP GUI, you can choose the menu path SystemStatus... and double-click to navigate to the relevant ABAP Workbench tool. The Workbench displays the selected object in the appropriate tool.

Note

You must have the necessary authorizations to do this.

Visual example of forward navigation in SAP development tools.

Forward Navigation

As a support employee, you want to read-access repository objects shipped by SAP.

Steps

  1. Preparation: Via SAP GUI for Windows, logon to the development system S4D. Start transaction SU01twice (resulting in two SAP GUI windows).

    1. Log on to SAP system S4D, client 100, with your user ID TRAIN-## and the credentials provided by your instructor.

    2. In the command prompt, enter /OSU01 (this will start transaction SU01 in a new SAP GUI window).

    3. In the command prompt, enter /OSU01 again (this will start transaction SU01 in another SAP GUI window).

  2. In one of the two SAP GUI windows showing transaction SU01, use SystemStatus to access the ABAP Editor of the current program.

    Caution

    Do not perform any changes.

    1. In one of the two SAP GUI windows showing transaction SU01, navigate to SystemStatus.

    2. In section SAP dataRepository data, double-click the field right to Program (screen).

    3. The ABAP Editor opens.

    4. Feel free to navigate further, for example by double-clicking any of the Include names.

    5. In the ABAP Editor, choose Back (F3) several times, until you are back on the start screen of transaction SU01.

  3. In one of the two SAP GUI windows showing transaction SU01, use SystemStatus to access the Menu Painter of the current program.

    Caution

    Do not perform any changes.

    1. In one of the two SAP GUI windows showing transaction SU01, navigate to SystemStatus.

    2. In section SAP dataRepository data, double-click the field right to GUI Status.

    3. The Menu Painter opens.

    4. Feel free to navigate further, for example by expanding the sections Menu Bar, Application Toolbar, or Function Keys (using the + sign).

    5. Feel free to compare menu or toolbar settings with the other SAP GUI window showing transaction SU01.

    6. In the Menu Painter, choose Back (F3) to go back to the start screen of transaction SU01.

  4. In one of the two SAP GUI windows showing transaction SU01, use SystemStatus to access the Screen Painter of the current program.

    Caution

    Do not perform any changes.

    1. In one of the two SAP GUI windows showing transaction SU01, navigate to SystemStatus.

    2. In section SAP dataRepository data, double-click the field right to Screen number.

    3. The Screen Painter opens.

    4. Feel free to navigate further, for example:

      • Choose Layout (Ctrl+F7). This will open the graphical editor.
      • Double-clicking any of the module names. This will open the ABAP editor.
    5. Feel free to compare the screen content with the other SAP GUI window showing transaction SU01.

    6. In the Screen Painter, choose Back (F3) several times, until you are back on the start screen of transaction SU01.

ABAP Program Creation Using the ABAP Editor

You can use the ABAP Editor (transaction SE38 or link in the Object Navigator, transaction SE80) to create and edit programs. ABAP programs are stored in the SAP system as entries in database tables.

When you want to create a new program, you enter both a program title and attributes for the program. These attributes include program type (such as Executable program), status (for example, Customer Production Program), and application. Each repository object is assigned to a package.

Once you have performed these activities, you can write your own program in the Object Navigator or from the ABAP Editor, both called "Editor" below.

The Editor provides a range of functions, including a syntax check and an option for ABAP keyword capitalization. You can also display syntax help for an ABAP keyword by positioning the cursor on the keyword and pressing the F1 key. It is therefore advisable to develop ABAP programs with the Editor alone. From the Editor, you can navigate to other tools in the development environment such as the ABAP Dictionary, the Screen Painter, or the Menu Painter, by double-clicking repository objects in the coding.

If you create or edit a program or a development object, and then save it, it is always stored in the repository as an inactive version. This makes it possible to continue developing without changing the active system. As long as you have not activated the inactive version you are currently working on, the most recent active version of the object is always executed during runtime.

To make a repository object available throughout the system, you must activate it. This creates an active version of the program that is then used if, for example, a user wants to execute your program.

You can execute your program in the Editor using Direct processing (F8). This executes the object for test purposes.

Hint

You can find an extensive collection of example programs for testing by using transaction code ABAPDOCU.

Object Navigator and ABAP Keyword Documentation

ABAP Development Tools (ADT) for Eclipse

The open Eclipse platform offers a first-class user experience, powerful platform capabilities, and a broad and vibrant ecosystem that can be regularly improved and enhanced.

SAP plays an active role in the Eclipse Foundation as a strategic member. Many of the design-time, development, and administration tools already use the Eclipse platform. These include SAP NetWeaver Visual Composer, SAP NetWeaver Developer Studio for Java development, Sybase Unwired Platform, and SAP HANA Studio. The ABAP development tools (also known as ABAP in Eclipse or ADT) are the latest addition to the family.

ABAP Development Tools

The ABAP Development Tools (ADT) is SAP’s state-of-the-art IDE for ABAP development on the open Eclipse platform. They are designed to increase developer productivity significantly by using the tried-and-trusted user friendliness, speed, and flexibility of the Eclipse platform. They combine powerful AS ABAP functions from SAP such as Application Lifecycle Management, server-based development, complete integration, and effective tests and tools for troubleshooting with the powerful Eclipse UI. The modern, and for many people familiar Eclipse UI is also offered on the ABAP platform.

Features of the ABAP Development Tools

ABAP Development Tools offer the following functions:

  • A completely new ABAP development experience on the Eclipse platform.

  • An open platform for developing new ABAP-based tools.

  • A series of open, language- and platform-independent APIs that developers can use to build new user-defined tools for the ABAP environment.

  • Support for the creation of Core Data Services (CDS) entities in ABAP development for SAP HANA scenarios.

ADT is closely linked to SAP HANA Studio, SAP UI5 tools, and JAVA.

ABAP development tools use objects in the SAP repository in exactly the same way as the available ABAP Workbench tools.

Note

For information how to install and update the front-end components of ABAP Development Tools, see https://tools.hana.ondemand.com/#abap.

The Eclipse Workbench

The Eclipse Workbench is the workbench desktop development environment in Eclipse. It can be used to edit objects, manage views, and organize the developer’s work area.

Every workbench window contains one or more perspectives. Perspectives contain views and editors. At any given time, there can be more than one workbench window on the desktop. For example, you can have the ABAP development tools and SAP HANA Studio open at the same time.

The Online Development Model

Developers who use ADT remain logged on to the SAP system while they work on various repository objects. In other words, development is still server-based – objects are only saved on the back end. Apart from a small read-only cache to increase performance and reduce server load, no objects are saved on the client.

If you edit an ABAP repository object in Eclipse, an enqueue lock is set for this object on the client and the latest version is called from the back end. If you activate or save the object, all changes are saved directly in the SAP system.

There is no complex check-out and check-in mechanism, and no need to create local copies of objects. Other services, such as the syntax check, search and where-used functions, run on the back end. As all repository objects are called from the back end, and there is no client-side ABAP runtime environment, there is no support for offline development.

Before you start developing in ADT, you must create an ABAP project. In ADT, an ABAP project always represents a system connection. It acts as the mediator between an SAP system and the front-end Eclipse-based IDE client, and it offers a framework for creating, editing, and checking development objects. An ABAP project is always a genuine system log on and also offers a user-specific view of all ABAP development objects of the SAP system.

There are two types of ABAP projects:

  • A classic project represents the connection to an on-premise system. In this case, you need to create an ABAP Project in ADT.

  • A cloud project represents the connection to SAP BTP ABAP environment. In this case, you need to create an ABAP Cloud Project in ADT.

The repository contains all ABAP development objects, such as programs, function modules, and definitions of database tables. It contains the SAP standard development and customers’ custom developments.

Note

The terms repository object and development object are often used as synonyms.

A selection of ABAP repository objects you can work with in ADT are:

  • ABAP programs

  • ABAP dictionary objects, such as database table definitions and data types

  • Screens

  • Web Dynpro components

  • Function groups and function modules

  • ABAP classes and interfaces

Various tools for creating, editing, and displaying ABAP repository objects are available in ADT. Some of these tools are native Eclipse objects, but some objects are also displayed and edited in the SAP GUI tool.

Eclipse and SAP GUI Editor

ABAP development tools integrate two different types of tools for ABAP development – Eclipse-based tools and SAP GUI-based tools.

Eclipse-based tools seamlessly integrate into the Eclipse environment. They have the same look and feel, and the same navigation functions.

Screenshot of SE80 ABAP Editor integrated in AS ABAP and representing ABAP Development Tools in Eclipse.

The SAP GUI is installed locally together with the Eclipse-based client. In the widest sense, SAP GUI-based tools are the tools and services of the traditional ABAP Workbench. Typical examples include the Package Builder tools, the ABAP Dictionary, and the tools for maintaining text elements for ABAP programs.

If you try to open a development object in the Project Explorer view, an Eclipse-based editor opens – provided one exists. If it does not, an SAP GUI-based tool opens in the Editor area. All additional objects that require an SAP GUI-based tool are opened in separate tab pages in the Editor area.

With GUI-based tools, you have full access to the functionality of the traditional ABAP Workbench. You can, for example, start all applications by entering a transaction code.

Note

Objects are transported in the usual way with the help of the Transport Organizer (SE09) and Transport Management System (STMS).

Hint

For an introduction to ABAP programming for the SAP S/4HANA environment using ABAP Development Tools for Eclipse, see the ABAP programming class S4D400Introduction to ABAP Programming on SAP S/4HANA.

Create a New ABAP Program

Business Example

As an ABAP developer, you want to create an ABAP program.

Additional Trainings on ABAP Development

More information on the ABAP Workbench is provided in the leading courses for ABAP Workbench, starting with courses:

  • S4D400: Basic ABAP Programming

  • S4DEV: Introduction to Application Programming on SAP S/4HANA

  • S4D430: Data Modelling in ABAP Dictionary and ABAP Core Data Services