Conversion routines are identified by a five-place name and the function modules have a fixed
naming convention. The function modules are assigned to conversion routine xxxxx:
CONVERSION_EXIT_xxxxx_INPUT : The INPUT module converts from display/input
format to internal/db format
CONVERSION_EXIT_xxxxx_OUTPUT: The OUTPUT module converts the
internal/db format to display format
Step1. Create a DB table with below fields and each field having data element and
domain. Here for our purpose we can proceed with data element and domain for
the field PAR.
Step4. Create the table, activate it. Lets create some records in it.
Step8. Again create a new entry with below values and save it.
Step9. So we have the below records in the DB. In two occasions, we have created
two entries, one with
value 1 & second with value 01. If we observe from the user perspective 1 & 01
both are same, so we can say that there is a db record inconsistencies but form the
DB point of view, as the technical data type for the PAR field is char, the system
treats 1 and 01 in a different way by comparing their ASCII/UNICODE values. So by
this the Unicode value of 1 & 01 are different so these are stored in the DB table as
consistent records. So to overcome this SAP has provided conversion routine
functionality.
The conversion routine is a five character length name which is assigned to the
domain of the field.
Step11. Create a FM with the Name as below: here the Conversion routine name is
ZZPAR.
Step15. Go to the domain of the corresponding field PAR and provide the
conversion routine name as ZZPAR and activate it.
Step21. Now we have the below records with some modified value stored in the DB
which is not exactly same what we have provided in the UI. When we provide some
values while creating a new record and save it the conversion routine
CONVERSION_EXIT_ZZPAR_INPUT triggers which append some zeros.
Step22. Now again try to create a record with below values and save it.
Step23. Here the system throws the error message after the execution of
conversion routine. In this way we can maintain the data consistency in the DB
table.
Step26.
Step27.
Step28.
Step29.
Step31. Just remove the Conversion routine name from the domain and activate it.
Step33. Just create the simple program which displays all the records.
Step34. Now here we can see what are the values are present in the DB that are
displayed in the same way.
Here the user may not be interested to see the leading zeros for the display
purpose as it does no mean any sense. The user is more interested to see 1 rather
than 001.
Step39. Again assign the same Conversion routine to the domain and activate it.
Step40. Again execute the report and we have the required output.
Step41. If you want to skip the conversion routine while displaying the output we
can use the statement using no edit mask for the field PAR in the write
statement and it skips the output conversion routine.