Vous êtes sur la page 1sur 15

How to Use ALV Form Elements for Events

Copyright Copyright 2004 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iSeries, pSeries, xSeries, zSeries, z/OS, AFP, Intelligent Miner, WebSphere, Netfinity, Tivoli, and Informix are trademarks or registered trademarks of IBM Corporation in the United States and/or other countries. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MaxDB is a trademark of MySQL AB, Sweden. SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies (SAP Group) for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.

How to Use ALV Form Elements in Events

Table of Contents: 1 2 3 4 Motivation ......................................................................................................... 4 ALV Form Elements......................................................................................... 4 Header Layouts with the ALV Form Elements ............................................. 5 Using the ALV Form Elements in ALV Events ........................................... 14

How to Use ALV Form Elements in Events

1. Motivation The SAP List Viewer (ALV) provides events that allow users to add information to a list at different rendering times. The ALV form allows users to define information for the rendering times, independent of the UI and without concern for SAP ergonomic guidelines. This document describes how the ALV form can be used to display the most common layouts of a page heading. 2. ALV Form Elements The basic element of the ALV form is the abstract class CL_SALV_FORM_ELEMENT. This basic element (CL_SALV_FORM_ELEMENT) describes the information to be displayed. There are two major element types: Layout element (CL_SALV_FORM_ELEMENT_LAYOUT): the basic layout element for describing a table or a flow of information. Textual element (CL_SALV_FORM_ELEMENT_TEXTUAL): the basic element for text elements. Text elements supported are: o Label (CL_SALV_FORM_LABEL) o Text (CL_SALV_FORM_TEXT) o Header information (CL_SALV_FORM_HEADER_INFO) o Action information (CL_SALV_FORM_ACTION_INFO)

How to Use ALV Form Elements in Events

3. Header Layouts with ALV Form Elements The following layouts can be found in SAP transaction LIBS. 1. Displaying header information and object information in two columns.

In this example, three lines are required. Therefore a grid layout with one column is appropriate for holding the content of this page heading: The first line contains the header information. The second line is empty. The third line contains: A flow of label and text elements A grid with one row and four columns

How to Use ALV Form Elements in Events

a) Label and text elements.

How to Use ALV Form Elements in Events

b) The third line contains a grid with one row and four columns.

2. Displaying header information and object information in two columns with action information.

How to Use ALV Form Elements in Events

In this example, four lines are required. Therefore a grid layout with one column is appropriate for holding the content of this page heading: The first line will contain header information. The second line is empty. The third line contains: A flow of label and text elements. A grid with one row and four columns. The fourth line is empty. The fifth line will hold an action information element. The coding up to the fourth line is the same as in the first example. From the fourth line on as follows:

3. Displaying header information and object information in one column with check texts.

In this example, three lines are required. Therefore a grid layout with one column is appropriate for holding the content of this top of page: The first line will contain header information. The second line is empty. The third line will hold a grid: With three columns With two columns and the right column is a flow of elements a) The third line contains a grid of three columns.
How to Use ALV Form Elements in Events 8

How to Use ALV Form Elements in Events

b) The third line contains a grid with two columns and the right column is a flow of elements.

How to Use ALV Form Elements in Events

10

4. Displaying header information and object information in two columns with check texts.

In this example three lines are required. Therefore a grid layout with one column is appropriate for holding the content of this top of page: The first line will hold header information. The second line is empty. The third line contains: A grid of one row and two columns and in each column a grid with 3 columns A grid of two rows with six columns. a) Grid of one row and two columns, and in each column a grid with three columns.

How to Use ALV Form Elements in Events

11

How to Use ALV Form Elements in Events

12

b) A grid of two rows with six columns.

How to Use ALV Form Elements in Events

13

4. Using the ALV Form Elements in ALV Events 1. In the old ALV APIs Fullscreen Grid, Classic List and Grid. In the subroutine that handles the event TOP_OF_PAGE, END_OF_PAGE, TOP_OF_LIST, or END_OF_LIST call the static method cl_salv_form_content=>set( <content> ) and set the content. The content is always the upper element to which all of the other elements are connects. In the examples listed above, the upper element was always the grid layout lr_grid. Demonstration reports can be found in the package SALV_FORM: SALV_FORM_DEMO_USE_IN_OLD_API SALV_FORM_DEMO_LAYOUTS SALV_FORM_DEMO_FLOW_LAYOUTS 2. In the new OO-based ALV APIs.
How to Use ALV Form Elements in Events 14

This information will be handed out as soon as the new OO-based ALV API is released. A demonstration report can be found in the package SALV_OBJECTS: SALV_DEMO_ALV_FORM_EVENTS

How to Use ALV Form Elements in Events

15

Vous aimerez peut-être aussi