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

What's wrong with the if-statement

Former Member
0 Likes
529

the last else-branch is not executed... why?

                if wa_not_existing_values-node_value(4) = co_area and wa_not_existing_values-node_value(5) <> str_cctr_chr.
                  str_cctr = wa_not_existing_values-node_value+4.
                elseif  strlen( wa_not_existing_values-node_value ) >= 5.
                    if wa_not_existing_values-node_value(5) = str_cctr_chr.
                        str_cctr = wa_not_existing_values-node_value+5.
                    endif.    
                else.
                  str_cctr = wa_not_existing_values-node_value.
                endif.

the last else-branch is not executed... why?

                if wa_not_existing_values-node_value(4) = co_area and wa_not_existing_values-node_value(5) <> str_cctr_chr.
                  str_cctr = wa_not_existing_values-node_value+4.
                elseif  strlen( wa_not_existing_values-node_value ) >= 5.
                    if wa_not_existing_values-node_value(5) = str_cctr_chr.
                        str_cctr = wa_not_existing_values-node_value+5.
                    endif.    
                else.
                  str_cctr = wa_not_existing_values-node_value.
                endif.

3 REPLIES 3
Read only

Former Member
0 Likes
476

if wa_not_existing_values-node_value(4) = co_area and wa_not_existing_values-node_value(5) <> str_cctr_chr.

str_cctr = wa_not_existing_values-node_value+4.

elseif strlen( wa_not_existing_values-node_value ) >= 5.

if wa_not_existing_values-node_value(5) = str_cctr_chr.

str_cctr = wa_not_existing_values-node_value+5.

endif.

else.

str_cctr = wa_not_existing_values-node_value.

endif.

The else would be executed only if the if and elseif condition fails....is that case ? if so can you cut-paste the data for the corresponding values.

Read only

Former Member
0 Likes
476

Hi,

elseif strlen( wa_not_existing_values-node_value ) >= 5.

if this condition is true then u cant expect else to trigger ..

just change the value in the debugging and see if it goes to else or not ..

regards,

VIjay

Read only

Former Member
0 Likes
476

hi,

if wa_not_existing_values-node_value(4) = co_area and

wa_not_existing_values-node_value(5) <> str_cctr_chr.

if this condition is satisfied then,

str_cctr = wa_not_existing_values-node_value+4.

will be executed and control comes out of if statement.

if the above condition is not satisfied then the control comes to below statement

elseif strlen( wa_not_existing_values-node_value ) >= 5.

if this condition is satisfied then the below condition is checked

if wa_not_existing_values-node_value(5) = str_cctr_chr.

if this condition is satisfied then, the below statement gets executed and control comes out of if statement

str_cctr = wa_not_existing_values-node_value+5.

if the condition wa_not_existing_values-node_value(5) = str_cctr_chr. is not satisfied then the below statement gets executed

str_cctr = wa_not_existing_values-node_value.

so when , wa_not_existing_values-node_value(4) = co_area and wa_not_existing_values-node_value(5) <> str_cctr_chr

and strlen( wa_not_existing_values-node_value ) >= 5.

are false then then the control comes to else statement which u require

regards,

Sreekanth