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;

BOOLC
  • The function returns a single-character character type string of the type string.
  • The results can be passed to ABAP processing functions expecting character-like arguments of type string such as TRANSLATE or condense or STRLEN.
  • If the logical expression passed is true it returns 'X' otherwise a blank is returned.
  • If the logical expression is false, the result of BOOLC does not meet the condition IS INITIAL since a blank is returned (not an empty string).
  •  Not to be compared against datatype ABAP_BOOL such as constants ABAP_TRUE and ABAP_FALSE.

XSDBOOL: 
  • The function returns a data type C of length 1.
  • The result can be used as a value of the type ABAP_BOOL and compared with the constants ABAP_TRUE and ABAP_FALSE.
  •  Not to be used directly as an input to methods and functions expecting strings as the trailing blanks would be ignored.
  • Not to be compared against data type STRING.
  • The function is only available from ABAP 740 SP08.

Popular posts from this blog

ABAP read excel(.XLSX) file to internal table in ABAP using CL_FDT_XL_SPREADSHEET

ABAP convert internal table to excel (.xlsx) format and Send email or download

Use CL_BCS library to send email with ABAP