I need a single digit positive number on the Selection-Screen.
Things I have tried so far:
This has no effect on visible length:
parameters pnum TYPE i VISIBLE LENGTH 1.
Using type p LENGTH 1 works:
parameters pp TYPE p LENGTH 1 VISIBLE LENGTH 1.
However the input field on the Selection-Screen has the sign digit present, and if two digits are entered it triggers error 00089: Entry too long (enter in the format ~V)
I could, of course, always use a char1
type but then i have to implement logic to validate that input is a number.
Is there a simple way to implement this that I'm not aware of?
PARAMETERS: pnum TYPE char1.
AT SELECTION-SCREEN.
IF pnum IS NOT INITIAL AND NOT pnum CO '0123456789'.
MESSAGE 'Please enter a single digit number' TYPE 'E'.
ENDIF.
Create a domain: for example ZDIGIT
/ Data Type: NUMC
/ Length: 1
/ Fixed Value Range: 0
to 9
. Use this domain in the type for your parameter:
PARAMETERS: pnum TYPE zdigit_type.
PARAMETERS pnum TYPE n LENGTH 1.
AT SELECTION-SCREEN
.