Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

events in reports

Former Member
0 Kudos

.can't we develop report with out events then wht is ths need of using events in reports .explain

11 REPLIES 11

Former Member
0 Kudos

Hi

Without events also we can write a a basic classical report. but for Interactive events are must.

But if you use a single event like At selection-screen then its a must to use Start-of-selection

Events are useful to track the data sequences and Data floe properly when the coding is some thousands of lines

If it some 10000 lines of code if you write without events its look ugly

so for READABILITY , Reusability purposes better to use the events in reports

Reward points for useful Answers

Regards

Anji

Former Member
0 Kudos

hi,

event keywords in reports are

as all the basic reports can be genarated with out the need of events but for inerative and logic database reports require events.

Events keywords in Reports are

For Classical Reports,

1.Initialization

2. At line-selection

3. Start-of-selection

4.Top-of-page

5. At user-command

6.End-of-selection

7. End-of-page

8.At Pfn

For Interactive Reports,

9.At line-selection

10. Top-of-page during line selection

For LDB (Logical DataBase) Reports,

10. get

11. put

12. get table

******please reward points if the information si helpful to you******

Former Member
0 Kudos

Hi,

Events are useful to check the data sequences and Data flow properly when the coding ha more lines.

Go thru this.

Events in Classical Reports

Initialization.

At selection-screen.

At selection-screen on <field>.

Start-of-selection.

Top-of-page.

End-of-page.

End-of-selection.

Initialization.

We can initialize the selection-screen with calculated default values under this event.

Initialization.

s_date-high = sy-datum.

s_date-low = sy-datum - 15.

Append s_date.

At selection-screen.

We can validate all the inputs on selection screen fields under this event.

At selection-screen.

If s_carrid-low is initial or s_connid-low is initial or s_date is initial.

< ... code for validation... >.

Endif.

At selection-screen on <field>.

We can validate a particular field input on selection screen under this event.

At selection-screen on s_carrid.

If s_carrid-low < > ‘LH’.

<… code for validation…>

Endif.

Start-of-selection.

By default the program is under this event.

If any of the other event comes before

‘Select…Endselect.’ statements, then to break

that event, we require this S-O-S event.

Start-of-selection.

Select * from ……

…………

Endselect.

Top-of-page.

If we need some portion of the output (like

column headings) to appear in all the pages,

then we use this event.

Top-of-page.

Write:/ ‘Carrier’,10 ‘Connection’ 20 ‘Date’.

If there is no external output statement before

‘Top-of-page’ event, then this event will not

work.

End-of-page.

Once the cursor reaches the last line of the

page, automatically this event will be triggered.

Report Zxxx line-count 25(3).

In this case line numbers 23, 24 and 25 are

reserved for footer.

Once the cursor reaches 23rd line, this event

will be triggered.

End-of-page.

Write:/ sy-uline(75).

Write:/ ‘This is end of page:’,sy-pagno.

Write:/ sy-uline(75).

End-of-selection.

This event is used for concluding part of List.

End-of-selection.

Write:/ ‘This is end of the Report’.

Additional events in interactive reports

The following additional events are applicable to secondary lists.

Top-of-page during line-selection.

At line-selection.

At user-command.

These additional events are triggered when u perform some action on the basic lists.

Hope it helps.

Thanks

Ashu

Former Member
0 Kudos

Hi Ram,

No u cant develop a report without events.

There are different types of events in ABAP.

Some are related to Classical reports, some to Interactive reports and some related to Module Pool Programming(Dialog)

Events in an ABAP/4 Report Program

ABAP/4 report programs are event driven programs

The different events in a report Program are:

<b>Load-of-program</b>

Triggers the associated event in an internal session after loading a program of type 1, M, F, or S. Also runs the associated processing block once and once only for each program and internal session. The processing block LOAD-OF-PROGRAM has roughly the same function for an ABAP program of type 1, M, F or S as a constructor has for classes in ABAP Objects

<b>Initialization.</b>

This event is executed before the selection screen is displayed .

<b>Initialization of all the values.</b>

You can assign different values other than the values defaulted on the selection screen .

You can fill your selection screen with some values at runtime.

<b>At Selection-Screen.</b>

The event is processed when the selection screen has been processed (at the end of PAI ).

Validation & Checks of inputted values happen here

Extras :

…ON VALUE-REQUEST FOR psel_low_high .

The pushbutton for F4 (Possible entries) appears beside the appropriate field.

... ON HELP-REQUEST FOR psel_low_high

. ... OUTPUT

This event is executed at PBO of the selection screen every time the user presses ENTER

<b>Start-of-Selection.</b>

Here the program starts selecting values from tables.

<b>End-of-selection.</b>

After all the data has been selected this event writes the data to the screen.

<b>Interactive Events</b>Used for interactive reporting. It is used to create a detailed list from a basic list.

<b>Start-Of-Selection</b>

Processing block is executed after processing the selection screen

All the data is selected in this block.

All the main processing on the data except for interactive reporting is handled in this block.

<b>End-Of-Selection</b>

Data which is selected and has been processed is printed to the screen in this block.

List Processing happens in this block

Top-of-Page.

New-Page.

End-of-Page.

Events during List Processing

<b>Top-of-Page.</b>Triggered by the first write statement in the program

It is used to have a standard header in the program for all the pages.

<b>TOP-OF-PAGE</b> is only executed before outputting the first line on a new page

<b>New-Page.</b>Can be used when one wants to display different data on different pages

Terminates the current page and continues output on a new page.

Will not trigger the Top-of-Page or End-of-Page.

<b>End-of-Page.</b>It is used to have a standard footer for all the pages.

Triggered by the program if the number of records exceed the line-count of the program.

Former Member
0 Kudos

Hi,

ABAP is event driven language.So with out nothing will work..To function any thing event has to trigger.....

Pls. reward if useful..

Former Member
0 Kudos

Hi Ramnarayana

In ABAP, there are a total of 7 types of reports. They are:

· Classical

· Interactive

· Logical Database

· ABAP query

· ALV Reports (ALV stands for ABAP List Viewer)

· Report Writer/Report Painter

· Views (There are different types of views also)

Classical Reports

These are the most simple reports. Programmers learn this one first. It is just an output of data using the Write statement inside a loop.

· Classical reports are normal reports. These reports are not having any sub reports. IT IS HAVING ONLY ONE SCREEN/LIST FOR OUTPUT.

Events In Classical Reports.

· INTIALIZATION: This event triggers before selection screen display.

· AT-SELECTION-SCREEN: This event triggers after proccesing user input still selection screen is in active mode.

· START OF SELECTION: Start of selection screen triggers after proceesing selection screen.

· END-OF-SELECTION : It is for Logical Database Reporting.

Interactive Reports

As the name suggests, the user can Interact with the report. We can have a drill down into the report data. For example, Column one of the report displays the material numbers, and the user feels that he needs some more specific data about the vendor for that material, he can HIDE that data under those material numbers.

And when the user clicks the material number, another report (actually sub report/secondary list) which displays the vendor details will be displayed.

We can have a basic list (number starts from 0) and 20 secondary lists (1 to 21).

Events associated with Interactive Reports are:

1. AT LINE-SELECTION

2. AT USER-COMMAND

3. AT PF

4. TOP-OF-PAGE DURING LINE-SELECTION.

HIDE statement holds the data to be displayed in the secondary list.

sy-lisel : contains data of the selected line.

sy-lsind : contains the level of report (from 0 to 21)

Interactive Report Events:

· AT LINE-SELECTION : This Event triggers when we double click a line on the list, when the event is triggered a new sublist is going to be generated. Under this event what ever the statements that are been return will be displayed on newly generated sublist.

· AT PFn: For predefined function keys...

· AT USER-COMMAND : It provides user functions keys.

· TOP-OF-PAGE DURING LINE-SELECTION :top of page event for secondary list.

Logical Database Reports

Logical database is another tool for ABAP reports. Using LDB we can provide extra features for ABAP reports.

While using LDB there is no need for us to declare Parameters.

Selection-screen as they will be generated automatically.

We have to use the statement NODES in ABAP report.

If there are many tables the Performance will be slow as all the table data will be read from top node to bottom node .

ABAP Query Reports

ABAP query is another tool for ABAP. It provides efficency for ABAP reports. These reports are very accurate.

Transaction Code : SQ01

Report Writer

Key Concept :

Super users and end users can use Report Painter/Report Writer tools to write their own reports.

Giving them the ability to report on additional fields at their discretion shifts the report maintenance burden to them, saving SAP support groups time and effort normally spent creating and maintaining the reports.

Instead of using ABAP code to write a report in FI and CO, many users build a Report Painter/ Report Writer library using transaction MC27.

However, this workaround has some drawbacks. Little known transaction GRCT solves these problems in most cases, and eliminates the need to use transaction MC27.

ABAP Report Types

ABAP report types are those ones available in some report's attributes screen, i.e. :

· Executable program

· Function group (containing function modules)

· Include

· Interface pool

· Class pool

· Module pool

· Subroutine pool

Also ALV means ABAP List Viewer. Most convenient way to use it is through reuse library (cf. transaction se83) available from release 4.6 of SAP R/3.

ALV is available in two modes: list and grid. List mode is good old list processing with standard functionnalities, and grid mode is using a new OCX object displaying grids

Reward all helpfull answers

Regards

Pavan

0 Kudos

Hi,

You can develop with out events also in that case all the code will be treated as under the section

START-OF-SELECTION.

You need events coz each event has a significance.

INITIALIZATION: to initialize global data and to pass default values to fields.

AT SELECTION-SCREEN OUTPUT: to manipulate the screen fields to hide some fileds at run time.

AT SELETION-SCREEN to check the values entered in the fields.

AT LINE SELECTION to listen to events on the list output.

Regards,

Sesh

Former Member
0 Kudos

see the basic report can be developed without events ..

if you want full fligthed report for drilldown , selection screen , alv , subroutine ...etc then you need to follow the events.

for example if you an selection screen .... before selection screen there should be some defualt then event should get triggered..

if you have any validation before the selection screen display then event should be followed ..

if you have any include then event should be followed .

the header should be displaed ... it should be palcein th top of page event .

Events are ..

<b>Initialization,

At selection-screen,

Start-of-selection,

end-of-selection,

top-of-page,

end-of-page,

At line-selection,

At user-command,

At PF,

Get,

At New,

At LAST,

AT END,

AT FIRST.</b>

reward points if it is usefull ..

Girish

Former Member
0 Kudos

Hi,

Go thru this.

<u><b>Events in Classical Reports</b></u>

Initialization.

At selection-screen.

At selection-screen on <field>.

Start-of-selection.

Top-of-page.

End-of-page.

End-of-selection.

<b>Initialization.</b>

We can initialize the selection-screen with calculated default values under this event.

Initialization.

s_date-high = sy-datum.

s_date-low = sy-datum - 15.

Append s_date.

<b>At selection-screen.</b>

We can validate all the inputs on selection screen fields under this event.

At selection-screen.

If s_carrid-low is initial or s_connid-low is initial or s_date is initial.

< ... code for validation... >.

Endif.

<b>At selection-screen on <field>.</b>

We can validate a particular field input on selection screen under this event.

At selection-screen on s_carrid.

If s_carrid-low < > ‘LH’.

<… code for validation…>

Endif.

<b>Start-of-selection.</b>

By default the program is under this event.

If any of the other event comes before

‘Select…Endselect.’ statements, then to break

that event, we require this S-O-S event.

Start-of-selection.

Select * from ……

…………

Endselect.

<b>Top-of-page.</b>

If we need some portion of the output (like

column headings) to appear in all the pages,

then we use this event.

Top-of-page.

Write:/ ‘Carrier’,10 ‘Connection’ 20 ‘Date’.

If there is no external output statement before

‘Top-of-page’ event, then this event will not

work.

<b>End-of-page.</b>

Once the cursor reaches the last line of the

page, automatically this event will be triggered.

Report Zxxx line-count 25(3).

In this case line numbers 23, 24 and 25 are

reserved for footer.

Once the cursor reaches 23rd line, this event

will be triggered.

End-of-page.

Write:/ sy-uline(75).

Write:/ ‘This is end of page:’,sy-pagno.

Write:/ sy-uline(75).

<b>End-of-selection.</b>

This event is used for concluding part of List.

<b>End-of-selection.</b>

Write:/ ‘This is end of the Report’.

<b>Additional events in interactive reports</b>

The following additional events are applicable to secondary lists.

Top-of-page during line-selection.

At line-selection.

At user-command.

These additional events are triggered when u perform some action on the basic lists.

Hope it helps.

Regards,

Padmam.

Former Member
0 Kudos

Hi,

Refer to this.

Thanks,

Anitha

Former Member
0 Kudos

hi,

ABAP is an event driven programming langage. ( especially reports).

<b>we can create report program for genarating BASIC LIST with out using events, but system automatically add one event START-OF-SELECTION.</b> (for your clarification execute the program in debugging mode, there you can click EVENTS tab, here you can find out the events which are exisisting in program)

suppose few programming blocks are executed based on USER action in that case we need EVENT'S.

<b>by uisng EVENT'S we can control the programm externally.</b>

<b>we uses event's for genarating secondary list's based on user action.</b>

<b>event's and it's functionalities.</b>

<b>INITIALIZATION</b>

This event occurs before the standard selection screen is called. You can use it, for example, to initialize the input fields of the standard selection screen. This is the only possible way to change the default values of parameters or selection criteria defined in logical databases.

<b>AT SELECTION-SCREEN OUTPUT</b>

event is triggered. This event block allows you to modify the selection screen directly before it is displayed.

<b>AT SELECTION-SCREEN ON <field></b>

is triggered when the contents of each individual input field are passed from the selection screen to the ABAP program. 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.

<b>AT SELECTION-SCREEN ON BLOCK <block></b>

is triggered when the contents of all of the fields in a block are passed from the selection screen to the ABAP program. You define a block by enclosing the declarations of the elements in the block between the statements SELECTION-SCREEN BEGIN OF BLOCK <block> and SELECTION-SCREEN END OF BLOCK <block>. You can use this event block to check the consistency of the input fields in the block.

<b>AT SELECTION-SCREEN ON HELP-REQUEST FOR <field></b>

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

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

The event is triggered when the user calls the F4 help for the field <field>. If no corresponding event block has been defined, the possible values 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 possible values help mechanism. It is then up to the programmer to ensure that an appropriate list of values is displayed, and that the user can choose a value from it.

<b>START-OF-SELECTION</b>

This event occurs after the selection screen has been processed and before data is read using the logical database. You can use it to prepare for reading data and creating the list

<b>TOP-OF-PAGE</b>

To layout a page header individually, you must define it in the processing block following the event keyword TOP-OF-PAGE:

<b>Syntax</b>

TOP-OF-PAGE.

WRITE: ....

<b>END-OF-PAGE.</b>

To define a page footer, use the END-OF-PAGE event. This event occurs if, while processing a list page, the system reaches the lines reserved for the page footer, or if the RESERVE statement triggers a page break.

<b>END-OF-SELECTION</b>

This is the last of the events called by the runtime environment to occur. It is triggered after all of the data has been read from the logical database, and before the list processor is started.

<u><b>EVENT'S FOR GENARATING SECONDARY LISTS</b></u>

<b>AT LINE-SELECTION</b>

When the user triggers the function code PICK, AT LINE-SELECTION is always triggered if the cursor is positioned on a list line. The function code PICK is, by default, always linked with function key F2 and hence with the mouse double-click.

<b>AT USER-COMMAND</b>

If the user chooses a function code during list processing that is neither processed by the system, or PICK or PF<nn>, the system triggers the event AT USER-COMMAND. For this event, you must define your own GUI status for a list. To react to your own function codes in a program, you must define the following event block:

regards,

Ashok Reddy