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

IF~ ELSEIF~ ENDIF Statement doesn't works.

Former Member
0 Likes
2,598

Hi~ gurus...

Let me ask someting. something funny and weird.

I used 'if~ elseif~ endif' statement, in my code(abap).

Like this,

if ....
elseif ....
elseif ...
....X 24times.
endif.

Is there any limit usage of 'elseif' satement? I used elseif statement 24 times.

however, it only works 18th elseif statement, from 19th 'elseif' it doesn't works(the flow goes endif.)

Is it a bug ? or is there any limit usage of elseif?

I couldn't find any help file.

Thanks in advance for your reply.

Best Regards

Kyung Woo.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,662

or you sure it did not get caught into your 18th elseif?

I mean, are you saying that 18th elseif was actually false still it didn't reach the 19th elseif?

Cheers,

Ram

Hi~ gurus...

Let me ask someting. something funny and weird.

I used 'if~ elseif~ endif' statement, in my code(abap).

Like this,

if ....
elseif ....
elseif ...
....X 24times.
endif.

Is there any limit usage of 'elseif' satement? I used elseif statement 24 times.

however, it only works 18th elseif statement, from 19th 'elseif' it doesn't works(the flow goes endif.)

Is it a bug ? or is there any limit usage of elseif?

I couldn't find any help file.

Thanks in advance for your reply.

Best Regards

Kyung Woo.

5 REPLIES 5
Read only

Former Member
0 Likes
1,663

or you sure it did not get caught into your 18th elseif?

I mean, are you saying that 18th elseif was actually false still it didn't reach the 19th elseif?

Cheers,

Ram

Read only

Former Member
0 Likes
1,662

Hi, replace the IF ELES with CASE WHEN, as there is so many if steps, using a case replace it looks better.

Read only

Former Member
0 Likes
1,662

Hi Kyung

I tried the same thing. Its working fine.

Can you put the code here.

Regards

Naresh

Read only

Former Member
0 Likes
1,662

hi,

i dont think there is any such limitation on placing the number of if...elseif statements. the only problem could be with memory limitations depending on your hardware configurations.....(even that should not be a problem with just 18 elseif's.

try and debug carefully....

regards,

PJ

Read only

0 Likes
1,662

Hi Kyung,

There is a limit of code size between IF and ENDIF.

IF-statement can only jump 32KB of byte code. So effectively, the source code between the IF- and ENDIF-statements, when compiled, must not be more than 32KB of byte code. You should use case statement instead.

Hope it helps.

Regards,

Narinder Singh