Thursday, March 17, 2016

At Selection Screen event



AT-SELECTION SCREEN is an event which is used in ABAP at the time of processing the selection screen. Any validation for the screen fields are done with this event. It is triggered at the run time environment during the processing of selection screen. This event occurs immediately before sending a selection screen. AT SELECTION SCREEN is triggered twice. The first time when the system calls the selection screen, it triggers and second time when the called screen links to another screen which is basically a sub screen, it triggers again. This event is triggered internally if we don’t mention in the program. Otherwise we mention this when we need to modify the screen operation.

In the following program we have used AT-SELECTION SCREEN event with an error message. Though it is an error message, we see that the fields are enabled in the output.

REPORT  zsr_test.

PARAMETERS: p_matnr TYPE mara-matnr,
            p_werks TYPE marc-werks,
            p_lgort TYPE mard-lgort.

AT SELECTION-SCREEN.

  IF p_werks IS INITIAL.
    MESSAGE 'Enter Plant' TYPE 'E'.
  ENDIF.


Now we shall modify this event with adding a clause – ON FIELD. Here we see that the declared field is enabled only and the rest of the fields are disabled.

REPORT  zsr_test.

PARAMETERS: p_matnr TYPE mara-matnr,
            p_werks TYPE marc-werks,
            p_lgort TYPE mard-lgort.

AT SELECTION-SCREEN ON p_werks.

  IF p_werks IS INITIAL.
    MESSAGE 'Enter Plant' TYPE 'E'.
  ENDIF.

2 comments:

Anonymous said...

SAP Success Factors Real Time Hands on Training in Chennai...

Don't always Depend on Training Institute Alone and so please aware of Best Trainers too..

http://thecreatingexperts.com/sap-successfactors-training-in-chennai/

If You need a Best Trainer over SAP Success Factors Means??? Please ready for an DEMO From the Trainer MR.Karthick
CONTACT:8122241286

Both Classroom/Online Training is Available!!!!!!

Unknown said...

Thanks for your info...Here THE CREATING EXPERTS provide hands on training with real time scenarios

http://thecreatingexperts.com/sap-abap-training-in-chennai/

contact +91-08122241286