Get Example source ABAP code based on a different SAP table
SELECT>, Byte Field Indicators This example demonstrates a condensed indicator structure > as a null indicator> in a SELECT > statement. It shows the difference between position-based and name-based assignments of indicator bits without and with CORRESPONDING FIELDS>.
ABAP_SOURCE_CODE DEMO CL_DEMO_INDICATORS_BITFIELD
ABAP_DESCRIPTION Data are selected with and without CORRESPONDING FIELDS> from an internal table @data_tab> with five columns col1> to col5>. In the result set, columns col1 > col3> and col4> contain the null value>. The target areas contains a byte field null_ind> as the last component but are differently structured than the result set in front of null_ind>. The following figure illustrates the behavior: IMAGE indicators.png 680 550 The assignments take place as follows:
Without CORRESPONDING FIELDS>, the values from the columns of the result set are assigned from left to right to the components of the target area. Accordingly. the first five bits of the null indicator are set from left to right. The bits at positions 1, 3, and 4 are set to 1. The bit at positions 2 and 5 as well as the excess bits at positions 6 to 8 are set to 0.
With CORRESPONDING FIELDS>, the columns of the result set are assigned to the components of the target area that have the same name. Since the positions of the columns named col1> to col5> in the target are 5, 6, 3, 7, and 1, the respective bits are set in the null indicator: The bits at positions 3, 5 and 7 are set to 1 and the bits at positions 1 and 6 are set to 0. colx> and coly> at positions 2 and 4 of the target area do not correspond to columns of the result set and the bits at these positions as well as the excess bit at position 8 are set to 0.