Notes on the Portability of ABAP

The nature of SAP Basis software guarantees that ABAP programs can be supported by many different systems. There are only a few cases where transfer of programs to other platforms could cause problems.

Native SQL

Database-specific statements enclosed by EXEC SQL and ENDEXEC are the most critical factor for portability. Whenever possible, you should use ABAP/4 Open SQL.

Files

A parameter of the OPEN, CLOSE, TRANSFER, READ DATASET and DELETE DATASET statements is a file name which is passed to the underlying operating system. However, the organization of file systems (flat, hierarchical, ...) and the form of valid file names depends to a great extent on the operating system. The function module FILE_GET_NAME allows you to convert logical file names (platform-independent) to physical file names (platform-specific).

Numeric format

The format of numeric types I and F can be represented by various byte sequences. With type F, even the code is different. Here, support is provided by the TRANSLATE ... NUMBER FORMAT command.

Numbers

While numbers of type P and I are treated in the same way on all platforms supported by SAP, there are differences with floating point numbers (type F). Although the value range (about 10**(-308) to 10**(+308)) and accuracy up to 15 decimal places is the same everywhere, rounding behavior can vary. These differences should not have any serious consequences in practice, but it is not advisable to test two floating point numbers for equality, with the exception of zero; instead, check that the difference is only very small as shown below.

DATA: F        TYPE F,
      G        TYPE F,
      REL_DIFF TYPE F,

      EPSILON TYPE F VALUE '1E-6'.

      REL_DIFF = ABS( ( F - G ) / G ).
      IF REL_DIFF < EPSILON. ...  ENDIF.

Alignment

Certain fields are aligned at the half word or word limit in field strings. As a result, these field strings may contain leading bytes, even before the first field. Furthermore, some ABAP/4 types are different, depending on the platform. For this reason, you should always address components of a field string by name and not with an offset value, i.e. T000-ORT01 rather than T000+28.

Character set

The set of available characters and their coding depends not only on the platform, but also on the country and language of installation. The TRANSLATE ... CODE PAGE command allows you to convert texts from one coding to another.

Sorting

You can only make very limited assumptions about the effect of sorting on the character sequence. For instance:

These problems affect the SORT, READ TABLE ... BINARY SEARCH and SELECT ... ORDER BY statements, as well as the comparison operators <, <=, >, >=, BT and NB. Unfortunately, there is no general solution at present. There is a special solution for the SORT statement. This is "locale" sorting, using the AS TEXT addition.