SAP TYPING CHECK GENERAL

Get Example source ABAP code based on a different SAP table
  


ARTICLE

General Rules for Typing
The general rules for checking apply strictly to the following:
The assignment of all data objects to field symbols
The linking of the said data objects to input, input/output, and output parameters for procedures
The general rules for checking the typing are:
If you have an assignment to generically typed field symbols or field parameters, the system checks whether the technical type properties of the assigned data object are a subset of the generic type. The type properties that are not defined during typing are adopted by the actual parameter.
If you have an assignment to fully typed field symbols or formal parameters, the technical properties of the data type of the assigned data object must correspond exactly to the typing.
The result of the typing check during the passing of actual parameters to formal parameters is independent of the passing type used. In a pass by value, the check for pass by reference is always carried out, even though this is stricter than necessary in individual cases.
If reference variables are passed, Up Cast s are possible butDown Casts are not. If actual parameters are passed to input parameters typed as reference variables, an Up Cast is only possible if there is no change of content within the procedure.
If you have an assignment of memory areas to field symbols typed as reference variables, the typing of the field symbol and the static type of the memory area must be the same.
If you have an assignment to generically and fully typed field symbols or formal parameters, only the technical type properties are checked. The following are not checked:
Names of structure components
Semantic properties of data types defined in the ABAP Dictionary (conversion routines, documentation, and so on)
Initial memory requirement of internal tables If you have dynamic access to generally typed formal parameters or field symbols, these properties are adopted by the actual parameter type. If you have static access to generically typed formal parameters or field symbols, these properties are adopted by the typing for the formal parameter.
In assignments to field symbols or formal parameters structured using the obsolete addition STRUCTURE, non-Unicode programs check whether the assigned data object is correctly aligned (for pass by reference), whether it has the same length, and (for function modules) whether it has a flat structure. In the case of formal parameters of subroutines and table parameters of function modules, it is enough if the length of the actual parameter is at least as long as the assigned structure. In Unicode programs, elementary data objects must be character-like and fl at and, in structures, the Unicode fragment views must match.

Notes
In external procedure calls between Unicode programs and non-Unicode programs, and back, the typing check always takes place from the caller's view.
In the case of generically typed field symbols or formal parameters, and in the case of formal parameters of function modules and externally called subroutines, the typing is checked first at the time of the assignment - that is, at runtime. In the case of fully typed field symbols and formal parameters of methods and internally called sub- routines, the check takes place already through the syntax check.