Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Conversion Exit

Former Member
0 Likes
5,977

Hi all,

Can u explain about conversion exit?

Ravi.

5 REPLIES 5
Read only

Former Member
0 Likes
1,196

Hi ravi,

1. From Screen field -


> actual variable field

and vice versa

2. eg.

3. Purchase Order TAble - EKKO

Field is - EBELN

DOMAIN IS EBELN

4. If we want to see purchase order number 5,

we just enter

5

on the selecton screen.

5. But in actual database, it is stored as

0000000005 (nine zeros, 5)

6. If the SQL query is directly fired with only 5,

then we won't get any record.

7. so this automatic conversion,

FOR DISPLAY PURPOSE <----


> FOR SQL PURPOSE

IS DONE AUTOMTICALLY BY

CONVERSION ROUTINES / EXIT.

8. THEY ARE NOTHING BUT RELATED FUNCTION MODULES,

which

take care about the leading Zeroes.

regards,

amit m.

Read only

Former Member
1,196

We use a conversion exit to define a jump to a conversion routine for a column of your output table. As the exit we specify the <conv> part of a function module called CONVERSION_EXIT_ <conv> _OUTPUT .

For example, you can use conversion exit ALPHA (see function module CONVERSION_EXIT_ALPHA_OUTPUT ) to suppress leading zeros of account numbers.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

EXPORTING

input = '00000123'

IMPORTING

OUTPUT = data

.

Dta will contain 123 as output .

The conversion exit is also implemented through WRITE addition USING EDIT MASK

Read only

Former Member
0 Likes
1,196

Hi,

<b>Conversion Routine</b>

Conversion takes place when converting the contents of a screen field from display format to SAP-internal format and vice versa and when outputting with the ABAP statement WRITE, depending on the data type of the field.

If standard conversion is not suitable, it can be overridden by specifying a conversion routine in the underlying domain.

A conversion routine is identified by its five-place name and is stored as a group of two function modules. The function modules have a fixed naming convention. The following function modules are assigned to conversion routine xxxxx:

CONVERSION_EXIT_xxxxx_INPUT

CONVERSION_EXIT_xxxxx_OUTPUT

The INPUT module performs the conversion from display format to internal format. The OUTPUT module performs the conversion from internal format to display format.

If a screen field refers to a domain with a conversion routine, this conversion routine is executed automatically each time an entry is made in this screen field or when values are displayed with this screen field.

With regards,

Rajesh Yadla

Read only

Former Member
0 Likes
1,196

A conversion exit is a called routine that formats the output. An edit mask that begins with == followed by a four-character ID calls a function module that formats the output. That four-character ID is known as a conversion exit, or conversion routine. (Function modules are covered in a subsequent chapter, but, for now, think of a function module as a subroutine within another program.) The name of the function module will be CONVERSION_EXIT_XXXX_OUTPUT, where XXXX is the four-character id that follows ==. For example, write '00001000' using edit mask '==ALPHA' calls the function module CONVERSION_EXIT_ALPHA_OUTPUT. The write statement passes the value first to the function module, which changes it in any desired way and then returns the changed value, and that value is written out. This particular exit (ALPHA) examines the value to determine whether it consists entirely of numbers. If it does, leading zeros are stripped and the number is left-justified. Values containing non-numerics are not changed by ALPHA. SAP supplies about 60 conversion exits for various formatting tasks.

Conversion exits are particularly useful for complex formatting tasks that are needed in more than one program. To illustrate, the conversion exit CUNIT automatically converts the code representing a unit of measure into a description meaningful in the current logon language. For example, within R/3, the code for a crate of materials is KI. (KI is an abbreviation of kiste, the German word for "box.") However, CUNIT converts KI to the English mnemonic CR. Therefore, when logged on in English, write: '1', 'KI' using edit mask '==CUNIT'. writes 1 CR. For a user signed on in German, the output would be 1 KI. Using such a conversion exit enables a standard set of codes stored in the database to be automatically converted to be meaningful to the current logon language whenever output to a report.

Conversion Routines within a Domain

A conversion exit can also be placed into the Convers. Routine field in a domain. The exit is inherited by all fields that use that domain, and will be automatically applied when the value is written out.