You are on page 1of 13

CLASSICAL REPORTS

A report with single input screen (selection screen) and single output screen (list screen) is called a classical report. Events in Classical Reports: - All the ABAP programs are developed using events because ABAP is EVENT DRIVEN PROGRAMMING LANGUAGE i.e. the entire ABAP program execution is based on order of events. The List of the events is: Load of Program Initialization At Selection-screen output At Selection-screen on field At Selection-screen on value request At Selection-screen on Help Request At Selection-screen Start of selection End of selection Top of page End of page Load of Program: - This event is used to load the program into memory for execution. This is internal event, which we cannot see.

Initialization: - This event is used to initialization the default values to program variables and selection-screen variables. Examples: v_land1 = IN

v_bukrs = 1001 p_werks = US p_mtart = FERT AT Selection-screen output: - This event is used to modify the selection screen dynamically based on user actions on the selection screen. This event is triggered (or) executed for every action on the selection screen. AT Selection-screen on field: - This event is used to validate a single input field on the selectionscreen. AT Selection-screen on value request: - This event is used to provide a search help for an input field. This event is triggered whenever the user click on search help button. AT Selection-screen on help request: - This event is used to provide help information for an input field.This event is triggered whenever the user click on Help button i.e. F1 button. AT Selection-screen: - This event is used to validate multiple fields of the selection-screen,whereas AT Selection-screen on field is used to validate a single input field. Start of selection: - This event is used to write the original business logic statements i.e all select statements. It is also used to indicate the starting point of a program.It is the default event.

End of selection: - It is used to indicate the start of selection as been ended. It doesnt have any importance in ABAP. It is mainly used with logical database, which are absolute in ABAP (LDBs are used inold version of ABAP). But LDBs are stilled used in HR-ABAP, so end of selection is mainly used in HR-ABAP. Top of page: - This event is use to display constant page heading for all the pages of list screen. This event is triggered after the first WRITE statement. End of page: - This event is used to provide constant footer information across the all pages of the list-screen.To display end of page (or) footer information we have to reserve some lines as footer lines using the statement. Report <Report Name> Line Count Total Lines(Footer Lines) Ex Program: Will be discussed separately.

A Classical report 1 with all EVENTS as per Real time Programming


Business Requirement : Develop a CUSTOMER Master Report to display Custno,country,name1,city
REPORT ZCLASSICAL_REP1 NO STANDARD PAGE HEADING LINE-COUNT 26(3).

TYPES: BEGIN OF TY_KNA1, KUNNR TYPE KNA1-KUNNR, LAND1 TYPE KNA1-LAND1, NAME1 TYPE KNA1-NAME1, ORT01 TYPE KNA1-ORT01, END OF TY_KNA1. DATA DATA DATA DATA DATA : : : : : I_KNA1 TYPE TABLE OF TY_KNA1 . WA_KNA1 TYPE TY_KNA1 . V_TITLE(25) TYPE C . V_LAND1 TYPE KNA1-LAND1 . V_FNAME TYPE STRING .

********************SELECTION SCREEN PARAMETERS : P_LAND1 TYPE KNA1-LAND1 . PARAMETERS : P_FNAME TYPE RLGRAP-FILENAME . PARAMETERS : P_DLOAD AS CHECKBOX .

INITIALIZATION . PERFORM INIT_VARIBALES. *AT SELECTION-SCREEN OUTPUT . AT SELECTION-SCREEN ON P_LAND1. PERFORM VALIDATE_LAND1 .

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME. PERFORM GET_FILE_NAME . * AT SELECTION-SCREEN ON HELP-REQUEST FOR P_FNAME . PERFORM GET_HELP . *AT SELECTION-SCREEN .
START-OF-SELECTION .

PERFORM GET_DATA . END-OF-SELECTION .

AR J U N.LE ARN R E AL T I ME SC E N ARIO S DO N E B Y ME

Page 1

B A P&W E B D Y N P R O A B A P @ A R J U N
IF P_DLOAD = 'X' . PERFORM DOWNLOAD_DATA . ENDIF . PERFORM DISPLAY_DATA . TOP-OF-PAGE . PERFORM DISPLAY_HEADING . END-OF-PAGE . PERFORM DISPLAY_FOOTER .

IGROWSOFT

*&---------------------------------------------------------------------* *& Form INIT_VARIBALES *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM INIT_VARIBALES . V_TITLE = 'CUSTOMER MASTER REPORT' . P_LAND1 = 'DE' . ENDFORM. " INIT_VARIBALES *&---------------------------------------------------------------------* *& Form VALIDATE_LAND1 *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM VALIDATE_LAND1 . SELECT LAND1 FROM KNA1 INTO V_LAND1 UP TO 1 ROWS

WHERE LAND1 = P_LAND1. ENDSELECT . IF SY-SUBRC <> 0 . MESSAGE 'INVALID COUNTRY CODE' TYPE 'E' . ENDIF . ENDFORM. " VALIDATE_LAND1

AR J U N.LE ARN R E AL T I ME SC E N ARIO S DO N E B Y ME

Page 2

B A P&W E B D Y N P R O A B A P @ A R J U N

IGROWSOFT

*&---------------------------------------------------------------------* *& Form GET_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM GET_DATA . SELECT KUNNR LAND1 NAME1 ORT01 FROM KNA1 INTO TABLE I_KNA1 WHERE LAND1 = P_LAND1 . IF SY-SUBRC <> 0 . MESSAGE 'NO DATA FOUND' TYPE 'I' . ENDIF . ENDFORM. " GET_DATA *&---------------------------------------------------------------------* *& Form DISPLAY_HEADING *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM DISPLAY_HEADING . WRITE : / SY-ULINE . WRITE : /45 V_TITLE COLOR 5 . WRITE : / SY-ULINE . ENDFORM. " DISPLAY_HEADING *&---------------------------------------------------------------------* *& Form DISPLAY_FOOTER *&---------------------------------------------------------------------*

* text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM DISPLAY_FOOTER . WRITE : / SY-ULINE . WRITE : /45 'IBM INDIA PVT.LTD' COLOR 5 . WRITE : / SY-ULINE . ENDFORM. " DISPLAY_FOOTER

AR J U N.LE ARN R E AL T I ME SC E N ARIO S DO N E B Y ME

Page 3

B A P&W E B D Y N P R O A B A P @ A R J U N

IGROWSOFT

*&---------------------------------------------------------------------* *& Form DISPLAY_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM DISPLAY_DATA . LOOP AT I_KNA1 INTO WA_KNA1 . WRITE : / WA_KNA1-KUNNR , WA_KNA1-LAND1 , WA_KNA1-NAME1 , WA_KNA1ORT01 . ENDLOOP . ENDFORM. " DISPLAY_DATA *&---------------------------------------------------------------------* *& Form DOWNLOAD_DATA *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM DOWNLOAD_DATA . V_FNAME = P_FNAME . CALL FUNCTION 'GUI_DOWNLOAD' EXPORTING FILENAME = V_FNAME "'C:\KNA1.TXT' FILETYPE = 'DAT' "ASC MEANS NOTEPAD FILE/DAT MEASN EXCEL F ILE WRITE_FIELD_SEPARATOR = 'X' TABLES DATA_TAB = I_KNA1. . IF SY-SUBRC = 0. MESSAGE 'DATA IS SUCCESSFULLY DOWNLOADED' TYPE 'I'.

ENDIF. ENDFORM.

" DOWNLOAD_DATA

AR J U N.LE ARN R E AL T I ME SC E N ARIO S DO N E B Y ME

Page 4

B A P&W E B D Y N P R O A B A P @ A R J U N A

IGROWSOF T

B A P&W E B D Y N P R O A B A P @ A R J U N

IGROWSOFT

*&--------------------------------------------------------------------* *& Form GET_FILE_NAME *&--------------------------------------------------------------------* * text *---------------------------------------------------------------------* * --> p1 text * <-- p2 text *---------------------------------------------------------------------* FORM GET_FILE_NAME . CALL FUNCTION 'KD_GET_FILENAME_ ON_F4' EXPORTING PROGRAM_NAME = SYST-REPID DYNPRO_N UMBER = SYSTDYNNR FIELD_NA ME = 'P_FNAME ' CHANGING FILE_N AME = P_FNAME. IF SYSUBRC <> 0. ENDIF. ENDFORM. " GET_FILE_NAME *&--------------------------------------------------------------------* *& Form GET_HELP *&--------------------------------------------------------------------* * text *--------------------------------------------------------------------

ARJUN.LEARN REAL TIME SCENARIOS DONE BY ME

Page 7

B A P&W E B D Y N P R O A B A P @ A R J U N

IGROWSOF T

--* * --> p1 text * <-- p2 text *---------------------------------------------------------------------* FORM GET_HELP . MESSAGE 'PLEASE CLCIIK ON F4 FOR FILE NAME' TYPE 'I'. ENDFORM. " GET_HELP

------------------------------------------------------------------------------------------------

Using AT Selection-screen output: - This event is used to modify the selection screen dynamically based on user actions on the selection screen. This event is triggered (or) executed for every action on the selection screen. Modification ID: - It is an ID assigned to a group of Selection- screen fields, So that the properties of all the selection screen fields can be modified directly with the help of modification ID. Suppose if Modification ID is not available then we have to modify each selectionscreen field individually which makes program very complex. Syntax: Parameters: <p_name> type <table-fname> MODIF ID <modification ID name>. Ex Program: Will be discussed separately.

What is difference between AT Selection-screen on field and AT selection-screen? AT Selection-screen on field AT selection-screen
Page 8

ARJUN.LEARN REAL TIME SCENARIOS DONE BY ME

B A P&W E B D Y N P R O A B A P @ A R J U N
1) It is used to validate a single filed

IGROWSOF T

1)It is used to validate multiple fields

2) Whenever there is an error on a field, 2)Whenever there is an error on a field the entire screen will be disabled the entire screen will be enabled. Except the error field,

Ex Program: Will be discussed separately.

INTERACTIVE REPORT
Display the basic information on the basic list and the detailed information in the Secondary list is called Interactive report. The first list is called basic list and the number is 0.

ARJUN.LEARN REAL TIME SCENARIOS DONE BY ME

Page 9

B A P&W E B D Y N P R O A B A P @ A R J U N

IGROWSOF T

The remaining lists are called as secondary lists and the number start from 1 to 20.So totally there are 21 lists. The lists no are stored in a system variable SY-LSIND. If you select any line, then the selected line data is stored in SY-LISEL. Interactive Reports Events:AT Line selection AT User command Top of page during line selection AT PF<Function Key>. AT Line Selection: - This event is triggered whenever the user double clicks on any list line.To know the selected line contents, we have two keywords or statements 1)HIDE 2)GET CURSOR At User command: - This event is triggered whenever the user clicks on custom GUI buttons. Top of page during line selection: - This event is used for providing the constant page heading for all the secondary lists. AT PF <Function Key>:- This event is used or triggered whenever the user clicks on function keys (f1, f2, .etc) This event is absolute in new versions (ECC 5.0 or 6.0)

HIDE: - It is a keyword which is used to hide the data into a temporarily memory called as hide area. The hide statement must be used within loop.end loop. So that it will hide the value into hide area.

ARJUN.LEARN REAL TIME SCENARIOS DONE BY ME

Page 10

B A P&W E B D Y N P R O A B A P @ A R J U N

IGROWSOF T

Functionality of hide: - Whenever the user double clicks on any list line, the event at line selection will be triggered. The system automatically identifies the line no where the user has double clicked and reads the corresponding record into hide variable. Ex Program: Will be discussed separately.

GET CURSOR: - This statement is used to read or get the selected line content i.e. fieldname, field value into the variables. Syntax: - GET CURSOR field <v_fname> Value <v_fvalue>. The main Advantage of get cursor is, We dont have any hide area or temporary memory We can generate interactive report based on field name and field value which is not possible with HIDE statement. The other difference between hide and get cursor is, with the hide statement the system uses line no and gets the value into hide variable without knowing what is the fieldname. Whereas the get cursor will get the exact field name and field value with which we can generate various interactive reports based on filed names. Ex Program: Will be discussed separately.

Conversion Routine: - It is a function module which is used to convert a value from internal format to external format and vice-versa.

ARJUN.LEARN REAL TIME SCENARIOS DONE BY ME

Page 11

B A P&W E B D Y N P R O A B A P @ A R J U N
Conversion exits are maintained at domain level. Go to the domain and double click on conversion exit. Conversion exit function module will be displayed Example: -

IGROWSOF T

Conversion_exit_Alpha_input :- used to convert a value from exeternal format to internal format. Conversion_exit_Alpha_output:- used to convert a value from internal format to external format

AT user command: - This event is triggered whenever the user clicks on Custom GUI button. Custom GUI: - It is used to create our menus in the menu bar, our own buttons in the application toolbar, enabling or disabling the standard buttons on the standard toolbar. Syntax: - SET PF-status <CustomGUIMenuName> SE41is the tcode for creating custom GUI (also called as MENU PAINTER) FCT CODE (Function code):-It is a shortcut code assigned to a button or menu to identify the button or menu which is clicked. The FCT codes are automatically stored in a system variable SY-UCOMM.

ARJUN.LEARN REAL TIME SCENARIOS DONE BY ME

Page 12

B A P&W E B D Y N P R O A B A P @ A R J U N

IGROWSOF T

ARJUN.LEARN REAL TIME SCENARIOS DONE BY ME

Page 13

You might also like