When you convert a screen
field from display format to SAP internal format and vice-versa, and output data using the ABAP
WRITE or an assignment using
the type-specific conversion is executed automatically. To perform a non-standard conversion, you have to specify the name of a conversion routine (conversion exit) for the attributes of one of the fields in the
Screen Painter or use
USING EDIT MASK in the
This kind of conversion routine is performed automatically if the field has a Dictionary reference and you have specified the conversion routine in its domain.
If you want to implement non-standard conversions from display format to SAP internal format and vice-versa,
you can implement special function modules. Two function modules are assigned to the conversion routine xxxxx.
The INPUT module converts from display format to internal format, while the OUTPUT module performs the reverse operation. You are recommended to program both modules for input and output conversion in a function group. The effect of the conversion should be described in the documentation. If necessary, you can introduce new conversions. The function modules you create for these must only satisfy the above name requirements and conform to the conventions listed below.
Both functions must have precisely two parameters (although other optional input parameters are also allowed). The names of the obligatory parameters are INPUT for the value to be converted and OUTPUT for the converted value. It is important that the INPUT parameter in the INPUT conversion and the OUTPUT parameter in the OUTPUT conversion have no reference fields, since the screen or ABAP field assigned during the call can have a different length than expected.
In the output conversion, termination messages at the most are useful. The input conversion can trigger A, E, and S messages (although S messages are of little use). error messages result in an error dialog. Exceptions are not detected when the function is called and lead to termination.
Any ABAP statements which interrupt the processing are not allowed in function modules. These include:
EXIT FROM STEP-LOOP,
WRITE-TOstatements can trigger output conversions very often with lists, you should try to keep these conversions efficient.
subroutine callsin conversion functions because externally called programs use the table work areas of the first calling main program. With conversion exits, this could result in undetectable errors since conversion exits often occur at unexpected points in the program flow.