Application Development 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: 

IDOC - Field conversion

Former Member
0 Kudos

Hi All,

I have created IDOC conversion rules for customer master data under segment E1KNA1M in BD79.

One of the conversion rule is to add a "P" in front of the customer numbers in the target client. For example - source client: cust num = 1234567, target client: cust num = P1234567

How do I add this conversion rule? Which rule type should I use?

Appreciate any help!

Thanks,

Charlene

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Charlene,

You can create a new conversion routine and associate it to the field kunnr.

For example, to create conversion routine ZEDG, create the following functions:


FUNCTION conversion_exit_zedga_input.
*"----------------------------------------------------------------------
*"*"Interface local:
*"  IMPORTING
*"     REFERENCE(INPUT) TYPE  KUNNR
*"  EXPORTING
*"     REFERENCE(OUTPUT) TYPE  KUNNR
*"----------------------------------------------------------------------

  DATA: l_input TYPE kunnr.

  l_input = input.
  replace 'P' in l_input WITH '0'.

  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = l_input
    IMPORTING
      output = output.

ENDFUNCTION.


FUNCTION conversion_exit_zedga_output.
*"----------------------------------------------------------------------
*"*"Interface local:
*"  IMPORTING
*"     REFERENCE(INPUT) TYPE  KUNNR
*"  EXPORTING
*"     REFERENCE(OUTPUT) TYPE  KUNNR
*"----------------------------------------------------------------------

  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
    EXPORTING
      input  = input
    IMPORTING
      output = output.
  
  CONCATENATE 'P' output INTO output.

ENDFUNCTION.

3 REPLIES 3

Former Member
0 Kudos

anybody able to help me out on this?

Former Member
0 Kudos

Hi Charlene,

You can create a new conversion routine and associate it to the field kunnr.

For example, to create conversion routine ZEDG, create the following functions:


FUNCTION conversion_exit_zedga_input.
*"----------------------------------------------------------------------
*"*"Interface local:
*"  IMPORTING
*"     REFERENCE(INPUT) TYPE  KUNNR
*"  EXPORTING
*"     REFERENCE(OUTPUT) TYPE  KUNNR
*"----------------------------------------------------------------------

  DATA: l_input TYPE kunnr.

  l_input = input.
  replace 'P' in l_input WITH '0'.

  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = l_input
    IMPORTING
      output = output.

ENDFUNCTION.


FUNCTION conversion_exit_zedga_output.
*"----------------------------------------------------------------------
*"*"Interface local:
*"  IMPORTING
*"     REFERENCE(INPUT) TYPE  KUNNR
*"  EXPORTING
*"     REFERENCE(OUTPUT) TYPE  KUNNR
*"----------------------------------------------------------------------

  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
    EXPORTING
      input  = input
    IMPORTING
      output = output.
  
  CONCATENATE 'P' output INTO output.

ENDFUNCTION.

0 Kudos

oh, parameters input and output should not have a type, they should be generic.