Upload
kamplia
View
213
Download
0
Embed Size (px)
Citation preview
8/7/2019 alvoops
http://slidepdf.com/reader/full/alvoops 1/8
ALV USING OOPS
8/7/2019 alvoops
http://slidepdf.com/reader/full/alvoops 2/8
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.
8/7/2019 alvoops
http://slidepdf.com/reader/full/alvoops 3/8
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 fi eld catalog or through the correspondingstructure of the Data Dictionary.
Generally, the output table contains data that you
previously selected from database tables.
8/7/2019 alvoops
http://slidepdf.com/reader/full/alvoops 4/8
Steps :
Create an instance of the ALV Grid Control andintegrate it into a screen.
Select the data to be displayed and pass it together
with a description of the fields to the instance.
8/7/2019 alvoops
http://slidepdf.com/reader/full/alvoops 5/8
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.
8/7/2019 alvoops
http://slidepdf.com/reader/full/alvoops 6/8
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.
8/7/2019 alvoops
http://slidepdf.com/reader/full/alvoops 7/8
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'.
CREATE OBJECT GRID
EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING I_ STRUCTURE_NAME = 'KNA1'
CHANGING IT_OUTTAB = T_KNA1.
ENDIF.
8/7/2019 alvoops
http://slidepdf.com/reader/full/alvoops 8/8
in the PAI Module :
IF SY-UCOMM = µE¶.
LEAVE PROGRAM.
ENDIF.