Skip to Content

field value

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.

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • author's profile photo
    Former Member
    Posted on Aug 22, 2007 at 04:05 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 22, 2007 at 04:06 PM

    hi,

    loop at itab.

    if itab-line cs '-de'.

    else

    itab-line = 'abc-de'.

    endif.

    modify itab index sy-tabix.

    endloop.

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Posted on Aug 22, 2007 at 04:07 PM
    LOOP AT ITAB.
    IF ITAB-FIELD NE 'abc-de-123'.
    ITAB-FIELD = 'abc-de'.
    MODIFY ITAB.
    ENDIF.
    ENDLOOP.
    

    Greetings,

    Blag.

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 22, 2007 at 04:08 PM

    data: v_string(10).

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

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

    clear v_string.

    v_string = 'abc-de'.

    endif.

    Add comment
    10|10000 characters needed characters exceeded