Skip to Content

condition

In the if / else condition i want to check whether the field is initial or has a value with Z*

this is the code i've written...

      if l_field = ''.
      l_field = 'VALUE'.
      elseif l_field like 'z*'
      l_field = 'VALUE'.
      endif.

and it's returning error...

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    Aug 17, 2007 at 08:01 PM

    Hi,

    Try this way,

          
    IF l_field EQ SPACE.
        l_field = 'VALUE'.
    "All value starting with Z will be treated.
    ELSEIF l_field(1) EQ 'Z'     " 'Z' Must be in Upper Case 
        l_field = 'VALUE'.
    ENDIF.
    

    Regards.

    Marcelo Ramos

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 17, 2007 at 07:40 PM

    Try this:

    IF L_FIELD IS INITIAL OR L_FIELD+1(1) EQ 'Z'.

    L_FIELD = ' VALUE'.

    ENDIF.

    Thanks,

    SKJ

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 17, 2007 at 07:41 PM

    if l_field = ''.

    l_field = 'VALUE'.

    elseif l_field CP 'z*'

    l_field = 'VALUE'.

    endif.

    use this.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 17, 2007 at 07:42 PM

    Hi,

    Instead of using that logic, use this logic which would serve your purpose

    if l_field = ''.

    l_field = 'VALUE'.

    elseif l_field+0(1) eq 'z'.

    l_field = 'VALUE1'.

    endif.

    Regards,

    Vinod.

    Add comment
    10|10000 characters needed characters exceeded

  • Aug 17, 2007 at 07:43 PM

    Hi,

    Try this way,

          
    IF l_field = SPACE.
        l_field = 'VALUE'.
    ELSEIF l_field(1) = 'Z'     " 'Z' Must be in Upper Case
        l_field = 'VALUE'.
    ENDIF.
    

    Regards.

    Marcelo Ramos

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member VS G

      I guess you can use below logic :

      if l_field = ''.

      l_field = 'VALUE'.

      elseif l_field+0(1) ca 'Z'.

      l_field = 'VALUE'.

      endif.

      since like will not work in if condition

      Thanks

      Seshu