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: 

IF condition not working.

Former Member
0 Kudos

data: C_1300 TYPE GSBER VALUE '1300'.

data: C_1301 TYPE GSBER VALUE '1301'.

IF WA_GL-GSBER ne C_1300 OR WA_GL-GSBER ne C_1301.

IF WA_GL-PARGB ne C_1300 OR WA_GL-PARGB ne C_1301.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

The problem lies in the OR that u r using. It is possible that the condition might be working for NE. So you can replace this OR with AND. Your problem will be solved.

Thanks & Regards

10 REPLIES 10

Former Member
0 Kudos

What is not working ? Does it always return true or false ?

Check the data type of WA_GL-GSBER if it is character then should work.

regards,

Advait

0 Kudos

WA_GL-GSBER is char 4 & c_1300 is char 4.

when both the field values are 1300, its still going inside if condition....

cheers.

santosh.

0 Kudos

Yes, thats right. It works as the way it has to. You have used OR condition. Please check.

0 Kudos

Use

IF WA_GL-GSBER ne C_1300 AND WA_GL-GSBER ne C_1301.

ThomasZloch
Active Contributor
0 Kudos

Just guessing here what the problem is.

If you chain two NE-conditions with an OR, the combined IF condition will always be true.

Thomas

Former Member
0 Kudos

Hi,

Try using this....

IF( ( WA_GL-GSBER ne C_1300 ) OR (WA_GL-GSBER ne C_1301) ) .

Thanks & Regards

Ruchi Tiwari

former_member598013
Active Contributor
0 Kudos

Hi Santosh,

Let me tell you how to solve this problem

Did you check the data declaration of WA_GL-GSBER and WA_GL-PARGB .

I think this value is not declared as character type. or

try it out in this way


IF ((WA_GL-GSBER ne C_1300 OR WA_GL-GSBER ne C_1301) and (IF WA_GL-PARGB ne C_1300 OR WA_GL-PARGB ne C_1301)).
  " <Enter your Logic>
ENDIF.

Thanks,

Chidanand

0 Kudos

hi santosh ,

1)IF WA_GL-GSBER ne C_1300 OR WA_GL-GSBER ne C_1301.

it will go inside the if condition when

either one of the condtion will be true or both .

you are saying that when

WA_GL-GSBER = 1300 .

WA_GL-GSBER = 1300 .

it is going inside the if condtion .....absolutly right ...

because one of the condtion is true at that time (WA_GL-GSBER ne C_1301) .

Thanks and regrds

Priyank dixit

Former Member
0 Kudos

Hi,

The problem lies in the OR that u r using. It is possible that the condition might be working for NE. So you can replace this OR with AND. Your problem will be solved.

Thanks & Regards

Former Member
0 Kudos

THANKS TO EVERRYONE.......