You are on page 1of 3

A simple program on ALV OOPS - SAP Community Network Wiki https://wiki.sdn.sap.com/wiki/pages/viewpage.action?spaceKey=Snippet...

Code Gallery

A simple program on ALV OOPS


Added by Amuktha Naraparaju , last edited by Hareesh Menon on Feb 17, 2009 (view change)
Labels: abap, alv, oops

1 of 3 9/14/2010 12:17
A simple program on ALV OOPS - SAP Community Network Wiki https://wiki.sdn.sap.com/wiki/pages/viewpage.action?spaceKey=Snippet...

REPORT zalv1.
********Data declarations with respect to classes
DATA :
t_cust TYPE REF TO cl_gui_custom_container,
t_grid TYPE REF TO cl_gui_alv_grid .
*******Declaration of Structure with respect to SPFLI
TYPES:
BEGIN OF type_s_flight,
carrid TYPE spfli-carrid,
connid TYPE spfli-connid,
END OF type_s_flight.
*******Fieldstring Declaration
DATA:
fs_flight TYPE type_s_flight.

******Table Declaration
DATA:
t_flight LIKE STANDARD TABLE OF fs_flight.
*******Declarations with respect to ALV
DATA:
t_fcat TYPE lvc_t_fcat, " Field Catalog for List Viewer Control
w_fcat TYPE lvc_s_fcat, " ALV control: Field catalog
w_lay TYPE lvc_s_layo . " ALV control: Layout structure
********Select Query to retrive values from table SPFLI
SELECT *
FROM spfli
INTO CORRESPONDING FIELDS OF TABLE t_flight.
*******Calling the screen that has been designed in SE51 in the following manner
******* Goto SE51,design a layout and give the name of the container (ZALV01)
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* Module that has been called from SE51
*----------------------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'BACK'.
SET TITLEBAR 'FLIGHT'.
ENDMODULE. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module ALV_OUTPUT OUTPUT
*&---------------------------------------------------------------------*
* Module that has been created in SE51 and called
*----------------------------------------------------------------------*
MODULE alv_output OUTPUT.
*****Appending data to t_fcat
w_fcat-fieldname = 'CARRID'.
w_fcat-coltext = 'Carrid'.
APPEND w_fcat TO t_fcat.
w_fcat-fieldname = 'CONNID'.
w_fcat-coltext = 'Connid'.
APPEND w_fcat TO t_fcat.
*******Create a object of class 'CL_GUI_CUSTOM_CONTAINER'
CREATE OBJECT t_cust
EXPORTING
* parent =
container_name = 'ZALV01'
* style =
* lifetime = lifetime_default
* repid =
* dynnr =

2 of 3 9/14/2010 12:17
A simple program on ALV OOPS - SAP Community Network Wiki https://wiki.sdn.sap.com/wiki/pages/viewpage.action?spaceKey=Snippet...

Contact Us Site Index Marketing Opportunities Legal Terms Privacy Impressum


Powered by SAP NetWeaver

3 of 3 9/14/2010 12:17

You might also like