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: 

contains not only

Former Member
0 Kudos

Hi,

I have a field with value '----' or '--+'. I want to check the values of the field with:


IF field cn '+-'.
*go on with further process.
ENDIF.

what I want to have is that only values are consider which have not only '+-' as field value.

the problem is that he ignore the cn expression, so if my field has a value of '-' it jumps in the if expression?

Any idea how to solve this problem?

thanks a much.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Not able to understand correctly, what you requirement is, but it appears to be a string evaluation.

Use the following:

IF field cn '+-'.

  • do nothing

else.

*go on with further process.

ENDIF.

If you want specific to '+-' selections, use SEARCH and sy-fdpos as well.

Regards,

Verma

9 REPLIES 9

Former Member
0 Kudos

Not able to understand correctly, what you requirement is, but it appears to be a string evaluation.

Use the following:

IF field cn '+-'.

  • do nothing

else.

*go on with further process.

ENDIF.

If you want specific to '+-' selections, use SEARCH and sy-fdpos as well.

Regards,

Verma

0 Kudos

Hello Santosh,

for better understanding an example:

I have 1 field with several values and an internal table itab:

field = 'abc+'

field = '--'

field = '+'

so when I execute the if expression


if field cn '+-'.
*add field to my internal table.
endif.

so after the 3 fieldvalues in my table I would like to have only a row with value 'abc' as this value not only contains '' or '-'.

0 Kudos

So where is the problem?

field = 'abc+'

Here condition is TRUE, because operand1 contains abc apart from + and -

field = '--'

Here condition is FALSE, as operand1 contains only characters + and -

field = '+'

Here condistion is FALSE too, as operand1 contains only character +

Your condition will pass only first case, so you already have the solution.

Regards

Marcin

0 Kudos

The problem is that he pass all 3 cases so in my table I have all 3 values.

0 Kudos

The problem is that he pass all 3 cases so in my table I have all 3 values.

0 Kudos

You have declared your fieds as character with a length greater than 4 (or 1) and so it is looking at the trailing spaces. Declare your fields as string.

Rob

0 Kudos

Thanks a much Rob, this was the mistake

0 Kudos

Hello Mr.Marcin Pciak I need a small help redarding selection in one zprogram.

So if possible udate your bussiness card with your m id so that i can send you my zprogam.

thanks in advance.

Thanks and regards.

koolspy.

0 Kudos

Koolspy - the forums are not a free consulting service or a school where you can expect individual help. It is a collaborative workspace.

So, if you have a problem, start a new thread.

Rob