An ALV report is created using the standard function modules provided by SAP
- An ALV report can be created using the following steps.
- Include SLIS type pool – SLIS type pool contains all the data types required by ALV function modules.
- Data retrieval – Code the logic to fetch the data from database table into an Internal Table.
- Build Field Catalog – Add the columns into an internal that you want to display in the ALV output list.
- Pass the data table and field catalog table to ALV function module
Sample Program -TYPE-POOLS: slis. " SLIS contains all the ALV data types*&---------------------------------------------------------------------**& Data Declaration*&---------------------------------------------------------------------*DATA: it_sbook1 TYPE TABLE OF sbook.DATA: it_fieldcat1 TYPE slis_t_fieldcat_alv,wa_fieldcat1 TYPE slis_fieldcat_alv.*&---------------------------------------------------------------------**& START-OF-SELECTION*&---------------------------------------------------------------------*START-OF-SELECTION.*Fetch data from the databaseSELECT * FROM sbook INTO TABLE it_sbook1.*Build field catalogwa_fieldcat1-fieldname = 'CARRID'. " Fieldname in the data tablewa_fieldcat1-seltext_m = 'Airline'. " Column description in the outputAPPEND wa_fieldcat1 TO it_fieldcat1.wa_fieldcat1-fieldname = 'CONNID'.wa_fieldcat1-seltext_m = 'Con. No.'.APPEND wa_fieldcat1 TO it_fieldcat1.wa_fieldcat1-fieldname = 'FLDATE'.wa_fieldcat1-seltext_m = 'Date'.APPEND wa_fieldcat1TO it_fieldcat1.wa_fieldcat1-fieldname = 'BOOKID'.wa_fieldcat1-seltext_m = 'Book. ID'.APPEND wa_fieldcat1TO it_fieldcat1.wa_fieldcat1-fieldname = 'PASSNAME'.wa_fieldcat1-seltext_m = 'Passenger Name'.APPEND wa_fieldcat1TO it_fieldcat1.*Pass data and field catalog to ALV function module to display ALV listCALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'EXPORTINGit_fieldcat = it_fieldcat1TABLESt_outtab = it_sbook1EXCEPTIONSprogram_error = 1OTHERS = 2.
A dedicated platform for SAP ABAP Tutorials that would help in upscaling new skillset. Come and join us on Namaste SAP for gaining and adding skills to your career path.
Tuesday, August 1, 2017
Creation of Simple SAP ALV Report
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment