SAP UNICODE OTHERS

Get Example source ABAP code based on a different SAP table
  


ARTICLE

Other Changes Relating to Unicode
Overview
1 Bit statements
2 Adding field strings
3 Loops with the VARY and VARYING additions
4 Generating subroutines
5 Generating programs
6 Assigning types and GET/SET PARAMETER ...
7 Unreachable statements
8 Function modules with incorrect parameter names

1 Bit statements
SET BIT i OF f [TO g].
GET BIT i OF f [INTO g]. Until now, there was a check in these statements to see if field f has character type, where normally X fields, X strings and flat structures were also considered to have character type. This no longer is meaningful in a UP because on the one hand types X and XSTRING are no longer considered to have character type, and on the other hand bit-by-bit access to fields or structures of character type is no longer platform-independent. I n an Unicode program, field f must therefore be of type X or XSTRING for these operations.
f O x, f Z x, and f M x Until now, all number types and thus all character types were allowed in the bit mask operations f O x , f Z x, and f M x . Operand f now must have type X or XSTRING in a Unicode program.

2 Adding field strings
ADD n1 THEN n2 UNTIL nz [ ACCORDING TO sel ] GIVING m [RANGE str]
ADD n1 THEN n2 UNTIL nz TO m [ RANGE str ]. There are certain restrictions in Unicode programs for the following statements when adding field strings :
Operands n1, n2, and nz must have compatible types.
The distance between nz and n1 must be an integer multiple of the distance between n2 and n1 .
There is a syntax or runtime error if fields n1, n2, and nz are not in a structure. Either the syntax check must be able to recognize this fact or its valid range must be marked explicitly with a RANGE addition.
If the system discovers that the addressed fields are not within the structure specified with the RANGE addition, it triggers a syntax ensures that the RANGE area is not left at runtime.
ADD n1 FROM i1 GIVING m [ RANGE str ].
The field n1 must lie within a structure which must be explicitly defined with a RANGE addition if the syntax check cannot recognize this fact. This variant also checks at runtime if n1 and the addressed values lie within the structure.

3 Loops with the VARY and VARYING additions Loops with the VARY or VARYING addition also cause Unicode problems, because on the one hand you cannot be sure that you are accessing the contents of memory with the correct type and on the other hand memory could be overwritten inadvertently.
DO ... VARYING f FROM f1 NEXT f2 [ RANGE f3 ].
WHILE ... VARY f FROM f1 NEXT f2 [ RANGE f3 ]. Fields f, f1, and f2 must have compatible types in this statement. To prevent storage contents from being overwritten, a RANGE for valid accesses is implicitly or explicitly introduced for these statements. If the RANGE f3 addition is specified, a syntax or runtime error is also triggered should f1 or f2 not be included in f3. For f3, only structures and elementary fields of the types C , N, or X are allowed. If the RANGE addition is missing, it is implicitly defined as follows with FROM f1 NEXT f2:
If the syntax check recognizes that both f1 and f2 are components of the same structure, the valid RANGE range is defined from the smallest structure containing f1 and f2.
There is a syntax error if the syntax check recognizes that f1 and f2 do not belong to the same structure.
A valid range must be defined explicitly with RANGE if the syntax check cannot recognize that f1 and f2 are related. If a deep structure is defined as RANGE addition, there is a check that there are no field or object references, tables or strings within the range just being scanned each time the loop is scanned.

4 Generating subroutines When subroutines are generated automatically with the GENERATE SUBROUTINE POOL itab NAME name statement, the generated program inherits the contents of the Unicode flag of the generating program.

5 Generating programs When programs are generated automatically using the INSERT REPORT prog FROM itab ... statement, default values are set for the TRDIR entry as before. However, this statement now includes a new addition, UNICODE ENABLING uccheck (among others), with which the Unicode flag of the inserted report is set to the value of uc. If this addition is not used, the following applies: A Unicode program also creates a Unicode program A non-Unicode program in turn creates a non-Unicode program A non-Unicode program becomes a Unicode program if it is overwritten by a Unicode program A Unicode program remains a Unicode program if it is overwritten by a non-Unicode program

6 Assigning types and GET/SET PARAMETER ... With the statements GET PARAMETER ID pid FIELD f and SET PARAMETER ID pid FIELD f, f must be character-type (in non-Unicode programs as well, as of Release 6.10). You can use the EXPORT and IMPORT statements for storing non-character-type fields and structures.

7 Unreachable statements In Unicode programs, unreachable statements cause a syntax error. In non-Unicode programs, this previously only resulted in a syntax warning.

8 Function modules with incorrect parameter names In Unicode programs, calling a function module , whose parameter names are statically declared as a literal or constant, raises an exception that can be handled if an incorrect parameter name is specified. This only applies for function modules that are not called via Remote Function Call. In non-Unicode programs, an incorrect name was previously ignored.