Application Development and Automation 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: 
Read only

How to write this syntax

Former Member
0 Likes
731

shall i write my code like below

IF it_bseg-menge EQ 0.

...

ELSE.

...

Endif.

OR

IF NOT it_bseg-menge is INITIAL.

...

ELSE.

...

Endif.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
710

checking if not is initial gives better result.

6 REPLIES 6
Read only

Former Member
0 Likes
710

Either will work.

Read only

Former Member
0 Likes
711

checking if not is initial gives better result.

Read only

Former Member
0 Likes
710

Sam,

it_bseg-menge = 0 is better than it_bseg-menge eq 0.

-Anu

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
710

I think it is a preference here, in my case, I think it is more readable to use....

if it_bseg-menge = 0.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
710

hi,

It is better to use this way ..

i.e,


IF it_bseg-menge <b>=</b> 0.
...
ELSE.
...
Endif.

Regards,

Santosh

Read only

Former Member
0 Likes
710

Hi,

use below logic

if else is more readable and easy to undestantd the logic w.r.t to if not statement

.

IF it_bseg-menge = 0.

(use = operator to comapare

numeric fields and eq for character fields)

...

ELSE.

...

Endif

Regards

amole