Exploring Classical Report Events: Page Overflow, At Selection-Screen Output, and More
Welcome back everyone, we were discussing about Classical Report events, So let’s continue it.
Page Overflow :-
-
There is always a big possibility to get a runtime error when we blindly give line count for End of page event,
-
let’s analysis the reason, why we got a runtime error.
Ans :- Page overflow generates when the size of page is not enough to adjust end of page and header of page, So we need to make sure that their size is compatible before taking any blind decision.
7. At Selection-Screen Output
- This event calls before displaying the selection screen or input screen.
- The purpose of this event is to modify the selection screen.
Note :- We have seen that, Initialization event also triggers just before displaying the selection screen. So, What’s the difference
Initialization Vs At Selection Screen Output :-
- Initialization event calls only first time before displaying the selection screen whereas at selection screen output event calls every time before displaying a selection screen.
- Initialization event is to assign the default values to parameters and select-options whereas at selection-screen output event is used to modify the selection screen.
At Selection Screen Vs At Selection Screen Output Comparison
- At selection screen event calls when user performs some action(enter, Click etc.) on to the selection screen whereas at selection screen output event calls before displaying the selection screen.
- At selection screen event is to validate the input whereas at selection screen output is used to modify the selection screen.
- At selection screen event is equal to PAI(Process After Input) of module pool whereas at selection-screen output is equal to PBO(Process before Output) of module pool.
Implementation of At Selection Screen Output:-
Requirement :-
-
Suppose, this is our selection screen.
-
And, Now I want that, As soon as I open the selection screen, The currency field should be invisible and there will be a checkbox at the selection screen, and I enable that checkbox, the currency field will become visible.
Solution :-
- Create a parameter for checkbox.
- Loop at screen and provide the necessary logic.
Code :-
***********************************************
*Start of Program
***********************************************
*Declaring type strcuture
TYPES: BEGIN OF ty_header,
order_number TYPE zar_order_number,
order_date TYPE zar_order_date,
payment_mode TYPE zar_payment_mode,
currency TYPE zar_curency,
END OF ty_header.
****************
*Internal Table and Work Area
DATA : lt_header TYPE TABLE OF ty_header,
ls_header TYPE ty_header.
****************************************
DATA : lv_pm TYPE zar_payment_mode,
lv_curr TYPE zar_curency,
lv_date TYPE zar_order_date.
SELECT-OPTIONS : s_odate FOR lv_date NO-EXTENSION.
SELECT-OPTIONS : s_pm FOR lv_pm NO INTERVALS.
SELECT-OPTIONS : s_curr FOR lv_curr NO INTERVALS MODIF ID CUR.
PARAMETERS : p_chk TYPE c AS CHECKBOX.
****************************
*Initializaton Events.
INITIALIZATION.
*****************
*For Date
s_odate-sign = 'I'.
s_odate-option = 'BT'.
s_odate-low = sy-datum - 100.
s_odate-high = sy-datum.
APPEND s_odate.
********
*For Payement Mode
* s_pm-low = 'C'.
* APPEND s_pm.
***************
*Currency
s_curr-low = 'INR'.
APPEND s_curr.
***********************************
AT SELECTION-SCREEN OUTPUT.
IF p_chk = ' '.
LOOP AT SCREEN.
IF screen-group1 = 'CUR'.
screen-active = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF p_chk = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'CUR'.
screen-active = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
***********************************
*At Selection Screen
AT SELECTION-SCREEN.
IF s_pm-low IS INITIAL.
IF s_pm-low <> 'C'.
MESSAGE 'Payment mode is not entered' TYPE 'E'.
ENDIF.
ENDIF.
**********************************
*Start Of Selection.
START-OF-SELECTION.
SELECT order_number order_date payment_mode currency
FROM zar_header
INTO TABLE lt_header
WHERE currency IN s_curr.
***********************************
*Displaying data
LOOP AT lt_header INTO ls_header.
WRITE :/ ls_header-order_number,
ls_header-order_date,
ls_header-payment_mode,
ls_header-currency.
ENDLOOP.
*******************************
*End of Selection.
END-OF-SELECTION.
WRITE :/ TEXT-001.
***********************************
*Top of Page
TOP-OF-PAGE.
WRITE :/ TEXT-002, sy-pagno.
*************************************
*End of Page
END-OF-PAGE.
WRITE :/ 'END Of page Number', sy-pagno.
*****************************************
*End OF Program
****************************************
Execute the program :-
Enable the checkbox and press enter :-
So, this is how at selection screen output works.
8. At Selection-Screen On Value Request for <Field> :-
- This event calls when user clicks F4 on a field of Selection Screen.
- The purpose of this event is to provide value help for a input field.
9. At Selection-screen On Help Request For <Field> :-
- This event calls when user clicks F1 on a field of Selection Screen.
- The purpose of this event is to provide technical information for a field.
Interactive Classical Report Events :-
1. What is the difference between Interactive Classical Report and Classical Report ?
- In Classical Report, we only display the output on basic list, There is no interaction with the output.
- In Interactive Classical Report, we interact with the output on basic list and it take us to secondary list.
- Basic list is the list which is generated at first by our ABAP program.
- The secondary lists are generated by further navigation or user selection from the basic list.
2. How many number of basic lists are there ?
- the number of basic list in classical report is 1.
- The number of secondary list in classical report is 20.
Types of Interactive Classical Report Events :-
- At line-selection.
- At user-command
- Top of page during line selection
So, that’s enough for today.
We will implement the Classical Report Events in our next blog.
Thanx a lot for being a part of this wonderful journey.
Comments
Post a Comment