cancel
Showing results for 
Search instead for 
Did you mean: 

Reports

former_member824495
Active Contributor
0 Kudos

Hi

Can anybody plz explain how to make reports.I have no idea about that.As a MM consultant, what will be my role in creating or making changes in existing reports.

Please guide.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI Piyush,

Report writing can be systematically approched .Please try to create a very simple report with the steps i am writing here.

ABAP – Advanced Business Application Programming is a fourth generation programming language and is used to develop all SAP R/3 applications. Programs In ABAP can be broadly classified as:-

· List/Report Programs

· Dynamic/Dialog Programs.

Dynamic/Dialog programming serves as an interface to the SAP R/3 database. Dialog programs, frequently called as module pools enable the user to interact with the SAP database. This interaction can be in the form of adding entries, retrieving them for display or even modifying them. Therefore such programs often act as the front end to the R/3 database.

On the other hand List/Report programs serve as a medium to retrieve large amounts of data from the R/3 database and process it for display to the user. In addition to this report programs provide the user with the functionality of downloading the data in a desired format from SAP to Excel or Notepad for distribution or record purposes.

The ABAP Editor commonly referred to as SE38 is used for the creation of all Report Programs. The editor is used for creating/editing the source code for the report program as well as for the creation of variants, documentation, etc.

Let us now begin by creating our very own Report say z_samplereport. As we proceed by clicking the “Create” button we are presented with a window where we define the attributes of our report. Some of the basic attributes are explained below.

1. Title: The title provides a brief idea of what the report is designed to do.

2. Type: All reports are of the type “Executable program” (Type 1).

3. Status: The status defines whether the program is a Standard SAP Program or a Customer Production Program or a Test Program.

4. Application: This refers to the Application Type Area-SD, FI, etc.

5. Authorization Group: This defines the Authorization Group to which a report is assigned. This plays an important role when the system has to check whether the user is authorized to execute a program or edit a program.

6. Editor Lock: This option provides the functionality of preventing other users from making changes to the program.

Once these attributes are set, we proceed by saving the report. This brings us to the main editor page of the report. This is where we write the code for the program.

The first line always contains the report name. We now define the line size and line count for the report. We also include the NO STANDARD PAGE HEADING line so as to suppress the list heading or name of the program. For displaying error / warning / information messages, we define the message class which is maintained via transaction SE91.

Thus an ideal report program would begin as:-

Report tag after the definition.

FORMS

The forms generally contain the functions containing the select queries based on the values input on the selection screen. These functions will be called from the main program once the report is executed.

The forms also contain the logic for displaying the data fetched from the database by the report program. This will be dealt in detail in the following sections.

EVENTS

The events in a report program basically define the order in which the code is executed.

Following are the basic events in any report program:

1. LOAD-OF-PROGRAM: This event triggers the associated event in an internal session after loading the program.

2. INITIALIZATION: This event is used for filling in values in the selection screen at runtime. Basically, all values are initialized during the course of this event

3. AT SELECTION-SCREEN: Validation checks for input occur during this event.

4. START-OF-SELECTION: This event triggers the start of selection of data from the database tables. All functions involving select queries are called during this event. Once the requisite data is fetched, it is modified/customized as per the requirements and then finally prepared for display.

5. END-OF-SELECTION: This event causes all fetched data to be displayed on the screen. All functions associated with displaying the fetched data are called during this event.

List Processing also occurs during End of Selection. Events during List Processing include the following:

· TOP-OF-PAGE

· NEW PAGE

· END-OF-PAGE

DISPLAY OPTIONS

There are primarily 2 ways of displaying data fetched by a report.

· “WRITE” statements

· ALV List/Grid

WRITE STATEMENTS:

Following is the syntax for using write statements.

WRITE : / '|'.

WRITE AT 5: 'TITLE 1'.

WRITE AT 15 : '|'.

WRITE AT 20 :'TITLE 2'.

WRITE AT 35 : '|'.

WRITE AT 40 :'TITLE 3'.

WRITE AT 60 : '|'.

WRITE AT 65 :'TITLE 4'.

WRITE AT 75: '|'.

WRITE AT 80: 'TITLE 5'.

WRITE AT 90: '|'.

LOOP AT TABLE.

WRITE : / '|'.

WRITE AT 5: Table-Field.

WRITE AT 15 : '|'.

WRITE AT 20 :Table-Field.

WRITE AT 35 : '|'.

WRITE AT 40 :Table-Field.

WRITE AT 60 : '|'.

WRITE AT 65 :Table-Field.

WRITE AT 75: '|'.

WRITE AT 80: Table-Field.

WRITE AT 90: '|'.

ENDLOOP.

Additional formatting options available with WRITE options are use of different colors, intensifying text and hotspots.

Hotspots: When one drags the mouse over the lines of data where hotspots are activated, the cursor changes to a hand with an outstretched index finger. Hotspots can be used for adding additional features such as redirection to tables, transactions, etc.

However, it is a cumbersome task to design the output layout using write statements especially when the amount of data being displayed is huge and display requirements are complex. This also affects the readability of the report. Hence this method is preferred only for small simple reports.

ALV-LIST/GRID:

SAP provides a list of ALV (ABAP List Viewer) function modules which can enhance the functionality and readability of a report. Hence ALV is generally preferred for all report displays. ALV also provides added functionalities like dynamic sorting of report output and rearranging columns in the report output.

ALV’s are generally of 3 types:

1. List /SimpleALV

2. Grid/Block ALV

3. Hierarchical Sequential Report

TEXT ELEMENTS

There are 3 different types of text elements:

1. List Headings:

These are used to make dynamic List headings

2. SELECTION TEXTS:

These are used to give names to the select-options, parameters and block titles used in the selection screen.

3. TEXT SYMBOLS:

Text symbols are used for printing texts on the selection screen or in the report output. The use of selection texts is considered to be a good programming practice as it serves as a substitute for hard-coding.Text symbols also provides multi-lingual support.

PROCESSING THE REPORT

Once we are done with the coding, we check the report for any syntactic errors. The editor displays the errors if any along with the line numbers and the suggested correction.

Once the report is found to be syntactically correct, we activate it. On activation, the program is checked & an active version of the report is saved. Once the report is activated, it is ready for processing.

On direct processing, the report is executed. Thus, the selection screen will be displayed prompting the user to input the values for selection. Pressing the F4 Key gives the user a list of possible values for that particular field

Once the user has entered the desired values, the report is executed.

On execution, the data is fetched from the data base and displayed to the user.

VARIANTS

A variant is a saved version of the input data filled into the selection screen. At runtime, the variant can directly be selected. This removes the need to manually enter the data in the selection screen over and over again. This generally helps when we are testing a report for a particular set of values. Check the illustrations below for the procedure to create a variant.

I hope all these facts about abap reports will help you.

Rewards points if useful ..:)

Cheers,

Twinkle Gupta

Once we have created the variants, they can be directly selected from the list of available variants displayed on the selection screen.

former_member824495
Active Contributor
0 Kudos

Hi Twinkle,

Great to have answer from you.

It should be more than sufficient for anybody.

Thanks

Piyush

Answers (1)

Answers (1)

Former Member
0 Kudos

hi

You can find all the relevant reports in T.code SAP1 .

i think it may be usefull

with regards

vishnum

former_member225044
Active Participant
0 Kudos

Hello

for reports you can use T.codes

SQ03

SQ02

SQ01

these helpful for making report.

sapman

former_member824495
Active Contributor
0 Kudos

Hi sapman,

Do you mean to say that ABAP Query itself is a report.

Please tell me about my role in making reports when i have to sit with ABAP person.

Please clear my doubt.