Вы находитесь на странице: 1из 5

ALV Reporting using Function Modules:

Function Modules used for display:

a. REUSE_ALV_LIST_DISPLAY

b. REUSE_ALV_GRID_DISPLAY

Procedure for ALV reporting using function modules:

1. Declaration

2. Retrieve data

3. Field catalogue generation

4. Display

As part of the function module “REUSE_ALV_GRID_DISPLAY” there is only one


mandatory parameter ‘T_OUTTAB’. This parameter holds the internal table
containing data. If we pass only this parameter, it leads to “Abort Error”. The
reason for this error is we must specify the “field catalog “information.

This information can be specified in two ways.

i. By specifying the dictionary structure name.

ii. By specifying the field catalog directly.

Field catalogue:

It is an object which contains the information’s of the fields display in the “ALV
Grid”. This information includes name of the field, position, label, grid, appearance
etc.

Note

1. To specify the field catalogue information using the dictionary structure we


need to use the importing parameter “I_STRUCTURE_NAME” as part of the
function module “REUSE_ALV_GRID_DISPLAY”. Whenever this parameter is
specified all the properties of the field are taken from dictionary itself.

The structure name passed must match with the format of internal table i.e.
the no of fields and sequence of fields in the structure and in the internal
table must match otherwise it leads to runtime error.

GENERATING FIELD CATALOGUE:

1. Uusing std. F.M ‘REUSE_ALV_FIELDCATALOG_MERGE’

This function module takes the dictionary structure as input, generates the field
catalogue based on structure fields and returns the field catalogue which is of
type internal table “SLIS_T_FIELDCAT_ALV”.

Note: It is recommended to generate the Field catalog manually, as we have


better flexibility and control of the fields. For this, we need to prepare work area
for each field and append the same to the internal table of type
“SLIS_T_FIELDCAT_ALV”.

INTERACTIVE ALV REPORTING:

- This is generated based on the user interaction in the runtime.

- To handle events in ALV reports developed using function module we need


to consider the parameter ‘IT_EVENTS’ as part of the F.M
“REUSE_ALV_GRID_DISPLAY”.

- This parameter is an internal table of type “SLIS_T_EVENT”.

- This internal table holds the events information (refer to the document of
the parameter ‘IT_EVENTS’ to get the events list).

- This internal table is associated with two fields.

1. Name and 2. Form

- Name holds the name of the event.


- Form holds the name of the user defined subroutine.

- As part of this subroutine definition, we need to implement the business


logic related to the event.

- This subroutine will be called by SAP whenever event is Triggered.

- By reading the documentation of the parameter “IT_EVENTS” we can


understand what events are supported in ALV using F.M’s.

USER_COMMAND:

This event is triggered when the user double clicks on ALV cell value (or) single
click on hotspot cell value. This event contains two parameters.

i. Parameter of type – sy-ucomm.

ii. Parameter of type slis_selfield.

Note:

To handle the events we need to specify the parameter “I_CALLBACK_PROGRAM”


as part of F.M ‘REUSE_ALV_GRID_DISPLAY’ so that whenever the event is triggered
SAP will search for the corresponding event subroutine definition in the specified
calling program.

“REUSE_ALV_COMMENTARY_WRITE” is a function module used for associating


text and Logo to the TOP OF PAGE Area of ALV report developed using F.M. This
F.M should be called as part of user defined subroutine definition associated with
the event ‘TOP_OF_PAGE’.

Displaying “LOGO in ALV report using function module:

 Upload the logo using the Transaction code “OAER” .

Step 1:

GOTO-> SE93->Enter Transaction-> OAER

Step 2:
In OAER Transaction -> enter the values in following below.

Class name -> pictures.

Class type -> OT.

Object key-> object name (any unique id).

And execute.

Step 3:

In the next screen , in the top pane, choose ‘pictures’, and in bottom pane,
->doctype->expand->standard doc types->double click on ‘screen’ entry-
>choose filename (logo file) from local drive->continue.

Blocked ALV:

- It is used for displaying the data in the form of blocks.

- As part of this we use following function modules.

- REUSE_ALV_BLOCK_LIST_INIT

- REUSE_ALV_BLOCK_LIST_APPEND

- REUSE_ALV_BLOCK_LIST_DISPLAY

Procedure:

Step 1:

Initialize the ALV blocked list using the function module


REUSE_ALV_BLOCK_LIST_INIT

Step 2:

Generate the field catalog for the block.

Step 3:

Retrieve the data for the block.


Append the field catalog and the data to the blocked list using the function
module REUSE_ALV_BLOCK_LIST_APPEND.

Note:

Repeat the steps 2, 3 for each of the block.

Step 4:

Display the ALV blocked list using the function module


REUSE_ALV_BLOCK_LIST_DISPLAY.

Note: REUSE_ALV_EVENTS_GET is the function module which returns list of


events supported in ALV function modules.

Вам также может понравиться