type-pools slis.
data: begin of i_alv occurs 0,
matnr type mara-matnr,
meins like mara-meins,
mtart like mara-mtart,
pstat like mara-pstat,
mbrsh like mara-mbrsh,
matkl like mara-matkl,
WRKST like mara-WRKST,
end of i_alv.
* Miscellanous Data Declarations
data: fieldcat type slis_t_fieldcat_alv,
events type slis_t_event,
list_top_of_page type slis_t_listheader,
top_of_page type slis_formname value 'TOP_OF_PAGE'.
start-of-selection.
perform initialization.
perform get_data.
perform call_alv.
end-of-selection.
***********************************************************************
* Form Initialization
***********************************************************************
form initialization.
clear i_alv. refresh i_alv.
perform eventtab_build using events[].
endform.
***********************************************************************
* Form Get_Data
***********************************************************************
form get_data.
select matnr meins mtart pstat MBRSH MATKL WRKST into table i_alv
from mara up to 100 rows.
endform.
***********************************************************************
* CALL_ALV
***********************************************************************
form call_alv.
data: variant type disvariant.
data: repid type sy-repid.
repid = sy-repid.
variant-report = sy-repid.
variant-username = sy-uname.
perform build_field_catalog.
perform comment_build using list_top_of_page[].
* Call ABAP List Viewer (ALV)
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
it_fieldcat = fieldcat
i_callback_program = repid
is_variant = variant
it_events = events[]
i_save = 'U'
tables
t_outtab = i_alv.
endform.
***********************************************************************
* EVENTTAB_BUILD
***********************************************************************
form eventtab_build using events type slis_t_event.
* Registration of events to happen during list display
data: tmp_event type slis_alv_event.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = events.
read table events with key name = slis_ev_top_of_page
into tmp_event.
if sy-subrc = 0.
move top_of_page to tmp_event-form.
append tmp_event to events.
endif.
endform.
***********************************************************************
* BUILD_FIELD_CATALOG
***********************************************************************
form build_field_catalog.
clear: fieldcat. refresh: fieldcat.
data: tmp_fc type slis_fieldcat_alv.
tmp_fc-reptext_ddic = 'Material'.
tmp_fc-fieldname = 'MATNR'.
tmp_fc-tabname = 'I_ALV'.
tmp_fc-outputlen = 18.
append tmp_fc to fieldcat.
tmp_fc-reptext_ddic = 'Unit of measure'.
tmp_fc-fieldname = 'MEINS'.
tmp_fc-tabname = 'I_ALV'.
tmp_fc-outputlen = 18.
append tmp_fc to fieldcat.
tmp_fc-reptext_ddic = 'Material type'.
tmp_fc-fieldname = 'MTART'.
tmp_fc-tabname = 'I_ALV'.
tmp_fc-outputlen = 18.
append tmp_fc to fieldcat.
tmp_fc-reptext_ddic = 'Material status'.
tmp_fc-fieldname = 'PSTAT'.
tmp_fc-tabname = 'I_ALV'.
tmp_fc-outputlen = 18.
append tmp_fc to fieldcat.
tmp_fc-reptext_ddic = 'INDUSTRY SECTOR'.
tmp_fc-fieldname = 'MBRSH'.
tmp_fc-tabname = 'I_ALV'.
tmp_fc-outputlen = 18.
append tmp_fc to fieldcat.
tmp_fc-reptext_ddic = 'Material GROUP'.
tmp_fc-fieldname = 'MATKL'.
tmp_fc-tabname = 'I_ALV'.
tmp_fc-outputlen = 18.
append tmp_fc to fieldcat.
tmp_fc-reptext_ddic = 'Basic Material'.
tmp_fc-fieldname = 'WRKST'.
tmp_fc-tabname = 'I_ALV'.
tmp_fc-outputlen = 18.
append tmp_fc to fieldcat.
endform.
***********************************************************************
* COMMENT_BUILD
***********************************************************************
form comment_build using list_top_of_page type
slis_t_listheader.
data: tmp_line type slis_listheader.
clear tmp_line.
tmp_line-typ = 'H'.
tmp_line-info = 'this is venkat test program'.
append tmp_line to list_top_of_page.
clear tmp_line.
tmp_line-typ = 'S'.
tmp_line-key = 'you can practise it'.
tmp_line-info = 'TRY THIS'.
append tmp_line to list_top_of_page.
clear tmp_line.
tmp_line-typ = 'A'.
tmp_line-key = 'all the best '.
tmp_line-info = 'have a nice day'.
append tmp_line to list_top_of_page.
endform.
***********************************************************************
* TOP_OF_PAGE
***********************************************************************
form top_of_page.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = 'ENJOYSAP_LOGO'
it_list_commentary = list_top_of_page.
endform.
ALSO READ:
- Change Of ALV Grid/ List Layout (VARIANT).
- Repeating Colors In ALV Grid/List Display.
- Display Data From MARA Table In ALV Grid Display.
- Convert ALV Rows Into Column.
..... Back To Index On ALV List/ Grid Display.
..... Back To MAIN INDEX.
No comments:
Post a Comment