Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  User Dialogs 

Conversion Routines

When you convert a screen field from display format to SAP internal format and vice-versa, and output data using the ABAP statement WRITE or an assignment using WRITE TO, 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 the addition USING EDIT MASK in the WRITE statement. 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.
These are:

  • CONVERSION_EXIT_xxxxx_INPUT

  • CONVERSION_EXIT_xxxxx_OUTPUT

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:

  • BREAK-POINT,
  • CALL SCREEN, CALL DIALOG, CALL TRANSACTION, SUBMIT,
  • COMMIT WORK, ROLLBACK WORK,
  • COMMUNICATION RECEIVE,
  • EXIT FROM STEP-LOOP,
  • MESSAGE i..., MESSAGE w...

Other versions: 7.31 | 7.40 | 7.54


Notes

  • If a function module is used as a conversion exit, it is not possible to edit it using the Debugger. Conversion exits are taken into account in the new ABAP Debugger. In the traditional Debugger, it is possible to force a termination by inserting, for example, a division into zero in a conversion exit. It is then possible to analyze the current content, type, and length of fields at the point of termination.
  • Since the WRITE and WRITE-TO statements can trigger output conversions very often with lists, you should try to keep these conversions efficient.
  • Do not use external 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.