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_ALPHA_INPUT

Former Member
0 Likes
1,530

Hi,

I have a field in my internal table which i need to pass to FM CONVERSION_EXIT_ALPHA_INPUT before processing that internal table.

The simple method is to loop on the table and call FM each time.

But,the number of entries being Huge, this will hit the performance.

Can this Function module be called as a macro? if yes, then how?

regards

Nishant

3 REPLIES 3
Read only

nishanthbhandar
Contributor
0 Likes
724

Sorry .. But i guess there is no alternative .. The conversion exit routines are system calls.It takes only 1 input at a time.Even writing a macro wont help.

Read only

Former Member
0 Likes
724

Hi Nishant,

You could use FIELD-SYMBOLS here to do a faster conversion. Use it like this:

TYPES:
  BEGIN OF ty_input,
    field1(10) TYPE c,
    field2(10) TYPE c,
  END   OF ty_input.
DATA:
  my_index TYPE syindex,
  wa_input TYPE ty_input,
  it_input TYPE ty_input OCCURS 0.
FIELD-SYMBOLS:
  <fields> TYPE ty_input.
* Test fill structure
DO 20 TIMES.
  my_index = 20 - sy-index.
  WRITE:
    sy-index DECIMALS 0 TO wa_input-field1 LEFT-JUSTIFIED,
    my_index DECIMALS 0 TO wa_input-field2 LEFT-JUSTIFIED.
  APPEND wa_input TO it_input.
ENDDO.
* Faster conversion
* Is directly updated in the internal table
LOOP AT it_input ASSIGNING <fields>.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = <fields>-field1
    IMPORTING
      output = <fields>-field1.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = <fields>-field2
    IMPORTING
      output = <fields>-field2.
ENDLOOP.
* Release symbol
IF <fields> IS ASSIGNED. UNASSIGN <fields>. ENDIF.
* Test output
LOOP AT it_input INTO wa_input.
  WRITE:
    / wa_input-field1,
      wa_input-field2.
ENDLOOP.

Since the FIELD-SYMBOL actually points towards a record, you do not have to add the MODIFY command into the conversion loop. This means a faster way of converting (if no other way is possible).

Regards,

Rob.

Read only

Former Member
0 Likes
724

Hi,

how did the table get populated?

why dont u use conversion exit during the population of that table? if it is populated from a flat file you have to use conversion exit within the loop, there is no other alternative.