Dear community, have you ever heard of the "Null-Safe Navigation Operator"? Me not which isn't bad either. I can't know everything, especially when it's fairly new. I came across the term on a blog together with an example like that:
" old syntax
IF lv_object IS NOT INITIAL.
" new syntax
IF lv_object?.
That caught my attention (not because of the
Hungarian notation). I know the "
Safe Navigation Operator" which is available in various programming languages to avoid the "
Pyramid of doom". So some kind of
syntactic sugar.
I was interested in the example because I wouldn't use IS NOT INITIAL on a reference variable. In this case IS BOUND would be my choice. Also, I wouldn't expect ABAP language designers to put a "?." combination at the end of an statement. That looks a bit strange.
After some research: I couldn't find anything about this in the official latest ABAP keyword documentation (
ABAP for Cloud Development). Also, I could not develop a syntactically error-free example on the SAP BTP ABAP Trial Environment.
Either there is an innovation for ABAP coming in the near/far future or the information is ... simply wrong. Who knows the truth?
🙂
Oh, there is another "interesting" example on the mentioned blog that doesn't work for me:
" old syntax
IF lv_condition = 'X'.
" new syntax
IF lv_condition = 'X' ? 'Yes' : 'No'.
Many thanks for reading and stay healthy
Michael