SAP DATA BIT ABEXA

Get Example source ABAP code based on a different SAP table
  


ARTIClE

Set Operations with Bit Sequences
This example demonstrates the use of bit operators.

ABAP_SOURCE_CODE
ABAP_EXEC

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. The basic set should be the set of all possible airlines from the database table SCARR. Each bit of the relevant bit sequence should represent 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 location, the SELECT loop that loops database table SPFLI sets the bit in either the frankfurt field or the frisco field. It sets it at the position that corresponds to the row number of the ariline in table carrier. For this purpose, the row number sy-tabix is determined using a READ statement, during which no other fields are transported.
Using the bit operations BIT-AND and BIT-OR, the intersection and union of frankfurt and frisco are formed.
In two DO loops, the bits from intersect and union are individually read and evaluated. For every set position, the airline abbreviations are read from the table carr using a READ statement.