Preview Original paying document published on :
http://expertplug.com/materials/training/sap-alv-list
You can find many more full SAP training material and SAP jobs on http://expertplug.com/.
ExpertPlug is an SAP marketplace for training materials and an online community of experts. We
offer a simple way for the global SAP workforce, consulting companies and industry to market their
skills and find quality information.
As an SAP Expert, you can also market your SAP skills and make extra revenue by publishing SAP
documents on http://expertplug.com/.
3. 1 Introduction
In this section we would be trying to introduce the concepts of the hierarchical reporting to
enable the system to provide different levels of information instead of cluttering all
information at a single level.
2 Pre-Requisites
The concepts of ALV reporting – an introduction is needed to proceed in this section
2.1 Transaction Codes
The transaction codes that are used for this section is as follows
a) SE38
b) SE80
c) SE37
3 Hierarchical List
The hierarchical list in ALV is a form of reporting where the information is segregated in
different levels making it easier for the end user
Level 1
Level 2
In previous sections, where the concept of ALV lists were introduced , we could see that the
information pertaining to an employee was available in a single line , which at time required
the end user to scroll through the screen to see the entire information .
This information includes the personal information as well as the information pertaining to
the history of his employment in an organization. This information could also have been
segregated into personal and employment information and shown in different levels so that
only relevant information is available at the starting point when an end user requests
information.
3
4. For E.g. : while analyzing the salary information pertaining to employees who have joined
the organization on or after 01.01.2010 , the end user needs to know only the employee
number, date of joining, joining designation , his initial salary and his salary history. Personal
information pertaining to these employees is of no use for him at this stage.
The information that the end user is expecting in the following format
Employee ID Employee Years of Exp Total Years Current
Level 1
Name in org of Exp designation
DOJ Sal . eff. Salary Designation
From amount
Level 2
This ensures that the employee information displayed in Level 1 is not repeated and only
the information pertaining to the salary history across years alone is repeated.
To achieve this, we cannot use the Simple ALV list reporting as it enables only a reporting at
single level, hence we would start the using hierarchy reporting as this resembles
information being categorized into multiple hierarchies.
3.1 Parameters & Types
Some parameters are tending to provide the values and some parameters are tending to
bear the result of the execution of the code. In some cases the parameters that bear the
input values can also bear the output values , i.e. the an end user can pass a value to a
parameter and at the end of the execution, this parameter will bear the result of the
execution and may/may not have the value that was passed .
The parameters, thus can be classified as
Importing parameters -> they ONLY pass value to a modularized object
Exporting parameters->They ONLY value from the object – function module/subroutine
Changing parameters -> They can pass input values and these values can be changed
directly by the function module /subroutines.
4
5. Tables->. These are internal tables and the values of these tables can be modified
directly by the function module/subroutine.
3.2 Implement Hierarchical reporting using ALV
To create a hierarchical ALV, we need to make use of the function module
REUSE_ALV_HIERSEQ_LIST_DISPLAY.
To see the information and the format of passing this information, we need to see the
input parameters to this function module. To access this information; we would need to
navigate to the Function Builder via transaction SE37
Step 1: provide the transaction code: SE37 on the command box
Step 2: In the initial screen of the function builder, provide the function module name as
shown below.
Step 3: Press Display button to see the inputs to the function module and what the
function module would provide after the execution the code present within this
function module.
5
6. Step 4: The screen navigates to another window where we can see the code that
constitutes the function module as shown below
3.2.1 IMPORTING PARAMETERS
Step 5: Navigate to the tab Import to see what information we need to pass to this
function, module to generate a hierarchical list.
Step 6: A new window appears as shown below providing information of the parameter
name and whether it is a mandatory parameter or an optional parameter. All
mandatory parameters should be provided with prior to the execution of
function module. If any mandatory parameter is missed out, it would result in a
6
7. runtime short dump.
To identify if a parameter is optional, check if the parameter has a tick marked under
the column “Optional” as shown below.
In the above screen shot , we can see that the parameter I_INTERFACE_CHECK has a
tick mark under the column header “Optional” and thereby indicates that its an optional
parameter.
The mandatory parameters do not have this column selected as shown below, indicating
that the values must be passed to this parameter.
The column adjacent to optional is named as “Pass By Value”.
Passing By Value
Passing by value indicates that the object is expecting the values and not any
references and all the computations/modifications are made directly in the
object.
In the above screen, we can see that the parameters “I_TABNAME_HEADER” is
not an optional parameter and is expecting the end user to pass the values
directly to this parameter. Hence it is a must to pass values to this parameter.
7
8. 3.2.1.1 Identify the attributes linked to the parameters
To identify the type of data that needs to be passed to the parameters, double
click on the data type name provided belwo the column named as “Associated
type”
Step 1: double click on SLIS_FORMNAME to understand the underlying data type
or type of data that needs to be passed to the parameters
“I_CALLBACK_PF_STATUS”.
This takes the user to the type group definition –SLIS where all the definitions
and declarations that are needed for using an ALV has been globally maintained.
From here, we can see that an end user needs to pass a value which is of
character type and can have a maximum length of 30 as the value for the
parameter I_CALLBACK_PF_STATUS.
Similarly, we need to identify the type of data that is needeed to be passed for
all mandatory parameters and for those optional parameters for the formatting
of the Hierarchical List display.
3.2.1.2 Default Values
In a normal reporting, to pass a value by default we used to the keyword
DEFAULT accompanied by the value in ‘’.
8
9. In a function module also, we can pass “Default Values” and these are set against
each IMPORTING parameter.
In this function module, we can see that there are certain IMPORTING
parameters- parameters that form the input values – have default values linked
to it. One can change these values as needed if this needs to be overridden.
From the above screen shot, we can see that the parameter I_INTERFACE_CHECK
has been associated with a default value “SPACE” .
3.2.1.3 Short text
This indicates/provides the description of these parameters simple terms. This
explains the function that these parameters are performing.
3.2.1.4 Long Text
There is a button at the end of the table which says as “Long Text”.
Press on “Display” button and this provides details on the parameter- a
description of what this parameter stands for and what possible values they can
hold, thereby providing additional information to the developer .
3.3 EXPORTING PARAMETERS
The Exporting parameters are the parameters that would bear the output values after
the function module is executed.
To identify the exporting parameters, click on the tab “EXPORT” as shown below.
9
10. Here we can see that there are two parameters
The end user can make use of these parameters for processing the data further back in
the report from where this function module has been invoked.
3.4 Tables
To identify the internal tables that can be passed to a function module, navigate to the
tab “TABLES” as shown below.
Here we can see that there are two internal table definitions available that can provide
values to the function module and will still have values while coming out after the
execution of the code.
They are
1. T_OUTTAB_HEADER
2. T_OUTTAB_ITEM
As can been seen, there are no definite data types associated with these tables
indicating that they can bear any structure.
10
11. Preview Original paying document published on :
http://expertplug.com/materials/training/sap-alv-list
You can find many more full SAP training material and SAP jobs on http://expertplug.com/.
ExpertPlug is an SAP marketplace for training materials and an online community of experts. We
offer a simple way for the global SAP workforce, consulting companies and industry to market their
skills and find quality information.
As an SAP Expert, you can also market your SAP skills and make extra revenue by publishing SAP
documents on http://expertplug.com/.