Skip to Content
avatar image
Former Member

No boolean in ABAP?

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 01, 2010 at 07:23 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 01, 2010 at 07:16 PM

    declare:

    type-pools: abap.
    
    data: my_flag type boolean.  "default false.
    
    ......
    my_flag = abap_true.
    
    if my_flag eq abap_true "(or abap_false).

    Add comment
    10|10000 characters needed characters exceeded

    • 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

  • avatar image
    Former Member
    Oct 04, 2010 at 02:36 PM

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

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 02, 2010 at 12:37 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 05, 2010 at 05:02 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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.