Get Example source ABAP code based on a different SAP table
ABAP_BITEXP > - Bit Operations This example demonstrates how bit operators are used.
ABAP_SOURCE_CODE DEMO CL_DEMO_DATA_BIT
ABAP_DESCRIPTION The method main> works with four hexadecimal fields of length 4, namely frankfurt>, frisco>, intersect>, and union >. These fields can represent sets with a maximum of 32 elements. Here, the basic set is supposed to be the set of all possible airlines from the database table SCARR>>. Each bit of the corresponding bit sequence represents an airline. To index the airlines, an internal table carrier> is created and filled with the abbreviations for the airlines from SCARR>. An airline is identified using the internal index of the table carrier >. Depending on the departure city, the SELECT> loop across the database table SPFLI>> sets the bit at the position that matches the line number of the airline in the table carrier>, in either in the frankfurt> field or in the frisco> field. For this purpose, the line number sy-tabix> is determined using a READ> statement, in which no other fields are transported. Using the bit operations BIT-AND> and BIT-OR>, the intersection and union of frankfurt> and frisco> are created. In the two DO> loops, the bits from intersect> and union > are read and evaluated individually. For every set position, the airline abbreviations are read from the table carrier> using a READ> statement.