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

wrong if statement - system problem??

Former Member
0 Likes
640

Hello,

I have a veeery strange issue: I have a call FM, I exit the FM with sy-subrc = 0.

After the call FM I have the usual

if sy-subrc NE 0.
message...
endif.

Guess what: the message is displayed when sy-subrc = 0.

Edited by moderator because the forum can't cope with < followed by > And put into tags because it looks nicer

Edited by: Matt on Nov 6, 2008 4:18 PM

6 REPLIES 6
Read only

Former Member
0 Likes
616

Are you sure the message displayed is the one inside the exit if?

Post the code exactly how it is in the program inside the code markup

Read only

0 Likes
616

This is the code, nothing special... and yes, I am in debugger and the message inside the if statement is displayed.


REPORT  xxx.

DATA: x TYPE y.

 CALL FUNCTION 'ZZZ'
    EXPORTING
      zz              = X
   EXCEPTIONS
     EX1                    = 1.     
     OTHERS             = 2.
* Here I check in debugger and sy-subrc = 0 !!!
  IF sy-subrc NE 0.
* THIS PART IS EXECUTED!!!
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

Read only

0 Likes
616

check the sy-subrc when the debugger is on the if line, not on the call fucntion line

Read only

0 Likes
616

>

>


>    EXCEPTIONS
>      EX1                    = 1.     
>      OTHERS             = 2.
> 

Please try again - this won't pass a syntax check.

Rob

Read only

0 Likes
616

Belive me, I have checked sy-subrc at every click...

On if line sy-subrc = 0.

@Rob, I have an extra dot, sorry

I just had to modify the data object names and the exception name...

Read only

0 Likes
616

>

> This is the code, nothing special... and yes, I am in debugger and the message inside the if statement is displayed.

>

>


> REPORT  xxx.
> 
> DATA: x TYPE y.
> 
>  CALL FUNCTION 'ZZZ'
>     EXPORTING
>       zz              = X
>    EXCEPTIONS
>      EX1                    = 1.     
>      OTHERS             = 2.
> * Here I check in debugger and sy-subrc = 0 !!!
>   IF sy-subrc NE 0.
> * THIS PART IS EXECUTED!!!
>     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
>             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
>   ENDIF.
> 

Can you post the actual code that you are using.

Having a Function Module called 'ZZZ' appears to be a bit strange to me.

Also a field of type y would not syntax check.

Are you playing with ABAP.

Have you been hiding code.

This is not a straight forward question to me.