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: 

condition

sastry_gunturi
Active Participant
0 Kudos

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...

1 ACCEPTED SOLUTION

marcelo_ramos
Active Contributor
0 Kudos

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

8 REPLIES 8

Former Member
0 Kudos

Try this:

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

L_FIELD = ' VALUE'.

ENDIF.

Thanks,

SKJ

Former Member
0 Kudos

if l_field = ''.

l_field = 'VALUE'.

elseif l_field CP 'z*'

l_field = 'VALUE'.

endif.

use this.

Former Member
0 Kudos

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.

marcelo_ramos
Active Contributor
0 Kudos

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

0 Kudos

Z

  • here means any thing value Z like ZVALUE, ZINSERT and ZMODIFY.....

0 Kudos

yeah karthik..

The logic given by me would help u in finding out all the objects starting with 'Z" like ZTBALE, ZELEMENT, etc etc

0 Kudos

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

marcelo_ramos
Active Contributor
0 Kudos

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