ABAP

ABAP is a proprietary programming language of the software company SAP, which was developed for the programming of commercial applications in the SAP environment and is similar in basic structure of the COBOL programming language.

Originally an acronym for " General report preparation processor ", since this language only customer-specific evaluations were programmed, but no database changes could be made. In the course of further developments of the language the acronym now stands for " Advanced Business Application Programming ." The language scope is not fixed and has been extended in the past repeatedly, for example, the object-oriented language commands from ABAP Objects.

Since 1990, all SAP-R/3-Module based on ABAP, which was taken over from the previous two SAP R /. Since the introduction of SAP NetWeaver, SAP ABAP offers also a workflow and programming environment for Java, and accordingly an ABAP-based and Java-based application server (see SAP NetWeaver Application Server).

  • 7.1 General
  • 7.2 Prior to Release 7.1 / 7:02
  • 7.3 Since Release 7.1 / 7:02

Properties

ABAP is a 4GL language that was specifically designed for mass data processing in commercial applications, and provides, inter alia, the following advantages over more primitive languages ​​in which such functions are in libraries:

  • As Open SQL in the language integrated database access
  • In the ABAP runtime environment integrated performance optimization of database accesses via the SAP buffering
  • Internal tables for dynamic storage and manipulation of tabular mass data in memory
  • In the ABAP runtime environment integrated approach to online transaction processing (OLTP ), where many users simultaneously access the central database
  • Integrated into the language interface to other programming environments via Remote Function Call
  • Integrated into the language interface to XML.

The integration of such features in the language is advantageous for the static verifiability and the execution speed of programs substantially. In return ABAP thus contains significantly more language elements than other programming languages.

ABAP supports a work based on subroutines and function modules, procedural and release 6.10 one to classes and interfaces based, object-oriented programming model. Both models are interoperable.

Backward Compatibility

SAP operates the principle of backward compatibility in the development of ABAP. If an ABAP statement replaced by a newer (eg performant ) instruction, the old statement does not lose its validity or function. As the old instructions in addition to the new instructions continue to exist, this results in a very extensive language support. Although Old language elements should no longer be used, but the use is quite possible. Only when using ABAP OO (ABAP Objects) can no longer be used some old components.

The advantage is that the recent developments and customer adjustments remain functional and their behavior does not change. Developments must not be revised. The disadvantage is that developers often resort to more old components, although newer and more effective ( more performant ) voice components are available. Newcomers for voice, this means that both the old and new components of components have to be learned. Furthermore, thereby increasing the complexity and language support.

Old and new components can also be combined, as well as procedural elements in object code ( program code ) are used simultaneously, the use of object-oriented elements in procedural coding is possible. The targeted combination of new and old components, the cardinality of the language can be increased.

ABAP Workbench

The ABAP programming is supported by a development environment that is designed to enable large projects with multiple ( hundreds ) developers. This must be ensured at all times a running system. For this purpose the modified objects are recorded on the so-called transfer orders which are exported when released to the file system and can be imported into subsequent systems. Through this mechanism, the development of the programs of their productive use can be made separately.

The development environment for the programming language ABAP is also developed in ABAP ABAP Workbench. In the ABAP Workbench ( access from the so-called Object Navigator, transaction SE80), but other objects such as BSP ( Business Server Pages with HTML interests) to be processed.

The special feature is the so-called " forward navigation ." So double-clicking a table name leads to the definition of the database table in the ABAP Dictionary, whereas double leads directly into this method to a method name.

The ABAP Workbench is adjusted over time to meet the requirements of modern software development. Since the last release also syntax highlighting supports for example.

Since July 2012, the SAP also offers a ABAP development environment based on the open source Eclipse platform to ( " ABAP in Eclipse "). The ABAP tools can be ideally combined with other Eclipse -based tools such as JEE and Android Development Tools integrate. This newly designed environment specifically supports agile software development methods such as test-driven development. The new ABAP editor offers standard features such as syntax highlighting and code completion support for refactoring such as renaming methods and variables. The new Eclipse-based debugger completes the offer of a modern development environment. Thus, tools of classical ABAP Workbench such as SE11 can continue to be used, there is the possibility of these transactions on an integrated SAP GUI within Eclipse call.

Code example

The following program prints the contents of the table TSTC ( includes SAP transaction codes) from.

Report RSTSTCT1. Tables: TSTCT.   Select * from TSTCT where SPRSL = SY- LANGU.    Write: / TSTCT - SPRSL, TSTCT TCODE TSTCT - TText. Endselect. Code Example for R / 3 versions > = 4.7 SR 1

The following program prints the contents of the table TSTC ( includes SAP transaction codes) from.

REPORT ztest.      CLASS DEFINITION demo.      PUBLIC SECTION.        CLASS -METHODS main.    ENDCLASS.      IMPLEMENTATION CLASS demo.      METHOD main.        Tstc_tab DATA TYPE STANDARD TABLE OF TSTC WITH NON-UNIQUE DEFAULT KEY.        Alv DATA TYPE REF TO CL_SALV_TABLE.        TYPE REF TO DATA exc cx_salv_msg.        SELECT *          FROM TSTC          INTO TABLE tstc_tab.        TRY.          CL_SALV_TABLE => factory (            IMPORTING r_salv_table = alv            CHANGING T_TABLE = tstc_tab ).          alv -> display ().        CATCH cx_salv_msg into exc.            MESSAGE exc TYPE 'I'                DISPLAY LIKE ' E'.        ENDTRY.      ENDMETHOD.    ENDCLASS.      START -OF -SELECTION.      demo => main (). REPORT ztest. Describes the type (REPORT ) and the name ( ztest ) of the program. The name is based on the namespace conventions that say that customer (ie not derived from SAP) programs in the customer namespace ( Z * and Y *) or in a reserved namespace ( are the first and last character is a backslash ) must lie.

  • CLASS DEFINITION demo ... ENDCLASS. Declaration part of a class demo.
  • CLASS -METHODS main. Declaring a static method main.
  • IMPLEMENTATION CLASS demo ... ENDCLASS. Implementation part of a class demo with method implementation METHOD ... ENDMETHOD
  • Tstc_tab DATA TYPE STANDARD TABLE OF TSTC WITH NON-UNIQUE DEFAULT KEY. This statement defines an internal table tstc_tab type standard table whose line type has the structure of a row in the database table TSTC.
  • Alv DATA TYPE REF TO CL_SALV_TABLE. This statement defines a reference variable for a List Viewer object.
  • TYPE REF TO DATA exc cx_salv_msg. This statement defines a reference variable for an exception object.
  • SELECT * FROM TSTC INTO TABLE tstc_tab. This statement reads all the data in the database table TSTC in the internal table tstc_tab. The asterisk indicates that all columns of the database table to be written into the internal table.
  • TRY ... CATCH ... ENDTRY. Exception Handling ( available since version 4.7 SR1).
  • CL_SALV_TABLE => factory ( ... ). Generating a List Viewer for the internal table.
  • Alv -> display (). Calling the display method of the List Viewer.
  • START -OF -SELECTION. Introduction of an event block ( serves as entry point )
  • Demo => main () call to the main method of the class demo.

ABAP Objects

In ABAP Objects refers to the object-oriented extensions to the programming language ABAP. It implements all elements of object-oriented programming ( OOP) with the exception of multiple inheritance and method overloading. Interfaces and optional parameters are supported. With special RTTI classes also reflexive programming is possible from the version 6.40 even (limited) the dynamic creation of new types.

ABAP Objects is available as of SAP release 4.6 and has since been continuously improved and supplemented by Object Services, for example. The object-oriented language elements are prerequisites for the development of advanced user interfaces with controls and for the implementation of Web applications and XML services in ABAP. Large parts of the ABAP Workbench are themselves object-oriented implemented in ABAP Objects.

ABAP Objects restricts the language range of " classic " ABAP in some points. For example, internal tables with header lines in the context of ABAP Objects are no longer allowed.

Web Dynpro

As of SAP NetWeaver 7.0, there is also the opportunity to develop web applications in ABAP WebDynpro for ABAP with. WebDynpro ABAP is based on the Web Dynpro technology. Originally SAP wanted only for the Java programming language make this technology (from NetWeaver 6.40 ) are available. Based on customer requests (missing Java expertise in ABAP developers or missing SAP know -how Java developers ) to SAP decided to incorporate this technology in ABAP.

Criticism

Generally

The multitude of possible ABAP statements and their variants generally leads to a severe -to-understand source code than in other popular programming languages ​​. The existing diversity of ABAP statements resulting from the backward compatibility.

  • Assignments: To exist, for example, in addition to a mathematical form of assignment " variable = 18/ 3 ", the cobol -like notation "MOVE 18/3 TO variable ". For other tasks, there are several possible notations.
  • Significance of spaces: Difference between ' ' and ' ' (plus and Blank -Plus)

Prior to Release 7.1 / 7.02

In particular, prior to Release 7.1 are recognizable details that complicate the use of language.

  • Expressions were evaluated only during assignment to a variable, but not in an IF condition is still in a WRITE statement even when the parameters are passed to a function.
  • The result of the function call is not directly useful in an expression.

Since Release 7.1 / 7:02

With Netweaver 7.1, a number of simplifications of the language, especially chained expressions available. These changes were later ported down 2 ( 7:02 ) for Release 7.0 in the enhancement package.

Pictures of ABAP

22746
de