Conversion Exit in sap abap



Comments



Description

Introduction: Conversion takes place when converting the contents of a screen field from display format to SAP-internalformat 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. Let‟ say there is a date field and we want to display the date field 20121203 as 12/2012. Here are the steps how this can be achieved. Steps: 1. Assume that we have created domain for the date field ZCRDAT and we need to assign the custom conversion routine to this particular domain. 4. Click continue. Go to the transaction code SE37. short text and click save. Enter the function group. enter the function module name CONVERSION_EXIT_ZDATE_INPUT and click create. 3. Below screen will appear. Below screen will appear.2. . 6. 7. Enter the import parameter INPUT. Save and activate the function module.5. Similarly. create the function module CONVERSION_EXIT_ZDATE_OUTPUT. 8. Go to export tab and enter export parameter OUTPUT as below. . Enter the INPUT import parameter.9. Enter the function group. 11. short text and click save. Below pop up will appear. . 10. 13. Enter the OUTPUT export parameter.12. . enter appropriate code here and activate the function module. Now go to the source code tab. . 16. Now go to the transaction SE11. If you double click on conversion routine ZDATE. enter domain name and click on “Change” button. as below. it will present you with two FM‟s.14. 15. Enter the conversion routine ZDATE and activate the domain. we created earlier. . Go to Settings->User Parameters.Output: Go to the table contents. . as below.Check the conversion exits check box. The table contents would look like: . we can create custom conversion routine and assign it to the domain.So this way. . REPORT ZFIELDCONV. field conversion exit". The OUTPUT routine performs the conversion from internal format to display format. Double click the conversion routine. In SE16. when we key in order no. You will see its conversion routine. Other commonly used conversion routine is ALPHA. it will delete leading zero. The result comes from conversion routine of its domain. you got at least two conversion routine conversion routine input & output. to toggle format. the result will be "OR". . For example. named AUART. It is conversion used to insert leading zero for document number. go to Setting->User Parameter. The INPUT routine performs the conversion from display format to internal format. In SE11 open table VBAK. conversion routine input will automatically add leading zero. then double click to open domain AUART. in sales order (VBAK-VBELN length 10). On conversion routine output. WRITE d_auart. "TA"? No. in tab strip "Data browser" choose "format. Take attention when we hard code value as a condition value in "WHERE condition". for example we key in '4302'. They are function module. you must convert its value into internal format. d_auart = 'TA'. you can test them in SE37. in display list. find field AUART. so it will become '0000004302'. data: d_auart LIKE vbak-auart.Write this simple code. we can view the data wheather in internal format or display format. double click to go to data element AUART. this is real value stored in table VBAK. What the result output on screen do you expect. 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. If you test the BAPI using a transaction SE37 then an automatic conversion takes place and you can pass the screen values. The conversion routine associated with the domain also triggers when outputting the data on the screen with the WRITE statement. So when you enter values on the screen. Similarly. With the USING NO EDIT MASK addition in the WRITE statement. Please note that this happens only when you are trying to pass the values for your code. The function modules have a fixed naming convention.Conversion Routines in SAP CONVERSION ROUTINES are also called as CONVERSION EXITS. . and save the values the conversion exit is triggered. you can skip a conversion routine defined for a domain when outputting. 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. 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. Similarly for Partner functions like Sold-to Party the value is (SP) and for Ship-to Party it is (SH). These values are stored differently internally. These are basically the screen values. Also in some scenarios for custom development you may have to write your own conversion routines. This is basically the CONVERSION ROUTINE. while displaying the values on the screen another conversion routine gets triggered. Conversion routines are identified by a five-place name and are stored as a group of two function modules. This can be easily seen while creating a sales order using a BAPI. We will now see the way of finding the conversion routines in SAP. 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. In some cases SAP displays values differently then they the way they are stored. 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. KNVP. Run transaction SE11 give the table name eg. KNVP-PARVW. . Once the table fields are displayed double click on the filed for which you need to find the conversion exit eg. 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. ROLLBACK WORK. SUBMIT. MESSAGE W) are not allowed in conversion routines. COMMIT WORK. MESSAGE I. CALL TRANSACTION. CALL DIALOG. 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. The conversion exit function modules have 2 Parameters one for INPUT and the other for OUTPUT. ABAP statements that result in an interruption of processing (such as CALL SCREEN.
Copyright © 2024 DOKUMEN.SITE Inc.