没有合适的资源?快使用搜索试试~ 我知道了~
ABAP ALV入门教程
5星 · 超过95%的资源 需积分: 31 18 下载量 16 浏览量
2014-06-20
12:55:32
上传
评论
收藏 621KB PDF 举报
温馨提示
试读
46页
ALV入门最近教程,一步一步教你开始你的第一个ALV,参数写的很详细,可入门,查询用
资源推荐
资源详情
资源评论
An Easy Reference for ALV Grid Control
SDN Community Contribution
(This is not an official SAP document.)
Disclaimer & Liability Notice
This document may discuss sample coding or other information that does not include SAP official
interfaces and therefore is not supported by SAP. Changes made based on this information are not
supported and can be overwritten during an upgrade.
SAP will not be held liable for any damages caused by using or misusing the information, code or
methods suggested in this document, and anyone using these methods does so at his/her own risk.
SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content
of this technical article or code sample, including any liability resulting from incompatibility between the
content within this document and the materials and services offered by SAP. You agree that you will not
hold, or seek to hold, SAP responsible or liable with respect to the content of this document.
© 2005 SAP AG 1
An Easy Reference for ALV Grid Control
Applies To:
ALV Grid control can be used as of release 4.6C. Besides consider the following official note while
utilizing this control:
SAP does not guarantee that the methods, events and attributes of this class that are not
public will remain unchanged or will be available in future releases. This is why you should
not derive the class to access protected objects of the class. Using these objects makes it
more difficult to upgrade to subsequent releases.
Summary
Purpose of this tutorial is to provide an easy and quick reference which may be used as a guide while
coding to build lists using ALV Grid Control. Actually, there is easy-to-reach information about
implementing ALV Grid lists. However, it is generally required to find the information sought in a quicker
way. This tutorial handles this, being a condensed source which can be used as a “guide”. It will not deal
with the technical infrastructure on which ALV lays. Some of the tables are taken from the online SAP
Library which is the most trustable source about the topic. Shortly, this will be a booklet summarizing
major capabilities of the ALV Grid Control.
To get deep into the ALV Grid control, you can refer to the standard SAP course “BC412 – ABAP
Dialog Programming Using EnjoySAP Controls” and the book “Controls Technology”. Also you had better
inspect demo programs.
By: Serdar ŞİMŞEKLER
Company and Title: Havelsan Inc., SAP Application Developer
Date: 24 Oct 2004
Updated on 27 June 2005
Prerequisites
To use ALV Grid Control in a simple manner, it will be sufficient just having experience on dialog
programming. However, to make use of more capabilities, it is required some knowledge on object-
oriented perspective of ABAP programming. A general knowledge on control framework is supposed to
exist.
© 2005 SAP AG 2
An Easy Reference for ALV Grid Control
Table of Contents
DISCLAIMER & LIABILITY NOTICE 1
APPLIES TO: 2
SUMMARY 2
PREREQUISITES 2
TABLE OF CONTENTS 3
INTRODUCTION 5
BUILDING BLOCKS 5
GENERAL SCHEME 5
BUILDING FIELD CATALOG 11
STRUCTURE OF A FIELD CATALOG 11
BUILDING FIELD CATALOG MANUALLY 15
BUILDING FIELD CATALOG SEMI-AUTOMATICALLY 16
LAYOUT ADJUSTMENTS 17
PRINTING ADJUSTMENTS 20
EXCLUDING UNWANTED STANDARD FUNCTION BUTTONS 21
NON-EVENT BASED ADDITIONAL FUNCTIONALITIES 23
CHANGING FIELD CATALOG OR LAYOUT AFTER FIRST DISPLAY 23
SETTING SORT CONDITIONS 24
FILTERING 25
MAKING SELECTIONS 25
RETRIEVING AND SETTING SCROLL STATUS INFO 26
COLORING 27
COLORING AN ENTIRE COLUMN 27
COLORING AN ENTIRE ROW 27
COLORING INDIVIDUAL CELLS 28
INSERTING HYPERLINKS 29
MAKING FIELDS AS DROPDOWN LISTS 30
MANAGING DISPLAY VARIANTS 32
© 2005 SAP AG 3
An Easy Reference for ALV Grid Control
EVENT BASED ADDITIONAL FUNCTIONALITIES 33
GENERAL SCHEME FOR THE EVENT HANDLER CLASS 34
HOTSPOT CLICKING 37
DOUBLE CLICKING 38
PUSHBUTTONS ON THE LIST 38
ADDING YOUR OWN FUNCTIONS 39
OVERRIDING STANDARD FUNCTIONS 42
CONTEXT MENUS 43
ABOUT PRINTING 44
A PIECE OF TROUBLESHOOTING 45
AUTHOR BIO 46
© 2005 SAP AG 4
An Easy Reference for ALV Grid Control
Introduction
Here is the definition for ALV from SAPHelp:
“The ALV Grid control is a flexible tool for displaying lists. The tool provides common list operations as
generic functions and can be enhanced by self-defined options.”
The ALV Grid control is used to build non-hierarchical, interactive, and modern-design lists. As a
control, it is a component that is installed on the local PC.
The ALV Grid control provides typical list functions as sorting, filtering, summing, etc... while also
gives the opportunity to develop user functions where needed. It presents numerous interfaces like Excel
Inplace and Crystal Reports.
The wrapper class implemented to encapsulate ALV Grid functionality is “CL_GUI_ALV_GRID”.
There is another way to display lists with ALV utilizing “REUSE_ALV...” functions. However, that way is
not comprised in this tutorial.
Building Blocks
While preparing a list to be displayed via an ALV grid control, we have some basic components to
prepare. These are;
List data: Obviously, this is the data in an internal table to be listed. Standard ALV functions except
sorting makes just read access to the list data. However, sorting changes state of the internal table. The
internal table holding list data may be of any flat type. Deep types are only allowed when set for some
functionalities of ALV Grid.
Field Catalog:
We use another internal table to define specifications on how the fields of our list will be
displayed. This internal table is called the “field catalog”. The field catalog must comprise some technical
and additional information about display options for each column to be displayed. There are three
procedures to generate the field catalog as “Automatic generation”, “Semi-automatic generation”, and
“Manual generation”. The internal table for the field catalog must be referenced to the dictionary type
“LVC_T_FCAT”.
Layout Structure:
We fill a structure to specify general layout options for the grid. With this structure we
can set general display options, grid customizing, totals options, color adjustments etc... The layout
structure must be of type “LVC_S_LAYO”.
Event Handler:
We should define and implement an event handler class if we want to handle events
triggered by the ALV Grid instance. After creating ALV Grid instance, we must register an instance of this
event handler class to handle ALV Grid events.
Additional Data:
To trigger some additional features of ALV Grid we can have some additional data to
pass as parameters. For example, initial sorting criteria, buttons to be deactivated, etc...
General Scheme
Now, we can figure out a primitive scheme to prepare our ALV Grid. As a control object, ALV Grid
instance requires a container to be linked to the screen. Generally, an instance of the class
“cl_gui_custom_container” is used for this purpose. Instances of some other container classes such
as “cl_gui_docking_container”, “cl_gui_dialogbox_container” may also be used. In our
example we take a custom container. To create a custom container instance, we need a custom control
area on the screen.
Step 1Æ Add a custom control on the screen which will be related to the custom container. Let’s give
it the name ‘CC_ALV’.
Step 2 Æ Declare global variables to be used for ALV Grid.
*-- Global data definitions for ALV
*--- ALV Grid instance reference
© 2005 SAP AG 5
剩余45页未读,继续阅读
资源评论
- ji_vicky2016-02-02初级教程,太好了。已经下载。。
半毛钱D关系
- 粉丝: 2
- 资源: 10
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功