‎2006 Jun 10 11:22 AM
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
‎2006 Jun 10 12:19 PM
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.
‎2006 Jun 10 2:46 PM
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.
‎2006 Jun 10 6:43 PM
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.