Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[ABAP] xsdbool

Somehow I always forget that there is a boolean function in ABAP. That’s why I’m writing this post to hopefully remember it better. 🙂

If you just want to check something for truthiness, you can do it in the following three ways:

IF sy-subrc = 0.
  result = abap_true.
ELSE.
  result = abap_false.
ENDIF.
result = SWITCH #( sy-subrc WHEN 0 THEN abap_true
                                   ELSE abap_false ).
result = xsdbool( sy-subrc = 0 )