REPORT zsummIconExample .
TYPE-POOLS: slis. " SLIS contains all the ALV data types
*&---------------------------------------------------------------------*
*& Data Declaration
*&---------------------------------------------------------------------*
DATA: it_sbook TYPE TABLE OF sbook.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
*&---------------------------------------------------------------------*
*& START-OF-SELECTION
*&---------------------------------------------------------------------*
START-OF-SELECTION.
*Fetch data from the database
SELECT * FROM sbook INTO TABLE it_sbook.
*Build field catalog
wa_fieldcat-fieldname = 'CARRID'. " Fieldname in the data table
wa_fieldcat-seltext_m = 'Airline'. " Column description in the output
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'CONNID'.
wa_fieldcat-seltext_m = 'Con. No.'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'FLDATE'.
wa_fieldcat-seltext_m = 'Date'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'BOOKID'.
wa_fieldcat-seltext_m = 'Book. ID'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'PASSNAME'.
wa_fieldcat-seltext_m = 'Passenger Name'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'LOCCURAM'.
wa_fieldcat-seltext_m = 'Price'.
*Calculate Total for Price
wa_fieldcat-do_sum = 'X'.
wa_fieldcat-datatype = 'QUAN'.
APPEND wa_fieldcat TO it_fieldcat.
*Pass data and field catalog to ALV function module to display ALV list
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_sbook
EXCEPTIONS
program_error = 1
OTHERS = 2.
TYPE-POOLS: slis. " SLIS contains all the ALV data types
*&---------------------------------------------------------------------*
*& Data Declaration
*&---------------------------------------------------------------------*
DATA: it_sbook TYPE TABLE OF sbook.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv.
*&---------------------------------------------------------------------*
*& START-OF-SELECTION
*&---------------------------------------------------------------------*
START-OF-SELECTION.
*Fetch data from the database
SELECT * FROM sbook INTO TABLE it_sbook.
*Build field catalog
wa_fieldcat-fieldname = 'CARRID'. " Fieldname in the data table
wa_fieldcat-seltext_m = 'Airline'. " Column description in the output
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'CONNID'.
wa_fieldcat-seltext_m = 'Con. No.'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'FLDATE'.
wa_fieldcat-seltext_m = 'Date'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'BOOKID'.
wa_fieldcat-seltext_m = 'Book. ID'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'PASSNAME'.
wa_fieldcat-seltext_m = 'Passenger Name'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'LOCCURAM'.
wa_fieldcat-seltext_m = 'Price'.
*Calculate Total for Price
wa_fieldcat-do_sum = 'X'.
wa_fieldcat-datatype = 'QUAN'.
APPEND wa_fieldcat TO it_fieldcat.
*Pass data and field catalog to ALV function module to display ALV list
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = it_fieldcat
TABLES
t_outtab = it_sbook
EXCEPTIONS
program_error = 1
OTHERS = 2.
SAP ABAP training is provided in CHENNAI.
ReplyDeleteTHE CREATING EXPERTS is one of the leading trainer in SAP who provides real time training
http://thecreatingexperts.com/sap-abap-training-in-chennai/
contact 8122241286