<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: SET BIT AND GET BIT in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/set-bit-and-get-bit/m-p/3402830#M817086</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;      Setting and Reading Bits &lt;/P&gt;&lt;P&gt;In a hexadecimal field (type x), you can set or read individual bits.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Setting Bits&lt;/P&gt;&lt;P&gt;To set an individual bit, use the statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET BIT n OF f [TO b].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This statement sets the bit at position n of the field f to 1, or to the value of field b. The system must be able to interpret bit n as a positive whole number. The field f must have data type x. The field b must contain the value 0 or 1. If the bit is set, sy-subrc is set to 0. If n is greater than the length of f, sy-subrc is not equal to zero. If n or b contain invalid values, a runtime error occurs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA hex(3) TYPE x.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET BIT: 09 OF hex TO 1,&lt;/P&gt;&lt;P&gt;         10 OF hex TO 0,&lt;/P&gt;&lt;P&gt;         11 OF hex TO 1,&lt;/P&gt;&lt;P&gt;         12 OF hex TO 1,&lt;/P&gt;&lt;P&gt;         13 OF hex TO 0,&lt;/P&gt;&lt;P&gt;         14 OF hex TO 1,&lt;/P&gt;&lt;P&gt;         15 OF hex TO 0,&lt;/P&gt;&lt;P&gt;         16 OF hex TO 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE hex.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The bits of the second byte in the three-character hexadecimal field hex are set to &amp;#145;10110101&amp;#146;, and the list output is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;00B500&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The decimal value of the second byte is 181.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reading Bits&lt;/P&gt;&lt;P&gt;To read an individual bit, use the statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GET BIT n OF f INTO b.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This statement reads the bit at position n of the field f into field b .The system must be able to interpret bit n as a positive whole number. The field f must have data type x. If the bit is read, sy-subrc is set to 0. If n is greater than the length of f, sy-subrc is not equal to zero and b is set to zero. If n contains an invalid value, a runtime error occurs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: hex(1) TYPE x VALUE 'B5',&lt;/P&gt;&lt;P&gt;      b(1) TYPE n.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO 8 TIMES.&lt;/P&gt;&lt;P&gt;  GET BIT sy-index OF hex INTO b.&lt;/P&gt;&lt;P&gt;  WRITE b NO-GAP.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here, the eight buts of the single-character hexadecimal field hex (value &amp;#145;B5&amp;#146;) are read and displayed as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;10110101&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; hope this is useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;sreelakshmi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Feb 2008 11:44:48 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-15T11:44:48Z</dc:date>
    <item>
      <title>SET BIT AND GET BIT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/set-bit-and-get-bit/m-p/3402829#M817085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Good day gurus,&lt;/P&gt;&lt;P&gt;                        Can any one expalin the usege of Set Bit and Get Bit.&lt;/P&gt;&lt;P&gt;                  Where can we use these statements in ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;kk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2008 11:33:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/set-bit-and-get-bit/m-p/3402829#M817085</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-15T11:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: SET BIT AND GET BIT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/set-bit-and-get-bit/m-p/3402830#M817086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;      Setting and Reading Bits &lt;/P&gt;&lt;P&gt;In a hexadecimal field (type x), you can set or read individual bits.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Setting Bits&lt;/P&gt;&lt;P&gt;To set an individual bit, use the statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET BIT n OF f [TO b].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This statement sets the bit at position n of the field f to 1, or to the value of field b. The system must be able to interpret bit n as a positive whole number. The field f must have data type x. The field b must contain the value 0 or 1. If the bit is set, sy-subrc is set to 0. If n is greater than the length of f, sy-subrc is not equal to zero. If n or b contain invalid values, a runtime error occurs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA hex(3) TYPE x.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SET BIT: 09 OF hex TO 1,&lt;/P&gt;&lt;P&gt;         10 OF hex TO 0,&lt;/P&gt;&lt;P&gt;         11 OF hex TO 1,&lt;/P&gt;&lt;P&gt;         12 OF hex TO 1,&lt;/P&gt;&lt;P&gt;         13 OF hex TO 0,&lt;/P&gt;&lt;P&gt;         14 OF hex TO 1,&lt;/P&gt;&lt;P&gt;         15 OF hex TO 0,&lt;/P&gt;&lt;P&gt;         16 OF hex TO 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE hex.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The bits of the second byte in the three-character hexadecimal field hex are set to &amp;#145;10110101&amp;#146;, and the list output is as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;00B500&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The decimal value of the second byte is 181.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reading Bits&lt;/P&gt;&lt;P&gt;To read an individual bit, use the statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GET BIT n OF f INTO b.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This statement reads the bit at position n of the field f into field b .The system must be able to interpret bit n as a positive whole number. The field f must have data type x. If the bit is read, sy-subrc is set to 0. If n is greater than the length of f, sy-subrc is not equal to zero and b is set to zero. If n contains an invalid value, a runtime error occurs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: hex(1) TYPE x VALUE 'B5',&lt;/P&gt;&lt;P&gt;      b(1) TYPE n.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO 8 TIMES.&lt;/P&gt;&lt;P&gt;  GET BIT sy-index OF hex INTO b.&lt;/P&gt;&lt;P&gt;  WRITE b NO-GAP.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here, the eight buts of the single-character hexadecimal field hex (value &amp;#145;B5&amp;#146;) are read and displayed as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;10110101&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; hope this is useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;sreelakshmi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2008 11:44:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/set-bit-and-get-bit/m-p/3402830#M817086</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-15T11:44:48Z</dc:date>
    </item>
  </channel>
</rss>

