Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Calling and leaving program units →  Calling Processing Blocks →  Calling procedures →  External Procedure Call →  Program Attributes for External Procedure Call 

Unicode Checks for External Procedure Call

External procedure calls are carried out in accordance with the Unicode Check property of the main program in question. Each actual parameter that is connected to a formal parameter of the procedure is handled in accordance with the property of the called program regardless of the corresponding property of the calling program and the parameter type and pass type.

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 a non-Unicode program, actual and formal parameters must be convertible in accordance with the rules in Unicode programs.
  • When calling Unicode programs from 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 with the obsolete STRUCTURE addition are called in Unicode programs, elementary data structures must be character type 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:

CLASS cl_test DEFINITION PUBLIC.
  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 appear as follows:

DATA: BEGIN OF s2,
      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.