Application Development and Automation 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: 
Read only

No boolean in ABAP?

Former Member
0 Likes
38,534

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
Read only

Former Member
12,590

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

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
Read only

Former Member
12,590

declare:

type-pools: abap.

data: my_flag type boolean.  "default false.

......
my_flag = abap_true.

if my_flag eq abap_true "(or abap_false).

Read only

0 Likes
12,590

>

>

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

Read only

0 Likes
12,590

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...

Read only

0 Likes
12,590

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.

Read only

0 Likes
12,590

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

Read only

Former Member
12,591

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

Read only

former_member214857
Contributor
0 Likes
12,590

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

Read only

Former Member
0 Likes
12,590

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

Read only

Former Member
0 Likes
12,590

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.

Read only

0 Likes
12,590

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.