cancel
Showing results for 
Search instead for 
Did you mean: 

field value

sastry_gunturi
Active Participant
0 Kudos

I am checking a field value...

if the field contains abc it has to be changed to abc-de

If the field contains abc-123 it has to be changed by abc-de.

if it contains abc-de-123 then no changes have to be made..

In other words all entries except for entries like abc-de-123 have to be changed to adc-de..

how can i do that.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

data: v_string(10).

check v_string+0(3) = 'abc'.

if v_string <> 'abc-de-123'.

clear v_string.

v_string = 'abc-de'.

endif.

former_member583013
Active Contributor
0 Kudos

LOOP AT ITAB.
IF ITAB-FIELD NE 'abc-de-123'.
ITAB-FIELD = 'abc-de'.
MODIFY ITAB.
ENDIF.
ENDLOOP.

Greetings,

Blag.

sastry_gunturi
Active Participant
0 Kudos

Hi the field may contain anything...

abc-de-146 or abc-56d anything...

if it contains abc-de-xxx no changes have to be done..

if it contains abc-xxxxxx then it has to be changed to abc-de..

former_member583013
Active Contributor
0 Kudos

LOOP AT ITAB.
IF ITAB-FIELD+0(7) NE 'abc-de-'.
ITAB-FIELD = 'abc-de'.
MODIFY ITAB.
ENDIF.
ENDLOOP.

Greetings,

Blag.

Former Member
0 Kudos

hi,

loop at itab.

if itab-line cs '-de'.

else

itab-line = 'abc-de'.

endif.

modify itab index sy-tabix.

endloop.

Former Member
0 Kudos

Hi

Declare 3 strings like

data: str1(3) type c value 'abc',

str2(7) type c value 'abc-123',

str3(11) type c value 'abc-de-123',

field(11).

if ( field CS str1 or field CS str2 ).

field = 'abc-de'.

elseif field CS str3 .

field = field.

endif.

CS = contains String

Reward if useful

regards

Anji