SAP SEL SCREEN TRAPS ABEXA



Get Example source ABAP code based on a different SAP table
  



ABAP_SELSCR - Traps and Pitfalls
The example demonstrates some common traps and pitfalls of selection screens.

ABAP_SOURCE_CODE
ABAP_EXEC

ABAP_DESCRIPTION
The first trap is common for all dynpros and especially also for selection screens. By default, the content of character-like input fields is converted to uppercase when transported to the respective ABAP fields of a program. This can lead to unexpected results. In order to transport lower case characters from input fields of selection screens, the default behavior can be changed either by using a DDIC domain where the respective semantic property is set to lower case or with the addition LOWER CASE to PARAMETERS and SELECT-OPTIONS. The example shows three parameters for which the value x is entered:
Parameter lower is connected via data element DEMO_LOWER_CASE to DDIC domain DEMO_LOWER_CASE where the property lower case is set. The value x is passed to the ABAP field without conversion and the comparison with x is true.
Parameter no_lower is connected via data element DEMO_NO_LOWER_CASE to DDIC domain DEMO_NO_LOWER_CASE where the property lower case is not set. The value x is passed to the ABAP field with conversion to uppercase and the comparison with X is true.
Parameter lowercas is also connected to DDIC domain DEMO_NO_LOWER_CASE where the property lower case is not set. But the addition ABAP Addition suppresses the conversion to uppercase by setting the respective attribute for the dynpro field and the comparison with x is true.
The second trap is common for all comparisons of character-like data. Comparisons are based on the internal binary representation that depends on the code page. The locale or the current text environment are not taken into account. If this is not taken into account, when evaluating input from selection screens this can lead to unexpected results. The example shows a selection criterion selcrit that can deal with lower case letters but is restricted to the normal comparison rules. If an interval A,Bz is entered:
The string Bar is found in the interval using the operator IN.
The string Bär is not found using the operator IN because the internal representation of German umlaut ä is not part of the interval.