The ongoing development of a programming environment is not done for its own sake. The ABAP language and the ABAP workbench grow with their users’ demands. Three of SAP’s biggest product lines – SAP Business ByDesign, SAP Business All-in-One, and SAP Business Suite – are based on ABAP. The evolution of SAP Business Suite applications and the development of the SAP Business ByDesign solution make especially high demands on the underlying infrastructure.
One of the greatest challenges is to provide appropriate means and tools to implement complex architectures easily. Some of the most important recent developments in the ABAP programming environment, like enhancement and switch framework, better support of decimal floating point calculations, secondary keys, string processing, and new features in the ABAP debugger, are good examples of how powerful new technology concepts can help to keep application level complexity under control.
Enhancement and switch framework
With the enhancement and switch framework – first available in SAP NetWeaver 7.0 – SAP has revolutionized how customers can adapt their business software to their specific needs. Working hand-in-hand, the enhancement framework allows customers to enhance SAP software and the switch framework controls which development objects are active. Enhancements are made by adding custom code at strategic and predefined points. Enhancement and switch framework tools are tightly integrated into the ABAP workbench and supported by new ABAP language statements.
The enhancement and switch technology not only simplifies the maintenance of industry solutions, but also enables SAP’s long-term strategy for SAP Business Suite. The enhancement and switch framework is the basis for delivering new functionality for the SAP ERP core and industry solutions. New functionality is delivered as an optional enhancement package, which contains a set of business functions that can be installed and then activated using the switch framework.
Customers can enhance SAP standard software using the enhancement framework in several ways: source code plug-ins; class, interface, and function group enhancements; BAdIs; and Web Dynpro ABAP enhancements.
Source code plug-ins are code snippets that can be plugged into ABAP programs at certain positions. These positions can be specified by using special ABAP statements for defining explicit enhancement options: The ABAP statements ENHANCEMENT-POINT and ENHANCEMENT-SECTION identify positions where code can be inserted or replaced. The enhancement implementations are regular repository objects and are assigned to a development package in the customer’s namespace when they are created.
In addition to explicit enhancement options, source code enhancements are always implicitly possible at a number of places. Examples include the end of programs (includes, reports, function pools, and module pools), the beginning and end of methods and function modules, the end of all sections (public, protected, and private), the end of classes, and the end of parameter lists of methods and function modules.
Source code plug-ins and other enhancements are made switchable by assigning their packages to a switch. The switch, in turn, is assigned to a business function. Business functions are used to synchronize a pool of switches.
Enhancements are activated by switching on the business functions in the switch framework. When business functions are activated, the corresponding source code is compiled directly into the executable code (technically called the load), and by doing so, is melded into the original software. This approach is significant for the performance of enhanced applications.
During runtime, it is not necessary to evaluate the states of all existing switches to determine which code must be executed. There is no need to enclose the enhancement implementations explicitly in control structures such as IF or CASE statements. This approach is possible because the technology is tightly integrated into the ABAP workbench and supported in the ABAP programming language itself. As such, the enhancement and switch framework offers a powerful and effective means for adapting ABAP code.
Decimal floating point calculations
To provide better support of decimal floating point calculations, ABAP has introduced a new built-in numeric type called DECFLOAT. For many years, SAP has used the decimal fixed point type P (based on BCD encoding) to enable financial applications that require a high degree of accuracy and that must conform to strict laws governing how monetary data must be rounded.
This type, however, has two major disadvantages. First, the range of possible values is limited from -10^31-1 to +10^31-1. This range poses a significant problem when calculating with very large values. Application developers are forced to implement complicated and error-prone work-arounds to handle the large numbers. Second, the number of decimal places is fixed. Following the trend toward generic programming and re-use libraries, developers don’t always know how many decimal places are required when they write their code. Some industries or countries might require more or fewer decimal places than others.
For example, an application that converts 1500,000000 milliliters to barrels using type P with six decimal places delivers 0.009435 barrels. Converting it back the same way delivers 1500,045128 milliliters. The result shows that five decimal places are inexact. It remains inexact even if the maximum number of 14 decimal places is used for the conversion.
In keeping with its commitment to open standards, SAP has worked with IBM to provide a platform-independent software implementation of the new decimal floating point data type based on the current draft of the IEEE 754r specification for decimal floating point calculations. The implementation ensures that customers can maintain interoperability and easily exchange data between SAP NetWeaver and non-SAP systems that adhere to this upcoming standard. SAP is also collaborating with IBM to utilize native hardware support for decimal floating point introduced by IBM with the POWER6 architecture-based servers.
ABAP offers two built-in DECFLOAT types with different precision: DECFLOAT16 (8 bytes, 16 digits, exponent -383 to +384) and DECFLOAT34 (16 bytes, 34 digits, exponent -6143 to +6144). The generic type, DECFLOAT, which can represent either a DECFLOAT16 or a DECFLOAT34, makes it easy for developers to implement generic applications.
The ABAP language offers full support for the new type which can be used everywhere where other built-in numeric types (I, F, and P) are used. Depending on how many decimal places are required, DECFLOAT values can be rounded exactly by using the designated built-in ROUND function. In general, DECFLOAT should always be used when a large value range is required or the number of decimal places required is not known.