title: Preferred Boolean type for ABAP Development
body: <p>SAP doesn't have a core Data Type for boolean values. Additionally, higher level boolean types in SAP typically have three states: true ('X'), false (' ') and unknown ('-').</p>
  
  <p>Now obviously booleans are a cornerstone of a lot of my development work but I realised that I haven't been terribly consistent in my type (data element) usage. So far I believe these are the most common:</p>
  
  <ul>
  <li><code>abap_bool</code>: defined in the abap type-pool, unconstrained but constants are defined for true, false, unknown, yes and no</li>
  <li><code>os_boolean</code>: data element, Yes ('X') or No (' ')</li>
  <li><code>xfeld</code>: data element, True ('X') or False (' '), lacks a field label, described as a checkbox</li>
  </ul>
  
  <p>In my code I've mainly used <code>abap_bool</code> as I can then work with constants instead of character values, not that I couldn't assign <code>abap_true</code> to an <code>xfeld</code>. However, I've been cautioned that this type pool might not always be available.</p>
  
  <p>I'm now wondering about the best practices for boolean values, specifically:</p>
  
  <ul>
  <li>Is there a preferred type that I should use?</li>
  <li>Will using the abap type-pool cause issues in certain modules or scenarios?</li>
  <li>Does the possibility of abap_bool containing an unknown or indeed any character value matter?</li>
  </ul>