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~ ELSEIF~ ENDIF Statement doesn't works.

Former Member
0 Kudos

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

Former Member
0 Kudos

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

5 REPLIES 5

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Kyung

I tried the same thing. Its working fine.

Can you put the code here.

Regards

Naresh

Former Member
0 Kudos

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

0 Kudos

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