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: 

classical reports

Former Member
0 Kudos

I am Srikanth frm Hyderabad.

I am a learner of ABAP Programming and i would like to know the following concepts:-

I want brief descripion of classical reports.

how to create

tips n tricks

->Why only 20 % of Enterprises use this Classical reports and other in ALV reports

-->adv and disadvo both reports

Regards

SRIKANTH

2 REPLIES 2

Former Member
0 Kudos

Hi,

Go thru this docu & links it will help you

http://wiki.ittoolbox.com/index.php/FAQ:How_many_types_of_reports_are_there_in_ABAP_and_what_is_the_...

http://www.sapdevelopment.co.uk/reporting/alvhome.htm

<b>CLASSICAL REPORTS</b>

Events in Classical report

Events associated with classical report are as follows and each one will be discussed in detail.

• INITIALIZATION

• AT SELECTION-SCREEN

• AT SELECTION-SCREEN ON <field>

• START-OF-SELECTION

• TOP-OF-PAGE

• END-OF-PAGE

• END-OF-SELECTION

In this case first three events are associated with selection screen. Rest of the events are associated with your list.

• INITIALIZATION

We have already seen how to fill default values for the selection criteria. But in many cases you need to calculate the value and then put it in selection criteria. For example, say, you are accepting date from user and you need to fill in the default value for lower range as sy-datum – 30 days and sy-datum for higher range. In this case you are calculating lower range and then filling the criteria. This can be done in INITIALIZATION event. Piece of code to do the above task would look like the following:

Tables: Sflight.

Select-options: fldate1 for sflight-fldate.

INITIALIZATION.

Data: date1 like SY-DATUM.

Date1 = sy-datum – 30.

Fldate1-low = date1.

Fldate1-high = sy-datum.

Append fldate1.

  • Here appending is required because fldate1 is int’ table

This event is triggered when you execute your program for the first time i.e., before selection screen is displayed.

• AT SELECTION-SCREEN

When user enters the values in the fields of selection screen and clicks on execute button, this event gets triggered. This event is basically for checking the values entered by the user for the fields of the selection screen i.e., data validity checking. This event is for entire selection screen. For example:

You are accepting carrid, connid, fldate from user and you don’t want to proceed if user enters no value for carrid and fldate. Using AT SELECTION-SCREEN can do this.

Select-options: carrid1 for sflight-carrid,

Connid1 for sflight-connid,

F1date1 for sflight-f1date.

AT SELECTION-SCREEN.

If carrid1-low ne ‘ ’ and fldate1-low = ‘ ’.

Error message.

Endif.

In this case, if both the fields are entered blank, then the user gets error message.

Basically, this event is for many fields on selection screen. Usually, it is for the fields which are logically related.

• AT SELECTION-SCREEN ON <field>

When you want to check for specific value of a field. For example, carrid should be in the range of ‘LH’ and ‘SQ’. This can be done in this event. Basically, this event is for checking individual fields. You can have many AT selection-screen events in your program (i.e., for each field specified in the Select-Options).

Select-Options carrid1 for sflight-carrid.

AT SELECTION-SCREEN.

If carrid1-low ne ‘LH’ and carrid1-high ne ‘SQ’.

Error message.

Endif.

Here the system will not proceed on entering wrong values.

• START-OF-SELECTION

This is the first event for your list. Once all the events are triggered for selection screen, the data is retrieved from database. Data declaration, select statements are done in this event. Consider the following example:

START-OF-SELECTION.

Data: mtype i.

Tables: sflight.

Select * from sflight where carrid = ‘LH’.

Write: / sflight-carrid,sflight-connid.

Endselect.

• TOP-OF-PAGE

This event is triggered with first WRITE statement or whenever new page is triggered. Advantage of using this event is that, whatever you write under this event, is applicable to all the pages. If you don’t have any write statement before TOP-OF-PAGE or in START-OF-SELECTION, this event is not triggered at all. For example, if you want the name of company and column headers for all the pages, it can be written in this event.

TOP-OF-PAGE

Write: / ‘INTELLIGROUP ASIA PVT. LTD.’

Write : / 10 ‘carrid’, 20 ‘connid’, 30 ‘fldate’.

• END-OF-PAGE

This event is triggered at the end of page.

End-of-page.

Write : / ‘page number’, sy-pagno.

In this case page number will be written on every page.

Conditional triggering of EOP

Consider the following case.

REPORT ZDEMO1 line-count 15(3).

Top-of-page.

Write: ‘this line is written by top-of-page event’.

Start-of-selection.

Write: ‘this line is written by start-of-selection event’.

End-of-page.

Write : ‘this line is written by end-of-page event’.

In this case EOP will never be triggered, as end of page is never reached. The total Line-count defined for page = 15 in which 3 lines are for footer area. The output of the above code will be

This line is written by top of page event.

This line is written by start of selection event.

In output screen, only two lines are written and cursor remains still on 3rd line, the end-of-page event is not triggered. To trigger end of page event, cursor should reach at the last position, in this case on 11th line.

Such cases are quite common, and could be overcome by conditional triggering of end of page.

Sy-linct is the system variable, which gives total line count of a list.

Sy-linno is the system variable, which gives the current line number where the cursor is placed on the list.

Consider the following case:

Report zdemo1 line count 20(1).

Start-of-selection.

Data: m type i.

Write: / ‘this is first line’.

Do 5 times.

Write: / ‘the number is’, sy-index.

Enddo.

M = sy-linct, sy-linno – 1.

Skip x.

End-of-page.

Write: / ‘page end’.

The output of above example is as follows :

This is first line.

The number is 1

The number is 2

The number is 3

The number is 4

The number is 5

After skipping 10 lines

Page end

In this case, with all write statement, you don’t reach to the end of page. After all write statement, m is calculated in this case:

M = 20 – 8 – 1, So m is 12. And 11 lines are skipped after write statement and end of page is reached. (In this case you have 6 write statement so 6 lines + 1 line for page number and 1 horizontal line which is displayed for any list. So cursor is on 8th line and is subtracted from total line count i.e, 20.)

Common errors that user commits

Stating of another event denotes the end of any event. If you forget to mention the next event then everything is included in the same event. Consider the following case:

AT SELECTION-SCREEN.

If carrid1-low ne ‘ ‘.

Err. or message.

Endif.

Write: / ‘INTELLIGROUP ASIA P. LTD.’

WRITE: / 10 ‘CARRID’, 20 ‘CONNID’, 30 ‘FLDATE’.

START-OF-SELECTION.

….

….

….

In this case all the write statement are included in the `at selection screen’ as top-of-page is not specified. The end of `at selection-screen’ is denoted by the starting of start-of-selection.

Though the sequence of events in program is immaterial, it is a good programming practice to write all the events in the order specified above.

Using Variants with selection criteria

In many cases you need report to execute report at regular interval for certain fixed values of selection criteria. That means each times you execute the report you need to enter its values again and again. ABAP/4 provides the facility by which you can define the values for selection screen and store it. Using VARIANTS can do this. It can be defined as group of values used for selection criteria while executing report. For a particular report, you create a variant which means variant created for particular report cannot be used for another report. The group of values for the selection criteria is saved and assigned a variant name. So every time you call a report, you need not specify the values for selection criteria but instead call the variant thus avoiding extra typing. User can have many variants for a single report. Each of them can be used as different type of information. For example, if a manager wants to see how an employee in personnel department or admin department has performed. He need not enter the department, one has to just execute the report with variant. In case he doesn’t know about the variant, which is available, he can display list of variants attached to the report and values assigned to each variant.

Creating variant

• Execute the report program. The selection screen is displayed.

• Enter the values for selection screen and click on saves.

- System displays the variant screen

• Enter the variant name and description for it.

• Save it.

Usually the variants are useful when you need to execute the report in background, which will be discussed in background processing.

.

Former Member
0 Kudos

Have a look at below link. You will get all the details about ALV.

http://help.sap.com/saphelp_nw04/helpdata/en/66/bc7aab43c211d182b30000e829fbfe/content.htm

Best Regards,

Vibha Deshmukh

*Plz mark useful answers