ALV REPORTS:
First we have to known about the reports.Those are used for the column alignment,sorting,filtering,totals,exports etc.As it like ALV features same like this.Let we start the below for one by one step ALV.
ALV Means:
ALV is called by the version based.It is called from SAP 4.6C Version, ALV- SAP List Viewer and Prior to 4.6c Version, called as an ALV- ABAP List Viewer.
ALV Features:
1)This set of ALV functions can help choose selected columns and arrange the different columns from report output and also save different variants for report display.
2)This is a very efficient tool for dynamically sorting and arranging the columns from a report ouput.
3)To implement these, less of coding and logic is required.
4)This work approches by the Function modules.
ALV Work approaches:
In this two types of approaches there.
1)Procedural
2)Object oriented.
1)Procedural:
It is doing by the function modules.It means it is used the function modules for reducing the code.In this different types of function modules there.
i)Simple ALV
ii)BLOCKED ALV
iii)Hirearchical Sequential ALV.
i)Simple alv contains the 2 types is there like reports.Those are classical and interactive alvs.
Classical :
Filling an events internal table with the list of events to be handled and pass that internal table to FM: REUSE_ALV_GRID_DISPLAY (or) REUSE_ALV_LIST_DISPLAY.
ii)Interactive:
Iteractive has selected the Line contents,Field name,Field value of type SLIS_SELIFIELD. Those are based on the selection screen information FILED: TABINDEX, SELFIELD, VALUE.
iii)Blocked ALV:
This is used to display Multiple lists continuously one after one as a BLOCK. It is used the function module as REUSE_ALV_BLOCK_LIST_INIT.
iv)Hirearchical Sequential ALV:
It is to display the master (Header) data and Transactional(iteam) data in the same alv.It is used the function module as REUSE_ALV_HIERSER_LIST_DISPLAY.
Sample Programme:\
CREATE ONE INCLUDE PROGRAME zdemo_alv_top..
Type-POOLS SLIS.
Data: It_ekko like table of EKKO, "Purchase Documents.
WA_EKKO like ekko, "Purchasing Documents
IT_EKKO LIKE TABLE OF EKPO, "Purchase Doc Items
It_csks like Table of csks, "costs center data
It_events type SLIS_T_EVENT, "EVENTS TABLE
WA_EVENTS TYPE SLIS_ALV_EVENT,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
IT_T001 LIKE TABLE OF T001,
IT_KNB1 LIKE TABLE OF KNB1,
LIST_LAYOUT type SLIS_LAYOUT_ALV,
GS_KEYINFO TYPE SLIS_KEYINFO_ALV.
Main Programe:
report zdemo_display_cost_centers.
Include zdemo_alv_top.
SATRT-OF-SELECTION.
SELECT * INTO TABLE it_cska from csks up to 15 rows.
Perform fill_events_table.
end-of-selection.
perform display_data_using_grid.
Form display_data_using_grid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORING
I_CALLBACK_PROGRAM = SY-CPROG "name of the calling programe
I_STRUCTURE_NAME = 'CSKS'
IT_EVENTS = IT_EVENTS
Tables
t_outtab = it_csks
endform.
Form fill_events_table.
clear wa_events.
wa_events-name = 'TOP_OF_PAGE'.
WA_EVENTS-FORM = 'PRINT_HEADING'.
APPEND WA_EVENTS TO IT_EVENTS.
ENDFORM.
FORM PRINT_HEADING.
DATA IT_HEADINGS TYPE SLIS_T_LISTHEADER.
DATA WA_HEADINGS LIKE LINE OF IT_HEADINGS.
CLEAR WA_HEADINGS.
WA_HEADINGS-TYP = 'H'.
wa_headings-info = 'LIst of Cost Cneters'.
Append wa_headings to it_headings.
call fucntion 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_HEADINGS
IT_LOGO = 'WorldNatureTrues'.
ENDFORM.
First we have to known about the reports.Those are used for the column alignment,sorting,filtering,totals,exports etc.As it like ALV features same like this.Let we start the below for one by one step ALV.
ALV Means:
ALV is called by the version based.It is called from SAP 4.6C Version, ALV- SAP List Viewer and Prior to 4.6c Version, called as an ALV- ABAP List Viewer.
ALV Features:
1)This set of ALV functions can help choose selected columns and arrange the different columns from report output and also save different variants for report display.
2)This is a very efficient tool for dynamically sorting and arranging the columns from a report ouput.
3)To implement these, less of coding and logic is required.
4)This work approches by the Function modules.
ALV Work approaches:
In this two types of approaches there.
1)Procedural
2)Object oriented.
1)Procedural:
It is doing by the function modules.It means it is used the function modules for reducing the code.In this different types of function modules there.
i)Simple ALV
ii)BLOCKED ALV
iii)Hirearchical Sequential ALV.
i)Simple alv contains the 2 types is there like reports.Those are classical and interactive alvs.
Classical :
Filling an events internal table with the list of events to be handled and pass that internal table to FM: REUSE_ALV_GRID_DISPLAY (or) REUSE_ALV_LIST_DISPLAY.
ii)Interactive:
Iteractive has selected the Line contents,Field name,Field value of type SLIS_SELIFIELD. Those are based on the selection screen information FILED: TABINDEX, SELFIELD, VALUE.
iii)Blocked ALV:
This is used to display Multiple lists continuously one after one as a BLOCK. It is used the function module as REUSE_ALV_BLOCK_LIST_INIT.
iv)Hirearchical Sequential ALV:
It is to display the master (Header) data and Transactional(iteam) data in the same alv.It is used the function module as REUSE_ALV_HIERSER_LIST_DISPLAY.
Sample Programme:\
CREATE ONE INCLUDE PROGRAME zdemo_alv_top..
Type-POOLS SLIS.
Data: It_ekko like table of EKKO, "Purchase Documents.
WA_EKKO like ekko, "Purchasing Documents
IT_EKKO LIKE TABLE OF EKPO, "Purchase Doc Items
It_csks like Table of csks, "costs center data
It_events type SLIS_T_EVENT, "EVENTS TABLE
WA_EVENTS TYPE SLIS_ALV_EVENT,
IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
IT_T001 LIKE TABLE OF T001,
IT_KNB1 LIKE TABLE OF KNB1,
LIST_LAYOUT type SLIS_LAYOUT_ALV,
GS_KEYINFO TYPE SLIS_KEYINFO_ALV.
Main Programe:
report zdemo_display_cost_centers.
Include zdemo_alv_top.
SATRT-OF-SELECTION.
SELECT * INTO TABLE it_cska from csks up to 15 rows.
Perform fill_events_table.
end-of-selection.
perform display_data_using_grid.
Form display_data_using_grid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORING
I_CALLBACK_PROGRAM = SY-CPROG "name of the calling programe
I_STRUCTURE_NAME = 'CSKS'
IT_EVENTS = IT_EVENTS
Tables
t_outtab = it_csks
endform.
Form fill_events_table.
clear wa_events.
wa_events-name = 'TOP_OF_PAGE'.
WA_EVENTS-FORM = 'PRINT_HEADING'.
APPEND WA_EVENTS TO IT_EVENTS.
ENDFORM.
FORM PRINT_HEADING.
DATA IT_HEADINGS TYPE SLIS_T_LISTHEADER.
DATA WA_HEADINGS LIKE LINE OF IT_HEADINGS.
CLEAR WA_HEADINGS.
WA_HEADINGS-TYP = 'H'.
wa_headings-info = 'LIst of Cost Cneters'.
Append wa_headings to it_headings.
call fucntion 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_HEADINGS
IT_LOGO = 'WorldNatureTrues'.
ENDFORM.