Posts

Showing posts with the label BOOLEAN

Boolean in ABAP

Dealing with two state flags is nothing new and a very common scenario in ABAP development, Historically they have been used to represent a true or false state. For example: Y or N, X or ' ', 0 or 1. Booleans are data objects that store truth values i.e. True or False , which are results of logical expressions. Truth values are the results of logical expressions. A truth value is either true or false. ABAP does not yet support boolean data types and thus does not support data objects for truth values. Therefore, the result of a logical expression cannot be assigned directly to a data object. However, it can be achieved using Boolean functions. It has become common practice to express the truth value "true" as value " X " and the truth value "false" as a blank (" ").  which leads to one of the bad practices still prevalent: Using the Data Type abap_bool for Truth Values The type group ABAP contains a data type abap_bool of elementary type...

ABAP Convert Logical Expressions Into Boolean Values

In my last post on  ways to flip a boolean , I talked about how we can use boolean   functions to flip a boolean by passing a logical expression. I thought I will elaborate further on these. Boolean in ABAP is not that straightforward . However, boolean functions help us capture the results of logical expressions as a form of truth value. Let's dive further;

Ways to flip a Boolean

Whenever working with booleans while writing code there is almost always a scenario where one has to flip the boolean state i.e. true to false or vice-versa based on some condition. In this post, I wanted to showcase different ways to do so. Using Control statements: