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: 

function module

Former Member
0 Kudos

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

1 REPLY 1

Former Member
0 Kudos

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.