Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

function module

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

Tags:
Not what you were looking for? View more on this topic or Ask a question