ARTICLE
Notes on the Portability of ABAP
The nature of the ABAP runtime environment guarantees that ABAP
programs can be supported by many different systems. There are only a
few cases in which the porting of programs to other platforms could
cause problems.
Native SQL
Database-specific statements in ADBC or enclosed by EXEC SQL
and ENDEXEC are the most critical factor for portability. -
Whenever possible, use ABAP Open SQL .
Files
The statements OPEN , CLOSE , TRANSFER , READ
DATASET , and DELETE DATASET have a file name as parameter.
This file name is passed directly to the underlying operating system.
The organization of file systems ( flat ,
hierarchical, ...) and the form of valid file names, however, depend to
a great extent on the operating system. - The function module
FILE_GET_NAME enables logical file names (platform-independent) to be
converted to physical file names (platform-specific).
Numeric Format
The format of numeric types i and f can be represented by
various byte sequences, and (with type f ) the code itself. -
Here, support is provided by the TRANSLATE ... NUMBER FORMAT
command.
Numbers
While numbers of type p and i are handled in the same way
on all platforms supported by SAP, there are differences when handling
floating point numbers (type f ). The value range (approximately
10**(-308) to 10**(+308)) and accuracy up to 15 decimal places is the
same everywhere, but 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 types differ depending on the platform. For this reason,
always address components of a field string by name and not with an
offset value, for example, 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 enables texts to be converted
from one coding to another.
Sorting
Only very limited assumptions can be made about the effect of sorting on
the character order:
Lowercase letters can come before uppercase letters or vice versa.
Numbers can come before letters or vice versa.
While the numbers 0 to 9 follow each other with no gaps, this is not
necessary for letters. Letters with an accent, umlauts, or similar are
not sorted.
These problems affect the statements SORT , READ TABLE ...
BINARY SEARCH , and SELECT ... ORDER BY and the relational
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.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved