Skip to Content
Feb 12, 2020 at 06:17 PM

Merge ranges logically via ABAP coding


I have the requirement to logically merge two range tables (table a and table b) into a third range table c.

Afterwards this range table c should be used in the SELECT statement.

Both range tables refer to the same data element and can contain n entries.

If there are contradictory conditions, the condition from table b should always be used.

In my view, this task could be solvable with the set theory.

The input could look like this:

range_table_a = value #( ( sign = 'I' option = 'EQ' low = 'Z001' ) 
                         ( sign = 'I' option = 'EQ' low = 'Z002') ); 

range_table_b = value #( ( sign = 'E' option = 'EQ' low = 'Z002') ); 

I would expect this result after a logical merge of range_table_a and range_table_b:

range_table_c = value #( ( sign = 'I' option = 'EQ' low = 'Z001' )
                         ( sign = 'E' option = 'EQ' low = 'Z002' ) ); 

Has anyone seen anything about this in the SAP standard?