Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

No boolean in ABAP?

Former Member
0 Kudos

Hi,

I am just starting at the tip of the ABAP / SAP iceberg. Any particular reason why the one-bit-length boolean data type not featuring in ABAP?

Thanks.

1 ACCEPTED SOLUTION

Former Member

Apparently no reason, if you don't want to create your own variable to use as boolean you can use type-pools abap and check abap_true and abap_false variable.

Regards,

Felipe

10 REPLIES 10

Former Member

declare:

type-pools: abap.

data: my_flag type boolean.  "default false.

......
my_flag = abap_true.

if my_flag eq abap_true "(or abap_false).

0 Kudos

>

>

type-pools: abap.
> 
> data: my_flag type boolean.  "default false.
> 
>

Any idea, why SAP has different "Definition" of Boolean (X=True, -=False, Space=Unknown) rather than industry standards True and False.

Regards,

Naimesh Patel

0 Kudos

Any idea, why SAP has different "Definition" of Boolean (X=True, -=False, Space=Unknown) rather than industry standards True and False.

Have you ever known SAP to follow a logical development standard used by others? Maybe '-' is the German abbreviation for 'false'.

Personally, I just always use XFELD...

0 Kudos

Any idea, why SAP has different "Definition" of Boolean (X=True, -=False, Space=Unknown) rather than industry standards True and False.

Are 7 bits not any more costly?

Or migth be, for the SAP application, we use the boolean rarely?

Please correct me if I am wrong.

0 Kudos

Have you ever known SAP to follow a logical development standard used by others? Maybe '-' is the German abbreviation for 'false'.

Not always

Personally, I just always use XFELD...

I use XFELD too, because it behaves like a boolean but not a "correct" boolean as per SAP definition....

Regards,

Naimesh Patel

Former Member

Apparently no reason, if you don't want to create your own variable to use as boolean you can use type-pools abap and check abap_true and abap_false variable.

Regards,

Felipe

former_member214857
Contributor
0 Kudos

Hi

Actually ABAP does not support the boolean type, You can use some pre-defined types like Character length 1 to use as boolean.

ABAP_BOOL importing the ABAP TYPE-POOLS.

And to define the true and false ABAP_TRUE and ABAP_FALSE.

Kind regards

Former Member
0 Kudos

That's because we're not really programmers; we just pretend to be one.

Former Member
0 Kudos

Maybe it's just that performance at byte level are not the main target of the programming language.

Still, I don't get it why the '-' char...it's just confusing for those who use to consider space a 'FALSE' boolean.

0 Kudos

In a database table, status flags are traditionally represented as character "X" which resembles a checkmark. I guess that is the origin of ABAP bools.