Reputation: 212
While I was selecting a unit from a database table I noticed, via transaction SE16N
, that there are two different values for the same field. An unconverted and a converted value. With my SELECT
statement, I receive the unconverted one. Do I need to convert this value in order to continue working with it?
Upvotes: 2
Views: 5883
Reputation: 13628
First of all, it's probably worth explaining what is the concept of "converted value" and "unconverted value" (what is better known as "external value" and "internal value").
Internal values are the actual values used by the programs and stored in the database, and the external values are only calculated at the time of the display, on screen, printout, and so on.
It's very practical to see a meaningful code, as Legxis explained, for the internal value of the unit of measure "ST
" (a unit of measure which indicates that the number is a number of pieces, an English user would prefer to see PCS
(English word "pieces"), while a German user would prefer to see ST
(German word "Stücks").
The conversion algorithm is defined at the DDIC domain level (transaction code SE11
) via the "conversion routine" field, a 5-character code which defines the conversion function modules which are called automatically at display time. For instance, the Unit of measure is related to the domain MEINS
, which has the routine CUNIT
which corresponds to the function modules CONVERSION_EXIT_CUNIT_INPUT
and CONVERSION_EXIT_CUNIT_OUTPUT
.
CONVERSION_EXIT_CUNIT_INPUT
does the conversion from the external value (displayed) to the internal value (program and database)CONVERSION_EXIT_CUNIT_OUTPUT
does the conversion from the internal value (program and database) to the external value (displayed)These function modules are automatically called in SAP rendering technologies like SAP GUI, SAPscript, Smart Form, SAP Adobe form, BSP, Web Dynpro, etc. The "OUTPUT" function module is also called if you call the ABAP statement WRITE
.
Note that the "output length" defined for a DDIC domain may be of some importance, because one may define an output length (displayed) larger than the internal length. For instance, the language code is stored internally on one character but displayed on two characters. For instance, in English, the language code "V" (Sweden) is displayed "SW" (Sweden), and the language code "S" (Spain) is displayed "SP" (Spain).
Finally, if you understand well the concept, you should conclude that you usually don't need to convert anything yourself. It can be useful only if you want to define an interface which is not one of the SAP supported technologies mentioned above.
Upvotes: 5
Reputation: 1849
The table rows you SELECT
in ABAP do only contain the unconverted values. Use these to e.g. JOIN
with other tables or call methods/function modules. Conversion is only relevant when displaying the data.
By the way: Nonetheless these conversions with "good intentions" can cause problems. Values with type NUMC
(numeric characters) for example are often trimmed/stripped during conversion when they have leading zeros. But some function modules do not work when these leading zeros are missing.
Upvotes: 2