ABAP Keyword Documentation → ABAP - Reference → Calling and leaving program units → Calling Processing Blocks → Calling Procedures → External Procedure Calls → Program Attributes for External Procedure Call
Unicode Checks for External Procedure Calls
External procedure calls are carried out in accordance with the Unicode Check attribute of its master program. Here, each actual parameter bound to a formal parameter in the procedure is handled independently of the corresponding attribute of the calling program and, independently of the parameter type and pass by type, also according to the attribute of the program called.
However, the typing check takes place in accordance with the setting for the calling program. This means the following:
- If passing a
RETURNING
parameter in a Unicode program from an obsolete non-Unicode program, actual and formal parameters must be convertible in accordance with the rules in Unicode programs.
- When calling Unicode programs from obsolete non-Unicode programs, runtime errors can occur if actual and formal parameters are not convertible in accordance with the rules in Unicode programs.
- If procedures with formal parameters for which a structure is defined using the obsolete addition
STRUCTURE
are called in Unicode programs, elementary data structures must be character-like and flat and, for structures, the Unicode fragment views must match.
Other versions:
7.31 | 7.40 | 7.54
Example
Take the following global class:
PUBLIC SECTION.
TYPES: BEGIN OF mystruc,
comp1 TYPE i,
END OF mystruc.
CLASS-METHODS meth RETURNING value(struc) TYPE mystruc.
ENDCLASS.
CLASS cl_test IMPLEMENTATION.
METHOD meth.
DATA s1 TYPE mystruc.
struc = s1.
ENDMETHOD.
ENDCLASS.
A calling program might be as follows:
comp1 TYPE c LENGTH 4,
comp2 TYPE i,
END OF s2.
z_myclass=>meth( RECEIVING struc = s2 ).
If the calling program is a Unicode program, calling meth
is not permitted
for syntax reasons regardless of the class pool called. If the calling program is a non-Unicode program, the call is allowed but a runtime error occurs if the called class pool is a Unicode program.
Let the definition of the method be changed as follows:
CLASS-METHODS meth CHANGING struc TYPE any.
Let the call be changed as follows:
z_myclass=>meth( CHANGING struc = s2 ).
The call is now possible in all combinations from a syntax point of view. If the called class pool is
a Unicode program, a runtime error occurs regardless of the calling program. If the called class pool
is not a Unicode program, the structure there is changed in accordance with the rules in non-Unicode
programs regardless of the calling program (implicit casting of type c
) and is passed to the calling program.