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 is not working in script

Former Member
0 Kudos

Hi ,

I have cash discount field in my script. I don't want to print that field ,if the value of that field is 0.

I tried giving the condition as

if &regud-sknto& <> '0'

then print.

endif.

but it is not working.

I tried declaring another variable of same type and made the value as 0.

g_sknto = 0. (type regud-sknto)

if &regud-sknto& <> g_sknto

then print.

endif.

this is also not woking..

what is the problem? i am not able to identify...any help please..

Thanks,

Omkaram.

13 REPLIES 13

former_member181995
Active Contributor
0 Kudos

Use command line:

/: if &regud-sknto& = ' 0 '":/ is must
then print.
endif.

0 Kudos

thanks for reply...

Condition i am giving ....

by mistake i did n't type that one in post..sorry for that

0 Kudos

than check whether its ghaving ur desired value or not .... chck in debugging

or print both the variable before the if condition ... and check those values ...

0 Kudos

I checked both values in debugging....

both the values are correct...still IF condition is failing...

0 Kudos

Try this way

/: IF &REGUD-SKNTO& EQ 0 " 0 without single quotes

P1 then print.

/:ENDIF.

Edited by: Bala Krishna on Sep 19, 2008 2:20 PM

JozsefSzikszai
Active Contributor
0 Kudos

hi,

the condition was missing:

IF &regud-sknto& NE '0'

you can also try this, the (I) will suppress the initial value:

&regud-sknto(I)&

hope this helps

ec

Former Member
0 Kudos

hi ,

If works in script ....

in ur code u r missing operator .... is it same in ur code ... if it is so it ll not work ....

Former Member
0 Kudos

Hi,

Give the condition Uperators like-

= EQ ,< LT,> GT,<= LE ,>= GE, NE, etc

satsrockford
Active Participant
0 Kudos

hi

giv operators in ur code

former_member480923
Active Contributor
0 Kudos

Use the Following logic:

IF &regud-sknto(I)&  NE '0'

** DO ur processing

ENID.

Hope That Helps

Anirban M.

Former Member
0 Kudos

Hi Omkaram,

Why are u not putting "=" in script

Use this code in script

if &regud-sknto& EQ '0'

then print.

endif.

Hope this helps!

Regards,

Prashant

Former Member
0 Kudos

Hi ..

Firstly try in this way once..

/: if not &regud-sknto& is initial.

D then print.

/: endif.

Have u tried using Perform and Endform,,

*WRite In Script

/: PERFORM Print_Val ZPROGRAM USING &regud-sknto&

/: CHANGING &V_SKNTO&

/: ENDPERFORM

*In ZPROGRAM

FORM Print_Val tbl_input structure itcsy "structure

tbl_output structure itcsy.

data: V_SKNTO type REGUD-SKNTO.

  • Get Value from Script

read table tbl_input with key 'REGUD-SKNTO'.

check sy-subrc = 0.

v_sknto = tbl_input-value.

*check how its getting read in debugging mode.

if not v_skno initial.

tbl_output-value = v_sknto.

modify tbl_output.

else.

clear v_sknto.

endif.

ENDFORM.

Edited by: Suneel Kumar Gopisetty on Sep 19, 2008 5:04 PM

Former Member
0 Kudos

Hi Omkaram,

check your code as i think this code should work fine and hope you are doing it in main window:

/:    IF &REGUD-SKNTO& EQ '0'
P1  &REGUD-SKNTO&
/:    ENDIF

With luck,

Pritam.