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: 

abap

Former Member
0 Kudos

hai,

these are few doubts... hope u guys help me out in solving..

1.what is the difference between list display and grid display?

2.what are the parameters to be passed into reuse_alv_grid_display?

3.how to place the cursor on a particular field in output list??

4. what is data cluster?

5.how do you write unit test plan??

6.what is the order of events in module pool programming?

7.what is message-id?

8. how many maximum possible unique records exist in a client-dependent table if its having just one primary key?

thanks in advance,

shree

3 REPLIES 3

Former Member
0 Kudos

Hai Shree

Reporting Using ALV

Objective

ABAP List Viewer (ALV) is the latest SAP tool for reporting. It reduces the development time of reports by providing the standard interfaces (Function Modules). These standard interfaces provide GUI and formatting options for the on screen display.

This document gives an overview about ALV and various interfaces provided for ALV. It also gives information about a tool (developed in-house) that will help user in creating reports, which makes use of ALV functionality.

A brief comparison between traditional ABAP reporting and reporting with ALV is mentioned below.

Traditional ABAP Reporting

• 50% of the time spent on finding the right tables and

table relationships (selection process)

• 30% of the time spent on providing ‘fancy’ features sorting subtotals and overall totals.

• interactive list events (AT LINE-SELECTION)

• 20% of the time spent on making the report output

‘look pretty’

• Column headings

• Vertical lines and frames

Programming with the ABAP List Viewer

• 50% of the time spent on finding the right tables and

table relationships (selection process)

• 1% of the time spent on preparing field catalog and sort sequence information for the list viewer

• 9% of the time spent on ‘fancy features’

for interactive list events

• no time spent on ‘looks’ and ‘feel’

(column headings, sorting, etc.)

• time savings >= 40% easily possible

Overview

Steps involved in creating ALV reports.

• Declare data areas for list viewer

• Declare internal table to store selected data

• Select data into internal table

• Populate display variants

• Build field catalog

• Build sort catalog

• Build event catalog

• Build Layout

• Build GUI status

• Build Event Exit Table

• Build Field groups

• Start list viewer

• Process call back events

Implementation details.

• Declare data areas for list viewer

Data, which will be, used by the standard function modules in ALV. A sample data deceleration which has all the interface parameters definition is as mentioned below.

TYPE-POOLS: SLIS.

    • FOR FIELD CATALOG

DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.

    • FOR EVENTS

DATA: I_EVENTS TYPE SLIS_T_EVENT.

    • FOR SORTING

DATA: I_SORT TYPE SLIS_T_SORTINFO_ALV.

    • FOR FIELDGROUPS

DATA: I_FIELDGROUPS_TAB TYPE SLIS_T_SP_GROUP_ALV.

    • FOR VARIANT

DATA: WS_X_VARIANT LIKE DISVARIANT,

WS_VARIANT LIKE DISVARIANT,

WS_SAVE TYPE C,

WS_EXIT TYPE C,

WS_REPID LIKE SY-REPID.

    • FOR LAYOUT

DATA: WS_LAYOUT TYPE SLIS_LAYOUT_ALV.

• Declare internal table to store selected data

Internal table definition, that will store the data to be displayed on the screen. In the

example mentioned below other fields such as symbol lights and icon have been mentioned as these can be used to make reports more presentable.

Name of the internal table I_FINAL should not be changed if the standard template is used as this name is supplied to various interface parameters.

**INTERNAL TABLE FOR FINAL OUTPUT PLEASE DEFINE THE FIELDS TO BE

*OUTPUTTED HERE

DATA : BEGIN OF I_FINAL OCCURS 0 ,

SYMBOL, "IF SYMBOL TO BE DISPLAYED AFTER ACTION

  • ICONFLD(4), "IF ICONS TO DISPLAYED ON LIST

  • LIGHTS, "IF TRAFFIC LIGHTS TO BE DISPLAYED

END OF I_FINAL .

• Select data into internal table

Get the required data into the internal table.

• Populate display variants

ALV list provides an option to store on screen display as variants, which user can retrieve on a later date of execution. SAP provides standard interfaces for initializing and retrieving the display variant information.

• Build field catalog

Field catalog defines the fields and it’s attributes for on screen display. Field catalog can be build using function modules provided by SAP as well as manually populating internal table I_FIELDCAT. The details of the function modules have been dealt with later in the document.

• Build sort catalog.

Sort catalog contains fields on which the sorting of the list will be done. This is achieved by populating the internal table I_SORT.

• Build event catalog.

ALV supports normal ABAP reporting events and handles it internally as well as externally. For external handling separate forms are created. The internal table I_EVENTS is populated with the name of the form corresponding to the event to be handled. For getting the list of all the events in ALV, SAP does provide a function module.

• Build Layout

On screen display can be controlled by creating layout and passing this parameter to ALV. Display layout is build by populating the structure WS_LAYOUT in the template.

• Build GUI status

ALV provides standard GUI status and handles all the user commands for the provided GUI. In case user needs some additional functionality, then he should copy the GUI status “STANDARD” from program “SAPLSALV” and make changes. This GUI status should be set in a subroutine whose name will be passed to the standard function module that calls ALV display.

• Build Event Exit Table

This internal table is used to get the control from ALV to the report for specific commands. Append the function codes, which have to be handled differently into this internal table.

• Build Field Groups.

For easy onscreen display selection, fields can be grouped. Populate internal table I_FIELDGROUPS_TAB with the groups and description. Assign the groups to the fields in the field catalog.

• Start list viewer

Output list can be displayed in two format namely table control mode and list mode. There are standard function modules provided for both which have been dealt with later in the document. The in-house developed tool for creating ALV reports make use of the table control format.

• Process call back events

In case the user events have to handled differently, it can be achieved by creating a subroutine whose name will be passed to the standard function module that calls ALV display.

Function Modules

1. REUSE_ALV_VARIANT_DEFAULT_GET.

This FM is used to get the default variant for the report if it has been set.

EXPORTING

I_SAVE Controls the storage mode. Allowed values are

‘A‘ Standard and user specific variants

‘U’ User specific variants

‘X’ Standard Variants

CHANGING

CS_VARIANT Gets the default variant in a structure like DISVARIANT.

2. REUSE_ALV_COMMENTARY_WRITE

This FM is used to write a comment and logo on the report header.

EXPORTING

I_LOGO Pass the name of the logo, which has been uploaded in the system.

IT_LIST_COMMENTARY The comment lines that have to be written are passed in. The structure of the parameter is like SLIS_T_LISTHEADER.

3. REUSE_ALV_EVENTS_GET

Used to get all the events available in ALV list processing.

EXPORTING

I_LIST_TYPE Type of ALV list. Allowed values are

0 simple list

1 hierarchcal-sequential list

2 simple block list

3 hierarchical-sequential block list

IMPORTING

ET_EVENTS The event table is returned with all possible CALLBACK events for the specified list type (column 'NAME'). Structure of the table is type SLIS_T_EVENT.

4. REUSE_ALV_VARIANT_F4

This FM is used to get the possible values of the variants on the selection screen.

EXPORTING

IS_VARIANT Structure of this parameter is like DISVARIANT. Pass the program name through this.

I_SAVE Controls type of variant to be displayed in value help. Allowed values are

‘A‘ Standard and user specific variants

‘U’ User specific variants

‘X’ Standard Variants

IMPORTING

E_EXIT If this parameter is blank then user has selected some variant.

ES_VARIANT Selected variant is populated in this work area. It’s of structure like DISVARIANT.

5. REUSE_ALV_VARIANT_EXISTENCE

Check existence of a display variant

EXPORTING

I_SAVE Type of variant. Allowed values are

‘A‘ Standard and user specific variants

‘U’ User specific variants

‘X’ Standard Variants

CHANGING

CS_VARIANT Pass on variant details. The structure of this field is like DISVARIANT.

6. REUSE_ALV_FIELDCATALOG_MERGE

This FM creates field catalog from dictionary structure or internal table.

EXPORTING

I_PROGRAM_NAME Program from which the function module is called and which contains the exit routines. The program should always be a Report, Function group, Module pool or Form routine pool (not an Include).

I_INERNAL_TABNAME Name of the internal table as string.

I_STRUCTURE If the internal table is like ABAP dictionary object then pass on the structure name.

I_CLINT_NEVER_DISPLAY If the internal table refers to a structure which has client as key field, the client field can be suppressed from output by passing ‘X’ to this parameter.

I_INCLNAME If the list output structure data declaration is not in the assigned TOP Include, the Include name can be specified here if no structure is specified.

CHANGING

CT_FIELDCAT Generated Field catalog.

7. REUSE_ALV_GRID_DISPLAY

This FM displays the data on the screen.

EXPORTING

I_INTERFACE_CHECK To avoid overloading list output with interface consistency checks, they are only made in an extra call mode. If this parameter is 'X', the consistency of the interface is checked when the function module is called, and an error log is output. This parameter should only be set for development test purposes (e.g. in debugging).

I_CALLBACK_PROGRAM Program which calls the function module and contains the exit routines. It must be a Report, Function group, Module pool or Form routine pool

(not an Include).

I_CALLBCK_USER_COMMAND Passing an EXIT routine tells ALV that the application wants to react to certain function codes itself. These are general function codes which ALV does not recognize (not ALV standard functions) and which were defined and set by an application

status.

I_BACKGROUND_ID ID of background gif image to be displayed in report header.

IS_LAYOUT Output list description structure.

IT_FIELDCAT Field catalog containing descriptions of the list output fields (usually a subset of the internal output table fields).

IT_SPECIAL_GROUPS If fields have been grouped in the field catalog by a shared value of the parameter SP_GROUP, the technical key of the group (FIELDCAT-SP_GROUP) is assigned to the field group text in this internal table.

IT_SORT The caller specifies the sorting and/or subtotaling of the basic list in the internal table IT_SORT.

I_SAVE Controls the storage mode.

IS_VARIANT Variant information including the name of the list output variant.

IT_EVENTS This table tells ALV which events are processed by the caller by CALLBACK.

IT_EVENT_EXIT Table for passing ALV standard function codes, to return control to the user before and/or after execution with the callback event USER_COMMAND.

I_SCREEN_START_COLUMN Only to be used if the list is output in a popup.

I_SCREEN_START_LINE Only used if the list is output in a popup.

I_SCREEN_END_COLUMN Only used if the list is output in a popup.

I_SCREEN_END_LINE Only used if the list is output in a popup.

TABLES

T_OUTTAB Internal table with any structure containing the data to be output in list form. This table can contain more fields than are relevant for the list output (display fields and field list). Only the fields named in field catalog and the layout structure are used

for the list output. Other internal table fields are ignored.

Thanks & regards

Sreeni

former_member188685
Active Contributor
0 Kudos

Hi,

1.what is the difference between list display and grid display?

1. look and feel, apart from that Grid is inturn calls ALV OO controls.

and also TOP of page behaves Different in list and Grid.

you can use Write statements in ALV list but it is not possible in Grid.

2.sy-repid, internal table,fieldcat must.

layout,events,sort,pf-status,User-command depends on your requirement.

Regards

vijay

Former Member
0 Kudos

HI

GOOD

LIST DISPLAY=

If your list consists of several sections, for example, a basic list, two statistics, and a ranked list, you can use the List Overview function to switch between these different sections.

Prerequisites

You have executed a query and chosen ABAP List as the display format.

GRID DISPLAY=>

The data display in the grid display is called as the grid display.the grid display bescially we can do in the alv using various function modules.

REUSE_ALV_GRID_DISPLAY=>

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY '

EXPORTING

I_CALLBACK_PROGRAM = report_id

IT_FIELDCAT = FCAT

IT_EVENTS = i_events

TABLES

t_outtab = DISPLAY

.

DATA CLUSTER=>

UNIT TEST PLAN=>

go through this links

http://www.soe.ucsc.edu/~ejw/courses/115w01/grading/milestone.tputr.html

http://ww2.cis.temple.edu/sorkin/CIS338UnitTesting.htm

EVENTS IN MODULE POOL PROGRAMMING=>?

PAI

POB

POH

POV

THANKS

MRUTYUN