You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The operators CP and NP can be replaced by the predicate function contains and a suitable regular expression. The differences in case handling must also be respected here. Generally, a simple mapping like in CS and NS is not possible, but is also not usually required.
Just my opinion, but I find the relational operators far shorter and readable, as is obvious from the list above. Yes, they're not common in other languages but are not hard to learn. Consider a real-world usage:
IFcontains_any_of( val =sy-msgty sub ='AEX' ).
vs.
IFsy-msgtyCA'AEX'.
String predicate functions are one of the few new ABAP features I have not fully embraced, I just find them awkward and only use them if a functional position is really required.
If we want to compare to other languages, we can add JS to the example above:
IF sy-msgty CA 'AEX'.
if(msgty.match(/(A|E|X)/))
IF contains_any_of( val = sy-msgty sub = 'AEX' ).
I am not aware this is in the style guides either. As I said this is just my opinion though, perhaps some may find it useful but I would likely disable this check. I just can't see any benefit to limiting the use of relational operators.
How about a new check to convert a relational operator to a predicate function?
Source: https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abencontains_functions.htm
Most of the non-ABAP developers do not understand the ABAP-specific relational operators.
The text was updated successfully, but these errors were encountered: