SAP Function HR99L00_CONV_FROM_EDIT_MASK_IN - Check&Convert from any edit-mask e.g. "RR___.___.___-__"

Parameter Reference Type Length Default Optional Text
INPUT CLIKE C 0 Input with or without separators
P_ALLOWED_CHARS CLIKE C 0 X All accepted characters except separator-characters conform the edit mask
P_EDIT_MASK CLIKE C 0 Edit-mask (see ABAP-docu WRITE->EDIT MASK)
P_TRANSLATE_INITIAL CHAR1 C 1 X Translate leading spaces within each segment with this character

Parameter Reference Type Length Text
OUTPUT CLIKE C 0 Result after convertion into internal format

Exception Text
INPUT_NOT_VALID

Functionality
Field-input of a screen that might be formated conform a specificedit-mask, for example like
(a),,'___.___.___-__',,(contains 4 segments: '___', '___', '___', '__'separated by 2 different separators) or
(b),,'____-__.__.__' ,,(contains 4 segments: '____', '__', '__', '__'separated by 2 different separators).
It is checked if each segment-length and each separator is conform tothe mask.
If the segment of the input-field (excluding leading and trailingspaces) is longer then the corresponding segment of the edit-mask thenan exception raises.
If the segment of the input-field (excluding leading and trailingspaces) is shorter then the corresponding segment of the edit-mask thenthe segment is right-aligned and left filled up with the initial value(P_TRANSLATE_INITIAL).
Example for (a): Input '1.2.3-4' is interpreted as '001.002.003-04' andconverted to '00100200304'.
Example for (b): Input '1234-24.1.64' is interpreted as '1234-24.01.64'and converted to '1234240164' .
If the field-input was done without using any separator of theedit-mask, then the it will be converted right aligned.
Example for (a): Input '1234' is interpreted as '000.000.012-34' andconverted to '00000001234'.
Example for (b): Input '123424164' is interpreted as '0123-42.41.64' andconverted to '0123424164' .

Description
Field-input of a screen that might be formated conform a specificedit-mask P_EDIT_MASK, for example like
(a),,'___.___.___-__',,(contains 4 segments: '___', '___', '___', '__'separated by 2 different separators) or
(b),,'____-__.__.__' ,,(contains 4 segments: '____', '__', '__', '__'separated by 2 different separators).
The field-input will be checked if it is conform to the edit-maskP_EDIT_MASK. and if it only contains allowed characters of the parameterP_ALLOWED_SIGNS in case that it is supplied.
If the field-input no contains any separator then the separators of theedit-mask are ignored.

Description
If the parameter P_ALLOWED_CHARS is supplied then each segment ischecked if it contains only characters of this string. If it containsother characters then an expception raises. Characters of the separatorsare ignored.
If the parameter P_ALLOWED_CHARS is not supplied then all characters areaccepted.

Default
Default is not supplied what means that all characters are accepted.

Description
The parameter P_EDIT_MASK is the format-description for a screen-outputand contains separators and segments with place-holders for characters.
A segment is the space between 2 separators and has a fixed line.

Value range
A segment is a reserved space for the user-input that is described by agroup of the character 'underline' (e.g. '___' for 3 places within thesegment).
All characters except the unterline ('_') and the blank (' ') can beseparators.
The edit mask can also start or end with a separator.
It is possible to use various separators within the same edit-mask, forexample the dot ('.') and the minus ('-'), or even letters can be used.(Example: '+___E__' or '____-__.__.__')
It is possible to use a separator with the length of more than 1character. (Example: 'Date:__.__.____Time:__:__:__')

Description
Define the initial value in case that there would be leading spaceswithin a segment.
If for example within a segment of the length 3 only 1 character was putin by the user then the remaining space of the segment is automaticallyfilled up left with this character.
If the parameter P_TRANSLATE_INITIAL is not supplied and the input forthis segment is shorter than in the edit-mask, then the function raisesan exception.
Example 1:
Edit-mask: '___.___.___'
Input: '1.2.3'
Parameter P_TRANSLATE_INITIAL: '0'
The input-field will be interpreted as '001.002.003' and finallyconverted to 001002003.
Example 2:
Edit-mask: '___.___.___'
Input: '123.456.78'
Parameter P_TRANSLATE_INITIAL: is not supplied
An exception is raised.