![](/cvo_files/imgs_sap_abap/logos/logo_cvo_academy_it.png)
✒️ABAP Las rutinas de conversión de datos
ABAP Las rutinas de conversión de datos
![ABAP Las rutinas de conversión de datos ABAP Las rutinas de conversión de datos](https://www.cvosoft.com/cvo_files/imgs_sap_abap/og-images/227.jpg)
Data Conversion Routines in ABAP
When working with the SAP system, you'll observe a distinction between the format in which data is displayed on system screens and the internal format in which the same data is stored in SAP database tables.
- Display Format: This is how fields appear on SAP screens.
- Internal Format: This is the format in which data is stored in the SAP database tables.
When the display format of a field on SAP screens differs from the internal format in which the field is stored in database tables, we infer the existence of what is known as a Data Conversion Routine for the field's domain.
Data Conversion Routines
These routines enable the conversion of a field's content from the display format to SAP's internal format and vice versa. You can employ existing standard data conversion routines in the SAP system or create new custom Z data conversion routines.
These function modules conventionally have the following specific names:
- CONVERSION_EXIT_XXXXX_INPUT: Converts from display format to internal format.
- CONVERSION_EXIT_XXXXX_OUTPUT: Converts from internal format to display format.
Here's an example:
- CONVERSION_EXIT_ISOLA_INPUT: Converts from a two-digit internal format to a one-digit display format.
- CONVERSION_EXIT_ISOLA_OUTPUT: Converts from a one-digit display format to a two-digit internal format.
If you double-click on the function module CONVERSION_EXIT_ISOLA_OUTPUT, you can view the corresponding ABAP code.
If a screen field is associated with a domain with a conversion routine, it automatically executes whenever a value is entered or displayed. You associate the conversion routine with a domain when creating or modifying it using SE11.
Steps for Creating a Conversion Routine
- Create the function modules (SE37) CONVERSION_EXIT_XXXXX_INPUT and CONVERSION_EXIT_XXXXX_OUTPUT.
- Assign the conversion routine XXXXX to a domain for a field in a database table.
Conversion routines are commonly used for date fields in database tables.
E.g of its usage in ABAP:
DATA: lv_internal_format TYPE string,
lv_display_format TYPE string.
lv_internal_format = '1'.
" Convert One-digit SAP Lang Key to Two-digit ISO Lang Key
CALL FUNCTION 'CONVERSION_EXIT_ISOLA_OUTPUT'
EXPORTING
input = lv_internal_format
IMPORTING
output = lv_display_format.
WRITE:/ 'Internal format', lv_internal_format. " 1
ULINE.
WRITE:/ 'Display format', lv_display_format. " ZH
 
 
 
Sobre el autor
Publicación académica de Jaime Eduardo Gomez Arango, en su ámbito de estudios para la Carrera Consultor ABAP.
Jaime Eduardo Gomez Arango
Profesión: Ingeniero de Sistemas y Computación - España - Legajo: SW34C
✒️Autor de: 149 Publicaciones Académicas
🎓Egresado de los módulos:
- Carrera Consultor en SAP Fiori
- Carrera Consultor ABAP Nivel Avanzado
- Carrera Consultor ABAP Nivel Inicial
Disponibilidad Laboral: FullTime
Presentación:
Ingeniero de sistemas y computación con 8 años de experiencia el desarrollo frontend & backend (react/node) y en cloud (aws), actualmente desarrollando habilidades en sap btp, ui5, abap y fiori.
Certificación Académica de Jaime Gomez