cancel
Showing results for 
Search instead for 
Did you mean: 

abap program

Former Member
0 Kudos

Hi

this programme functioned, but it deleted only the first characteristic forbidden and I want deleted all characteristic forbidden.

I do not know how to calculate the length of the word and make a loop to delete all characteristic forbidden.

*******************************************************************************

DATA : INT_VAR TYPE /BIC/OIMATER.

DATA : VAR2 TYPE I.

DATA : VAR3 TYPE I.

DATA : STR_VAR1(20) TYPE C.

DATA : VAR4 TYPE I.

DATA : STR_VAR6(20) TYPE C.

clear INT_VAR.

clear VAR2.

clear VAR3.

clear STR_VAR1.

clear VAR4.

clear STR_VAR6.

MOVE SOURCE_FIELDS-/BIC/MATER TO INT_VAR.

TRANSLATE INT_VAR TO UPPER CASE .

IF INT_VAR CN

',<>?/\:;"''ABCDEFGHI JKLMNOPQRSTUVWXYZ!%^&*()__+=1234567890'.

VAR2 = STRLEN( INT_VAR ).

VAR3 = SY-FDPOS + 1.

VAR4 = VAR2 - VAR3.

STR_VAR6 = INT_VAR+VAR3(VAR4).

CONCATENATE STR_VAR1 STR_VAR6 INTO RESULT.

ELSE.

RESULT = INT_VAR.

ENDIF.

*******************************************************************************

best regard

francoise

Accepted Solutions (1)

Accepted Solutions (1)

former_member186445
Active Contributor
0 Kudos

try this...(adapt according to the chars you need to replace)

data:

w_str type string value '!@#$%^&*()asfdfagfh'.

w_count type i,

w_len type i,

w_off type i.

w_len = strlen( w_str ).

do w_len times.

w_char = w_str+w_off(1).

if w_char CA '!@#$%^&*()_+{}[]?/><'.

replace w_char with space into w_str.

endif.

add 1 to w_off.

condense w_str no-gaps.

enddo.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Try using



REPLACE 
ALL OCCURRENCES OF ' -'  IN w_var  WITH ''. 
condense w_var no-gaps.

-Vikram

Former Member
0 Kudos

Hi

I know about the SCP_REPLACE_STRANGE_CHARS function module.. but it replaced by "L"

francoise