06-26-2015 8:44 AM
Dear Experts,
I was stunned when I saw, the last executable line in IF stament is getting executed forcefully. You can just copy paste the below code in a report and run.
Data: a type char4,
b type char4.
a = 0020
b = 0050.
if a eq b.
write / 'Majic'.
endif.
If you guys are having some ideas about it, please let me know. I am fully confused.
Thanks in Advance.
06-26-2015 8:52 AM
Hi Kabitirtha,
The compiler is trying to find the end of the if statement. It is not getting executed, if you place an else statement then you can get clear idea.
The arrow mark in debugging denotes that it is getting out of the statement. if you place an else statement, then the arrow in debugging states that it is executed.
With Regards,
Giriesh M
06-26-2015 9:12 AM
Hi,
I see that the program is not displaying any output. Can you place the screen capture of the working code lines?
Regards,
~Athreya
06-26-2015 9:19 AM
Hi,
feels like there is a hidden camera filming some ABAP experts copying the code into SE38 ...
Of course the Code is not executed (and you forgot a dot after "a = 0020").
Regards
Oliver
06-27-2015 6:47 AM
Hi,
it is not a majic, just he has tried to look for a else, he did find, it and there is no another statement, so he has goten ambiguous,
so if you write else, it will be clear
DATA: a TYPE char4,
b TYPE char4.
a = 0020.
b = 0050.
IF a EQ b.
WRITE / 'Majic'.
ELSE.
WRITE ' it is not majic, it is just searching the else statement'.
ENDIF.
Regards
Ibrahim
06-27-2015 6:50 AM
Hi
so if you write also, like this, it works, as I said, just he could not complete , he has nothing to read, so he has gotten ambiguity ,
so hier without else but there is another statement,
DATA: a TYPE char4,
b TYPE char4.
a = 0020.
b = 0050.
IF a EQ b.
WRITE / 'Majic'.
ENDIF.
write : 'Welcome Again' .
Regards
Ibrahim