Wednesday, March 26, 2008: Conversion Routines in SAP

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

VOFM is the transaction where you can maintain Requirement routines, which are assigned

through cusomization.

To create a routine you need access key & routine no. starts with "9".for ex. 901,902 etc.
one important thing to note that even if you have some syntax errors inside your routine, it will get
activated without errors. So, you need to do Main Program check before activation

How to add a routine number in transaction VOFM

To Create a routine in Transaction VOFM, follow these steps to create routine: You must need the Access
Key to create a routines in this transaction because this will have a overall effect on the standard
transaction related to deliveries.

1. VOFM->Data Transfer->Deliveries
2. in Routine Number enter number say 802 (For example)
3. Enter Description
4. Double click on routine number, it will ask for access key, provide access key, then it will create include
for the routines specified (for 802)
5. Copy and paste your code in the form created automatically in the include program and activate
6. go back -> then select the routines number say 802, go to Edit tab-> Activate, this will activate the
routine number created
7. Now your routines will be created, tell the functional owner to assign this routines with the requirement

Wednesday, March 26, 2008


Conversion Routines in SAP
Conversion Routines in SAP
CONVERSION ROUTINES are also called as CONVERSION EXITS.

In some cases SAP displays values differently then they the way they are stored.

For example while creating a Sales order the input value for the filed Order Type VBAK-AUART is
actually 'OR' that is on the screen. Similarly for Partner functions like Sold-to Party the value is (SP) and
for Ship-to Party it is (SH). These are basically the screen values. These values are stored differently
internally.

This can be easily seen while creating a sales order using a BAPI.

If you use the BAPI ‘BAPI_SALESORDER_CREATEFROMDAT1’ and try to pass ‘OR’ for the field
VBAK-AUART ie order type or pass SP and SH to Sold-to Party and Ship-to party respectively then you
will get an error message. Please note that this happens only when you are trying to pass the values for
your code. If you test the BAPI using a transaction SE37 then an automatic conversion takes place and
you can pass the screen values. This is basically the CONVERSION ROUTINE. We will now see the way
of finding the conversion routines in SAP. Also in some scenarios for custom development you may have
to write your own conversion routines.

Conversion routines are identified by a five-place name and are 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 conversion routine is usually associated with a Domain for that field. So when you enter values on
the screen, and save the values the conversion exit is triggered. Similarly, while displaying the values on
the screen another conversion routine gets triggered. The conversion routine associated with the domain
also triggers when outputting the data on the screen with the WRITE statement.

A conversion routine can also be triggered by specifying its five-place name in the attributes of a field in
the Screen Painter or with the addition USING EDIT MASK <Name of conversion routine> in the WRITE
command in the program. With the USING NO EDIT MASK addition in the WRITE statement, you can
skip a conversion routine defined for a domain when outputting.

As mentioned earlier for every field that needs conversion there will be 2 conversion routines. For
example for the Partner Function filed KNVP-PARVW there are 2 conversion routines associated with it
namely

CONVERSION_EXIT_PARVW_INPUT
CONVERSION_EXIT_PARVW_OUTPUT

One of the ways to find a conversion routine is as follows.

Run transaction SE11 give the table name eg. KNVP.

Once the table fields are displayed double click on the filed for which you need to find the conversion exit
eg. KNVP-PARVW.
Once the data element is displayed double click on the data-element to display the domain.
You will find the Conversion Exit under output characteristics double click on the conversion exit to
display the function modules.

The conversion exit function modules have 2 Parameters one for INPUT and the other for OUTPUT. The
INPUT parameter in the INPUT conversion and the OUTPUT parameter in the OUTPUT conversion
should not have any reference fields because the value passed in the call could have a different length
than that expected.

ABAP statements that result in an interruption of processing (such as CALL SCREEN, CALL DIALOG,
CALL TRANSACTION, SUBMIT, COMMIT WORK, ROLLBACK WORK, MESSAGE I, MESSAGE W) are
not allowed in conversion routines

You might also like