05-16-2006 8:04 AM
we created a function module to delete the special charecters for a given string and we are using this function module with in the loop. now i want to remove the loop condition with in the function module. i am giving sample code also. it is taking long time because it is with in the loop. how reduce the time. any body can help me in changing the code for the same logic pls.
FUNCTION zspanish_char_conv_new.
*"----
""Local interface:
*" IMPORTING
*" VALUE(I_TEXT)
*" EXPORTING
*" VALUE(E_TEXT)
*"----
DATA : len TYPE i.
DATA: str(99) TYPE c.
DATA: cntr TYPE i.
DATA: val TYPE int1.
DATA:BEGIN OF x,
y TYPE int1,
END OF x.
cntr = 0.
len = strlen( i_text ).
WHILE cntr NE len.
x = i_text+cntr(1).
val = x-y.
IF val >= 128 .
x = ' '.
ENDIF.
i_text+cntr(1) = x.
cntr = cntr + 1.
ENDWHILE.
CONDENSE i_text.
e_text = i_text.
ENDFUNCTION
05-16-2006 8:15 AM
Hi,
Instead of using importing & exporting parameters use
tables.
Logic
loop at the table.
apply logic on individaul line item.
modify table.
enloop.
In return u will get the table with desired result.
as far the code is concern there will be no major change.
u can reusre the entire logic for the conversion
Please mark helpful answers and close the thread if satisfied.
Regards.