Hi,
If your screen fileds are of standard type like date etc then there will be an automatic check. And also if you have value help for those fileds through foriegn key then those screen fileds will also have automatic checking. If you have generic fields like String then you have to validate them in PAI modules. If you are using selection screen then you can write your validaton code in AT SELECTION-SCREEN event.
Regards,
Sesh
sorry i dint get your question clearly....
usually in PAI we validate the screen fields.
like for selection-screen
at selection-screen event.
if you are using the fields by refering database table fields or data element it will automatically validate your screen fields.
regards
shiba dutta
For field validation
1. Declaration the data type.
data:w_vbeln like vbrk-vbeln.
2. Then write this code for field validation.
select single vbeln
from vbrk
into w_vbeln
where vbeln = vbeln .
if sy-subrc ne 0.
message e000(0) with 'Enter Valid Number'.
endif.
If it usefull donot foget to point
Hi Bhasker,
1. <b>AT SELECTION-SCREEN</b>
The AT SELECTION-SCREEN event is triggered in the PAI of the selection screen once the ABAP runtime environment has passed all of the input data from the selection screen to the ABAP program. If an error message occurs in this processing block, the selection screen is redisplayed with all of its fields ready for input. This allows you to check input values for consistency.
REPORT demo_at_selection_screen .
NODES spfli.
AT SELECTION-SCREEN.
IF carrid-low IS INITIAL
OR airp_fr-low IS INITIAL
OR airp_to-low IS INITIAL.
MESSAGE e888(sabapdocu) WITH text-001.
ENDIF.
2. <b>AT SELECTION-SCREEN OUTPUT</b>
In the PBO of the selection screen, the
<b>AT SELECTION-SCREEN OUTPUT</b>
event is triggered. This event block allows you to modify the selection screen and its fields directly before it is displayed.
Initializations of selections screen fields at this moment always take effect, whereas at the execution of an executable program, initializations at moment INITIALIZATION only take effect at the first program start, and are otherwise overwritten by the previous user inputs at the beginning of AT SELECTION-SCREEN OUTPUT.
REPORT demo_at_selection_screen_pbo.
PARAMETERS: test1(10) TYPE c MODIF ID sc1,
test2(10) TYPE c MODIF ID sc2,
test3(10) TYPE c MODIF ID sc1,
test4(10) TYPE c MODIF ID sc2.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-group1 = 'SC1'.
screen-intensified = '1'.
MODIFY SCREEN.
CONTINUE.
ENDIF.
IF screen-group1 = 'SC2'.
screen-intensified = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
3.<b>AT SELECTION-SCREEN ON field</b>
AT SELECTION-SCREEN ON field
event is triggered. The input field field can be checked in the corresponding event block. If an error message occurs within this event block, the corresponding field is made ready for input again on the selection screen.
REPORT event_demo.
NODES spfli.
AT SELECTION-SCREEN ON city_fr.
IF carrid-low EQ 'AA' AND city_fr NE 'NEW YORK'.
MESSAGE e010(hb).
ENDIF.
4. <b>AT SELECTION-SCREEN ON RADIOBUTTON GROUP group</b>
In the PAI event of the selection screen, the event
AT SELECTION-SCREEN ON RADIOBUTTON GROUP group
event is triggered. To define a radio button group, use the addition RADIOBUTTON GROUP group in the corresponding PARAMETERS statements. This event block allows you to check the whole group. If an error message occurs within this event block, the radio button group is made ready for input again on the selection screen. The individual fields of radio button groups do not trigger the event AT SELECTION-SCREEN ON field.
REPORT demo_at_selection_on_radio.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS: r1 RADIOBUTTON GROUP rad1 DEFAULT 'X',
r2 RADIOBUTTON GROUP rad1,
r3 RADIOBUTTON GROUP rad1.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
PARAMETERS: r4 RADIOBUTTON GROUP rad2 DEFAULT 'X',
r5 RADIOBUTTON GROUP rad2,
r6 RADIOBUTTON GROUP rad2.
SELECTION-SCREEN END OF BLOCK b2.
AT SELECTION-SCREEN ON RADIOBUTTON GROUP rad1.
IF r1 = 'X'.
MESSAGE w888(sabapdocu) WITH text-001.
ENDIF.
AT SELECTION-SCREEN ON RADIOBUTTON GROUP rad2.
IF r4 = 'X'.
MESSAGE w888(sabapdocu) WITH text-001.
ENDIF.
5. <b>AT SELECTION-SCREEN ON HELP-REQUEST FOR field</b>
If the data type of an input field declared in an executable program is defined in the ABAP Dictionary, the documentation of the underlying data element is automatically displayed if the user positions the cursor in that field and presses F1. To create help for input fields that have no Dictionary reference, or to override the help normally linked to the field, you can create an event block for the event
AT SELECTION-SCREEN ON HELP-REQUEST FOR field
The event is triggered when the user calls the F1 help for the field field. If no corresponding event block has been defined, the help from the ABAP Dictionary is displayed, or none at all if the field has no Dictionary reference. If a corresponding event block exists, it takes precedence over the default help mechanism. It is then up to the programmer to ensure in the event block that appropriate help is displayed to the user.
No event block AT SELECTION-SCREEN ON HELP-REQUEST can be created for input fields of the selection screen that are declared within the logical database used. You cannot override the help mechanism of the logical database within the executable program. You can define separate help within the logical database program using the HELP-REQUEST option in the PARAMETERS and SELECT-OPTIONSstatements.
REPORT demo_selection_screen_f1.
PARAMETERS: p_carr_1 TYPE s_carr_id,
p_carr_2 TYPE spfli-carrid.
AT SELECTION-SCREEN ON HELP-REQUEST FOR p_carr_2.
CALL SCREEN 100 STARTING AT 10 5
ENDING AT 60 10.
This program declares a selection screen with two parameters that both refer to the data element S_CARR_ID in the ABAP Dictionary. The documentation from the Dictionary is used for p_carr_1, and a help screen 100 is called for Pp_carr_2. The help screen is defined in the Screen Painter as a modal dialog box with next screen 0. It contains the help text defined as help texts. The screen does not require any flow logic.
if u need to validate the fields, the first thing u need to do is use at selection-screen event and use the check table for the validation purpose
eg if ur using ltak table it has field lgnum in validation dont use ltak,but instead click on lgnum and click on help/check tab so that u can able to find out the exact master table for it.
Add a comment