0% found this document useful (0 votes)
9 views10 pages

Classical Report Events With Logic 1725251430

The document outlines various events in classical ABAP reporting, including initialization, selection-screen handling, and data retrieval processes. It provides code snippets demonstrating how to implement these events and manage user inputs, such as validating currency and document types. Additionally, the author is seeking job opportunities in SAP ABAP as a fresher.

Uploaded by

bbdey1953
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views10 pages

Classical Report Events With Logic 1725251430

The document outlines various events in classical ABAP reporting, including initialization, selection-screen handling, and data retrieval processes. It provides code snippets demonstrating how to implement these events and manage user inputs, such as validating currency and document types. Additionally, the author is seeking job opportunities in SAP ABAP as a fresher.

Uploaded by

bbdey1953
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

MAIL: abap.guravarao23@gmail.

com Lnkdin: Guravarao SAP ABAP Fresher

CLASSICAL REPORT EVENTS

 Initialization

 At selection-screen

 Start-of-selection

 End-of-selection

 Top-of-page

 End-of-page

 At selection-screen output

 At selection-screen on value request for <field>

 At selection-screen on help request for <field>

 At selection-screen on <field>

REPORT ZPRG_CLASSIC_EVENTS_23 LINE-COUNT 20(2).

TYPES : BEGIN OF LTY_DATA,

VBELN TYPE VBAK-VBELN,


ERDAT TYPE VBAK-ERDAT,
ERZET TYPE VBAK-ERZET,
ERNAM TYPE VBAK-ERNAM,
VBTYP TYPE VBAK-VBTYP,
WAERK TYPE VBAK-WAERK,

END OF LTY_DATA.
DATA : IT_VBAK TYPE TABLE OF LTY_DATA,
LWA_VBAK TYPE LTY_DATA.

IF YOU HAVE ANY OPPORTUNITIES ON SAP ABAP AS A FRESHER REFER ME AND SEND ME ,
[email protected]
MAIL: [email protected] Lnkdin: Guravarao SAP ABAP Fresher

TYPES : BEGIN OF LTY_VBTYP,


VBTYP TYPE VBAK-VBTYP,
DESC TYPE DESC40, " It's predefine Data element for Descr
iption
END OF LTY_VBTYP.

DATA : IT_VBTYP TYPE TABLE OF LTY_VBTYP,


LWA_VBTYP TYPE LTY_VBTYP.

TYPES : BEGIN OF LTY_WAERK,


WAERK TYPE VBAK-WAERK,
DESC TYPE DESC40,
END OF LTY_WAERK.

DATA : IT_WAERK TYPE TABLE OF LTY_WAERK,


LWA_WAERK TYPE LTY_WAERK.

DATA : IT_LINKS TYPE TABLE OF TLINE.


DATA : LV_ODATE TYPE VBAK-ERDAT.
DATA : LV_CURR TYPE VBAK-WAERK.
DATA : LV_DOC TYPE VBAK-VBTYP.

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.

SELECT-OPTIONS S_ODATE FOR LV_ODATE NO-EXTENSION.


SELECT-OPTIONS S_CURR FOR LV_CURR NO INTERVALS.
SELECT-OPTIONS LV_Cat FOR LV_DOC NO INTERVALS MODIF ID CAT.

PARAMETERS P_CHK TYPE C AS CHECKBOX USER-COMMAND SELECT.

SELECTION-SCREEN END OF BLOCK B1

USER-COMMAND:
 We can give any function code like SELECT that's your wish
 It's means we told sap that is particular check box has this function code so whenever
we will select that check box system under stand that we are selecting that check box
because we gave the function code

INITIALIZATION

IF YOU HAVE ANY OPPORTUNITIES ON SAP ABAP AS A FRESHER REFER ME AND SEND ME ,
[email protected]
MAIL: [email protected] Lnkdin: Guravarao SAP ABAP Fresher

 We Provided Default date to select - options By using INITIALIZATION



" PROVIDE DEFAULT VALUES TO SELECT - OPTIONS
INITIALIZATION.

S_ODATE-SIGN = 'I'.
S_ODATE-OPTION = 'BT'.
S_ODATE-LOW = SY-DATUM - 9855.
S_ODATE-HIGH = SY-DATUM.
APPEND S_ODATE.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR <field>


 The purpose of this event is to provide value help for an input field.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_CURR-LOW.

LWA_WAERK-WAERK = 'INR'.
LWA_WAERK-DESC = 'Indian Repee'.

APPEND LWA_WAERK TO IT_WAERK.


CLEAR LWA_WAERK.

LWA_WAERK-WAERK = 'USD'.
LWA_WAERK-DESC = 'United states dollar'.

APPEND LWA_WAERK TO IT_WAERK.


CLEAR LWA_WAERK.

LWA_WAERK-WAERK = 'CAD'.
LWA_WAERK-DESC = 'Canadian Dollar'.

APPEND LWA_WAERK TO IT_WAERK.


CLEAR LWA_WAERK.

IF YOU HAVE ANY OPPORTUNITIES ON SAP ABAP AS A FRESHER REFER ME AND SEND ME ,
[email protected]
MAIL: [email protected] Lnkdin: Guravarao SAP ABAP Fresher

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'


EXPORTING
RETFIELD = 'WAERK'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'S_CURR-LOW '
VALUE_ORG = 'S'
TABLES
VALUE_TAB = IT_WAERK
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR LV_Cat-LOW.

LWA_VBTYP-VBTYP = 'L'.
LWA_VBTYP-DESC = 'Debit memo request'.

APPEND LWA_VBTYP TO IT_VBTYP.


CLEAR LWA_VBTYP.

LWA_VBTYP-VBTYP = 'M'.
LWA_VBTYP-DESC = 'Inoice'.

APPEND LWA_VBTYP TO IT_VBTYP.


CLEAR LWA_VBTYP.

LWA_VBTYP-VBTYP = 'O'.
LWA_VBTYP-DESC = 'Credit memo'.

APPEND LWA_VBTYP TO IT_VBTYP.


CLEAR LWA_VBTYP.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'


EXPORTING
RETFIELD = 'VBTYP'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'LV_Cat-LOW'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = IT_VBTYP
EXCEPTIONS
PARAMETER_ERROR = 1

IF YOU HAVE ANY OPPORTUNITIES ON SAP ABAP AS A FRESHER REFER ME AND SEND ME ,
[email protected]
MAIL: [email protected] Lnkdin: Guravarao SAP ABAP Fresher

NO_VALUES_FOUND = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.

AT SELECTION-SCREEN ON HELP-REQUEST FOR < Field >


 The purpose of this event is to provide technical
information for a field.

 Go to SE61 Tcode ( Document information of sap)

IF YOU HAVE ANY OPPORTUNITIES ON SAP ABAP AS A FRESHER REFER ME AND SEND ME ,
[email protected]
MAIL: [email protected] Lnkdin: Guravarao SAP ABAP Fresher

 We need to choose the Document Class General Text And provide


name of Document NAME click on create button then we can write
TEXT for field

AT SELECTION-SCREEN ON HELP-REQUEST FOR P_CHK.

CALL FUNCTION 'HELP_OBJECT_SHOW'


EXPORTING
DOKCLASS = 'TX'
* DOKLANGU = SY-LANGU
DOKNAME = 'ZDOCCAT'
TABLES
LINKS = IT_LINKS
EXCEPTIONS
OBJECT_NOT_FOUND = 1
SAPSCRIPT_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.

AT SELECTION-SCREEN OUTPUT
 The purpose of this event is to modify the selection screen
before it is displayed

 Whenever I will select this check box i want to make these


three things as visible And whenever i will deselect i want
to make these three things as invisible
AT SELECTION-SCREEN OUTPUT.

IF P_CHK = ' '.


LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'CAT'.
SCREEN-ACTIVE = 0.
MODIFY SCREEN.

IF YOU HAVE ANY OPPORTUNITIES ON SAP ABAP AS A FRESHER REFER ME AND SEND ME ,
[email protected]
MAIL: [email protected] Lnkdin: Guravarao SAP ABAP Fresher

 ENDIF.

ENDLOOP.
ENDIF.

IF P_CHK = 'X'.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'CAT'.
SCREEN-ACTIVE = 1.
MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.

""""""""""""""""""""
AT SELECTION-SCREEN
 The purpose of this event is to validate the Input.


Whenever we pass the wrong value to currency Highlited By
using SET CURSOR FIELD

AT SELECTION-SCREEN.

IF S_CURR-LOW IS NOT INITIAL.

IF S_CURR-LOW <> 'INR' AND S_CURR-LOW <> 'USD' AND S_CURR-


LOW <> 'CAD'.
SET CURSOR FIELD 'S_CURR-LOW'.
MESSAGE E004(ZMSG_23).
ENDIF.

ENDIF.

IF LV_Cat-LOW IS NOT INITIAL.

IF LV_Cat-LOW <> 'C' AND LV_Cat-LOW <> 'D' AND LV_Cat-LOW <> 'B'.
SET CURSOR FIELD 'LV_Cat-LOW'.

IF YOU HAVE ANY OPPORTUNITIES ON SAP ABAP AS A FRESHER REFER ME AND SEND ME ,
[email protected]
MAIL: [email protected] Lnkdin: Guravarao SAP ABAP Fresher

MESSAGE E003(ZMSG_23).
ENDIF.

ENDIF.

AT SELECTION-SCREEN ON <field>
 This event is used to validate a particular input
field present on the selection screen.

 Here we gave the wrong value of currency we can see this


field is automatically highlighted with out using SET
CURSOR FIELD and the wrong value that is only unable other
become disable

AT SELECTION-SCREEN ON S_CURR.

IF S_CURR-LOW IS NOT INITIAL.


IF S_CURR-LOW <> 'INR' AND S_CURR-LOW <> 'USD' AND S_CURR-
LOW <> 'CAD'.

MESSAGE E004(ZMSG_23).
ENDIF.
ENDIF.

START-OF-SELECTION.
▪ This event calls when user clicks execute button on
the selection screen.
▪ The selection logic is the part of this event.

START-OF-SELECTION.
SELECT VBELN ERDAT ERZET ERNAM VBTYP WAERK
FROM VBAK
INTO TABLE IT_VBAK
WHERE ERDAT IN S_ODATE

IF YOU HAVE ANY OPPORTUNITIES ON SAP ABAP AS A FRESHER REFER ME AND SEND ME ,
[email protected]
MAIL: [email protected] Lnkdin: Guravarao SAP ABAP Fresher

AND WAERK IN S_CURR


AND VBTYP IN LV_Cat.

LOOP AT IT_VBAK INTO LWA_VBAK.

WRITE: / LWA_VBAK-VBELN UNDER TEXT-003,


LWA_VBAK-ERDAT UNDER TEXT-004,
LWA_VBAK-ERZET UNDER TEXT-005 ,
LWA_VBAK-ERNAM UNDER TEXT-006,
LWA_VBAK-VBTYP UNDER TEXT-007,
LWA_VBAK-WAERK UNDER TEXT-008.

ENDLOOP.

END-OF-SELECTION
▪ This event helps to identify the end of data/records.

END-OF-SELECTION.

WRITE:/ TEXT-001.

TOP-OF-PAGE
 . It is used to display the header information.
TOP-OF-PAGE.
WRITE: / TEXT-002, SY-PAGNO.

WRITE: / TEXT-003, 15 TEXT-004,


27 TEXT-005, 38 TEXT-006,
52 TEXT-007, 63 TEXT-008.
END-OF-PAGE
It is used to display the footer information
END-OF-PAGE.
WRITE: / 'End of the page' , SY-PAGNO.

IF YOU HAVE ANY OPPORTUNITIES ON SAP ABAP AS A FRESHER REFER ME AND SEND ME ,
[email protected]
MAIL: [email protected] Lnkdin: Guravarao SAP ABAP Fresher

IF YOU HAVE ANY OPPORTUNITIES ON SAP ABAP AS A FRESHER REFER ME AND SEND ME ,
[email protected]

You might also like