The field statement is a flow-logic statement which controls what happens with a field. Here's the overall suite of options....
Additions to the FIELD
statement
A field check can be done in several ways. Not necessarily by using modules with routines. An overview:
FIELD fieldname SELECT * FROM tabelname WHERE tablekeyfield = inputfield AND ...
, to automatically check the fieldvalue with the contents of a check table. Also:... INTO fieldname
. And:WHENEVER FOUND / NOT FOUND SEND ERRORMESSAGE / WARNING WITH fieldname ...
.FIELD VALUES ('value1', 'value2', NOT 'value3', BETWEEN 'value4' AND 'value5')
. to check a field value with a number of fixed values (only for screentypesCHAR
orNUMC
).- Combining the above:
FIELD : VALUES ..., SELECT ..., MODULE ...
F1: Handling a user request for help
Via the process logic command PROCESS ON HELP-REQUEST
can be indicated, up to field level, which ABAP module has to be executed for the user's HELP-REQUEST
. The following function building block can be used for this: HELP_DOCU_SHOW_FOR_FIELD
, with amongst others name of the data dictionary field and table where to find the help information, as parameters.
Overview of additional FIELD
options
... ON INPUT
. Called whenever the field value differs from the initial value.... ON CHAIN-INPUT
. Called whenever the field values in the chain differ from the initial value... ON REQUEST
. Called whenever the field value was changed.... ON CHAIN-REQUEST
. Called whenever one of the field values in the chain was changed... ON *-INPUT
. Called when end user enters a "*" andthe screen attribute for *-entry was set (for the field)... AT EXIT-COMMAND
. Processing user input when a command (or menu option) with function type "E" (in the menu painter) is initiated. Can also be done withoutFIELD: MODULE
... AT CURSOR-SELECTION
. Processing is only possible when the user positions on the field and presses F2 or gives a double clicks. The function key F2 has to be activated in the menu painter.... WITH 'xxxxx'
. Only valid withPROCESS BEFORE OUTPUT
. The field name has to be in the data dictionary.
Using conversion routines in screen fields
Before any process after input is executed, a conversion routine could pick up some work for you. Conversion routines are usually held on domains, it executes a routine that can alter the contents of your (input) field. The best example would be ALPHA
, a routine that could be used by the material master for converting the material number (the material master is in fact using MATN1
for that. When a number is entered, leading zeros are added, when a non numeric character is part of the code, no changes are done.
If your screen field should handle the same way, simply input the ALPHA
conversion routine in your screen field attributes. The system will execute the conversion before the PAI is executed.
A list of possible conversion routines would bring you to a little more understanding of how these routines operate. For every conversion routine, two function modules are available. You could use these modules without using the actual conversion routine setup, by calling them directly. The function modules for conversion routines are split up in output (internal to external) and input (external to internal). The function module names always begin with CONVERSION_EXIT_
, followed by the conversion routine name, followed by either _INPUT
or _OUTPUT
.
These conversion routines might be handy:
ALPHA
Adds leading zero's if the character field only contains numbers. Also have a look at function moduleNUMERIC_CHECK
as possible solution for this onePOSID
andPOSNR
Conversion of position numbers (as often applied by SAP)KONPR
PM specific: the WBS numberNUMCV
NumericsINVDT
Inverted datesINVGJ
Inverted fiscal year- There's more !