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

how to use conversion routine?

Former Member
0 Likes
8,582

hi,

in my z-table i have a field called matnr for the material number say.

its domain defines it as 18 char.

say i have created an entry say 200.

so it will be saved may be as 000000000000000200.

i want it should be displayed with as 200.

and if i search for say 200.

so it should not look for the proceeding zero's.

it should not give me an error that record doesn't exists.

please tell me how to use exaclty conversion routine.

thanks

ekta

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,808

Hi,

A conversion routine conv is represented by two function modules that adhere to the naming convention CONVERSION_EXIT_conv_INPUT|OUTPUT. In these function modules, no statements can be executed that interrupt the program flow or end a SAP LUW. A conversion routine can be assigned to a domain in the ABAP Dictionary. If a screen field refers to a domain with a conversion routine, the system automatically executes the function module ..._INPUT for every input in the relevant screen field and the function module ..._OUTPUT when values are displayed in this screen field and uses the converted content in each case. If a data object refers to such a domain, the function module ..._OUTPUT is executed for the output of the data object in a list and the converted content is displayed.

Regards

Hi,

A conversion routine conv is represented by two function modules that adhere to the naming convention CONVERSION_EXIT_conv_INPUT|OUTPUT. In these function modules, no statements can be executed that interrupt the program flow or end a SAP LUW. A conversion routine can be assigned to a domain in the ABAP Dictionary. If a screen field refers to a domain with a conversion routine, the system automatically executes the function module ..._INPUT for every input in the relevant screen field and the function module ..._OUTPUT when values are displayed in this screen field and uses the converted content in each case. If a data object refers to such a domain, the function module ..._OUTPUT is executed for the output of the data object in a list and the converted content is displayed.

Regards

9 REPLIES 9
Read only

Former Member
0 Likes
3,808

hi

use the conv routine CONVERSION_EXIT_MATN1_OUTPUT



CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'
      EXPORTING
        input         = matnr
    IMPORTING
             OUTPUT        = matnr
              .

Regards

Ravish Garg

<b>

Reward if useful</b>

Message was edited by:

Ravish Garg

Read only

0 Likes
3,808

HI

still my doubt persists, please help me in this context.

it is not showing the selcted value.

thanks

Read only

0 Likes
3,808

Hi Ekta

Just pass the name of your variable in the Import and export parameters, your problem will be solved.

Else paste your code here.

Regards

Ravish

Read only

Former Member
0 Likes
3,808

hi,

use the FM CONVERSION_EXIT_MATN1_INPUT or UNPACK statement...

Use the standard domain Matnr...in your Z-table

Message was edited by:

Krishnan Murthy

Read only

Former Member
0 Likes
3,809

Hi,

A conversion routine conv is represented by two function modules that adhere to the naming convention CONVERSION_EXIT_conv_INPUT|OUTPUT. In these function modules, no statements can be executed that interrupt the program flow or end a SAP LUW. A conversion routine can be assigned to a domain in the ABAP Dictionary. If a screen field refers to a domain with a conversion routine, the system automatically executes the function module ..._INPUT for every input in the relevant screen field and the function module ..._OUTPUT when values are displayed in this screen field and uses the converted content in each case. If a data object refers to such a domain, the function module ..._OUTPUT is executed for the output of the data object in a list and the converted content is displayed.

Regards

Read only

Former Member
0 Likes
3,808

Hi Ekta,

You should use conversion exit alpha input for the situation described by you. Try below code


REPORT  ZGS_TEST9.
 PARAMETERS P_matnr type matnr.


 CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
   EXPORTING
     input         = P_matnr
  IMPORTING
    OUTPUT        = P_matnr
           .

Reward points if useful,

Aleem.

Read only

varma_narayana
Active Contributor
0 Likes
3,808

Hi Ekta..

Paste Your code and the probelm.. Then it can be solved..

regards..

Read only

Former Member
0 Likes
3,808

hi,

data zmatnr type mara-matnr value '00000000000000020'.

CALL FUNCTION 'CONVERSION_EXIT_MATN1_OUTPUT'

EXPORTING

INPUT = zmatnr

IMPORTING

OUTPUT = zmatnr

.

write zmatnr.

output is 20.

rgds.

Read only

Former Member
0 Likes
3,808

hi all,

the problem has been solved.

CONVERSION_EXIT_MATN1_OUTPUT this FM module can only be used where the z-table has matnr of the type MATNR the standard matnr of the table mara.

so in my program it was not working.

my data element was not matnr.

i had used a popup for position finder.

so it could not read the material number which had zeros as prefixes.

thanks for all the help

thanks

ekta

below the code is mentioned...................

*******************************C O D E*******************************************

WHEN '&POS'.

popup_title = 'Choose The Material Number'.

CLEAR it_fields.

it_fields-tabname = 'Z10ET_TAB_MAT01'.

it_fields-fieldname = 'MATNR'.

it_fields-field_attr = ' '.

it_fields-field_obl = 'X'.

APPEND it_fields.

CALL FUNCTION 'POPUP_GET_VALUES'

EXPORTING

no_value_check = 'X'

popup_title = popup_title

start_column = '5'

start_row = '5'

IMPORTING

returncode = returncode

TABLES

fields = it_fields

EXCEPTIONS

error_in_fields = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

IF returncode = ' '.

MESSAGE i036 WITH it_fields-value.

SORT it_material_data BY matnr.

READ TABLE it_material_data INTO wa_material_data

WITH KEY matnr = it_fields-value.

IF sy-subrc = 0.

tab_ctrl1-top_line = sy-tabix.

REFRESH it_fields.

CLEAR returncode.

CLEAR ok_code_0101.

ELSE.

CONCATENATE concat it_fields-value INTO v_matnr.

READ TABLE it_material_data INTO wa_material_data

WITH KEY matnr = v_matnr.

IF sy-subrc = 0.

tab_ctrl1-top_line = sy-tabix.

REFRESH it_fields.

CLEAR returncode.

CLEAR ok_code_0101.

ELSE.

MESSAGE i037 WITH it_fields-value.

REFRESH it_fields.

CLEAR returncode.

CLEAR ok_code_0101.

ENDIF.

ENDIF.

ENDIF.