Introduction
Here is the definition for ALV from SAP Help: “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.
Building Blocks
While preparing a list to be displayed via an ALV grid control, we have some basic components to prepare.
These are;
i. 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.
ii. 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”.
iii. 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”.
iv. 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.
v. 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. Code Part 1 – Global data definitions for ALV
*-- Global data definitions for ALV
*--- ALV Grid instance reference DATA gr_alvgrid TYPE REF TO cl_gui_alv_grid .
*--- Name of the custom control added on the screen DATA gc_custom_control_name TYPE scrfname VALUE ‘CC_ALV’ . *--- Custom container instance reference DATA gr_ccontainer TYPE REF TO cl_gui_custom_container .
*--- Field catalog table DATA gt_fieldcat TYPE lvc_t_fcat .
*--- Layout structure DATA gs_layout TYPE lvc_s_layo .
Step 3
Declare your internal table which is supposed to hold the list data. Let’s name it “gt_list”. Here is an example declaration.
*--- Internal table holding list data DATA BEGIN OF gt_list OCCURS 0 . INCLUDE STRUCTURE SFLIGHT .
*--In further sections, some additional fields will added here
*--for some functionality DATA END OF gt_list .
Code Part 2
Declaration of the internal table that will hold the list data Step 4 �� Somewhere in your program before calling list display, fill your list data as you want.
Here, it is not our concern what the data are. We assume the internal table is filled reasonably.
We will use the data of table SFLIGHT as our list data. Step 5 �� Call the screen which comprises the ALV Grid control.
At PBO of this screen we will deal with creating the ALV Grid instance.
CODE Part 3
PBO of the flow logic for the screen containing ALV Grid control *--PBO PROCESS BEFORE OUTPUT . ... MODULE display_alv . ...
Code Part 4
Inside the module ... MODULE display_alv OUTPUT . PERFORM display_alv . ENDMODULE .
Step 6 �� Now, it is high time we wrote something to play. So, this piece will be the one we will deal mainly. What we do is, checking whether an instance of the container (or ALV Grid) exists.
If it exists, refreshing it, and if not, creating and setting ALV for the first display. FORM display_alv .
Tuesday, October 7, 2008
Subscribe to:
Post Comments (Atom)
Archives
-
▼
2008
(167)
-
▼
October
(145)
- SAP ALE ABAP DETIAL
- SAP ABAP ALE IDOC'S
- SAP - DIFFERENCE BETWEEN CONVERSION AND INTERFACE
- BAPI AND IDOC ALE
- SAP ABAP MESSAGE CONTORL
- SAP IDOC'S IN ABAP INTRODUCTION
- SAP ABAP IDOC'S OUTLOOK
- SAP ABAP IDOC PROCESSING
- SAP ABAP IDOC'S BASIC TOOLS I
- SAP ABAP IDOC'S BASIC TOOLS II
- SAP ABAP IDOC'S INBOUND BASIC TOOLS III
- SAP IDOC OUT BOUND TRIGGERS II
- SAP IDOCS OUTBOUND TRIGGER II
- SAP IDOC'S OUTBOUND TRIGGER III
- SAP Work flow based outbound Idoc's
- SAP ALE Change Pointers
- SAP Dispatching ALE IDocs for Change Pointers
- SAP IDOC design and Processing
- SAP Creation of the IDoc Data
- SAP Developing an Outbound IDoc Function
- SAP Converting Data into IDoc Segment Format
- SAP Partner Profiles and Ports
- SAP Defining the partner profile for ALE IDOC
- SAP Data Ports ( WE21 ) in idoc
- SAP RFC in R/3
- SAP Workflow from Change Documents
- SAP ALE Distribution Scenario
- SAP Useful ALE Transaction Codes
- BAPI Creating IDocs and ALE Interface
- R/3 RFC from MS Office Via Visual Basic
- SD WORK FLOW SCENARIOS I
- SD WORK FLOW SCENARIOS II
- SD WORK FLOW SCENARIOS III
- SD WORK FLOW SCENARIOS IV
- SD WORK FLOW SCENARIOS V
- SD WORK FLOW SCENARIOS VI
- SD WORK FLOW SCENARIOS VII
- MM WORK FLOW SCENORIOS I
- MM WORK FLOW SCENORIOS II
- MM WORK FLOW SCENORIOS III
- MM WORK FLOW SCENORIOS IV
- MM WORK FLOW SCENORIOS V
- MM WORK FLOW SCENORIOS VI
- MM WORK FLOW SCENARIOS VII
- MM WORK FLOW SCENARIOS VIII
- MM WORK FLOW SCENARIOS IX
- MM WORK FLOW SCENARIOS X
- MM WORK FLOW SCENARIOS XI
- WORK FLOW SCENARIOS in SAP ABAP
- SAP ABAP WORK FLOW I
- SAP ABAP WORK FLOW II
- SAP ABAP WORK FLOW III
- SAP ABAP Work Flow IV
- SAP ABAP Workflow Technology
- SAP OPTIMIZATION
- abap type key ward
- PERFORMENCE TIPS
- SAP ABAP INTERNAL TABLES IN BRIEF
- SAP ABAP RUN TIME ANALASIS
- MEMORY In SAP ABAP
- NAVIGATION In SAP ABAP
- WORK BENCH AND TOOLS In SAP ABAP
- DATA OBJECTS AND STATEMENTS In SAP ABAP
- INTERNAL PROGRAM MODULARIZATION In SAP ABAP
- SAP ABAP CONSITENCEY THROUGH INPUT CHECKS
- RUN TIME ENVIRONMENT In SAP ABAP
- SAP ABAP INTER TABLE OPERATIONS
- STATEMENTS In SAP ABAP
- SAP ABAP INTERNAL TABLES
- SAP ABAP SUB ROUTIENS
- SAP ABAP FUNCTION MODULES AND GROUPS
- SAP ABAP QUARY ADMINSTRATION
- SAP ABAP SAVING LISTS AND BACK GROUND PROCESSING
- SAP ABAP PROGRAM INTERFACE
- SAP ABAP LOCK CONCEPT
- SAP ABAP AUTHORISATION CHECKS
- SAP ABAP PERFORMENCE TIPS
- In SAP SYSTEM FIELDS
- SAP ABAP CONTROL BLOCKS
- SAP ABAP BUFFERING
- SAP ABAP MATCH CODE OBJECTS
- SAP ABAP LOCKS
- SAP SAMPLE CODE FOR OUTPUT TO EXCEL AND IN PUT FIL...
- SAP MULTIPLE INTERACTIVE REPORT SAMPLE CODE
- MULTIPLE INTERACTIVE REPORT SAMPLE CODE II
- CALLING PROGRAM AND PASSING DATA
- SAP TECHNIQUES FOR LIST CREATION AND SAP QUARY
- SAP SELECTION SCREENS ABAP REPORT
- SAP ABAP FAQ ON SCRIPTS I
- SAP ABAP FAQ ON SCRIPTS II
- SAP ABAP FAQ ON SCRIPTS III
- IN SAP ABAP TABLE TYPES
- SAP ABAP TYPES OF VIEWS
- SAP ABAP DATA BASE UPDATES COMPLETE
- SAP ABAP LOCK CONCEPT
- SAP ORGANIZING DATABASE UPDATES
- SAP ENHANCEMENTS TO DICTIONERY ELEMENTS
- DATA BASE DIALOG IN ABAP
- ABAP DICTIONARY I
- PERFORMANCE DURING TABLE ACCESS
-
▼
October
(145)
No comments:
Post a Comment