This document describes how to use object-oriented programming (OOPS) to create an ALV grid control to display data from an internal table in SAP. It involves: 1) Declaring reference variables for the grid and container; 2) Selecting data into an internal table; 3) Creating the screen with a custom container; 4) Creating the grid control and associating it with the container and internal table in the process before output (PBO) module. The grid control displays the internal table data.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
33 views8 pages
Alv Oops
This document describes how to use object-oriented programming (OOPS) to create an ALV grid control to display data from an internal table in SAP. It involves: 1) Declaring reference variables for the grid and container; 2) Selecting data into an internal table; 3) Creating the screen with a custom container; 4) Creating the grid control and associating it with the container and internal table in the process before output (PBO) module. The grid control displays the internal table data.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 8
ALV USING OOPS
Instance for the ALV Grid Control
This instance is defined with reference to class cl_gui_alv_grid
data <name of reference variable> type ref to cl_gui_alv_grid.
As a minimum, you must provide the following two types
of information for displaying the data: An internal table with the data to be displayed, called the output table A description of the structure of this data that is declared to the ALV Grid Control through the field catalog or through the corresponding structure of the Data Dictionary.
Generally, the output table contains data that you
previously selected from database tables.
Steps :
Create an instance of the ALV Grid Control and
integrate it into a screen.
Select the data to be displayed and pass it together
with a description of the fields to the instance.
1. Declare reference variables for the ALV Grid Control
and the container. In addition, declare an internal table that you fill with selected data later on: DATA: grid TYPE REF TO cl_gui_alv_grid, g_cust_container TYPE REF TO cl_gui_custom_container, t_kna1 TYPE TABLE OF kna1.
2. In the main program,
SELECT * FROM KNA1 INTO TABLE T_KNA1.
CALL SCREEN 100.
3. Create the screen 100. On the layout, paint a
custom container and name it as CCONTAINER. Provide an Exit Button on the layout.
In the Flow Logic : Call a module in PBO and another
module in PAI. In the program, in the PBO Module : IF G_CUSTOM_CONTAINER IS INITIAL. CREATE OBJECT G_CUSTOM_CONTAINER EXPORTING CONTAINER_NAME = 'CCONTAINER'.