Professional Documents
Culture Documents
com]
sent: tuesday, november 12, 2002 7:42 pm
to: abap@yahoogroups.com
subject: re: [abap] alv list
thanks for the response.
simon
--------------------------------------------------------
report ztotal_keyed_ads line-size 120 no standard page
heading.
* list based
type-pools : slis.
*--------------------------- constants
-------------------------------*
* grid list data
constants: gc_formname_top_of_page type slis_formname
value
'top_of_page'.
* alv data
data: gt_list_top_of_page type slis_t_listheader,
* gt_sort type slis_t_sortinfo_alv,
g_user_command type slis_formname value
'user_command',
gt_fieldcat type slis_t_fieldcat_alv,
gs_layout type slis_layout_alv,
gt_events type slis_t_event.
*----------------------------------------------------------------------*
initialization.
move: '20020101' to s_date-low,
'20020102' to s_date-high,
'i' to s_date-sign,
'bt' to s_date-option.
append s_date.
* intialization
perform fieldcat_init using gt_fieldcat[].
* event
perform eventtab_build using gt_events[].
* heading
perform comment_build using gt_list_top_of_page[].
* sorting
* perform t_sort_build using gt_sort[].
break sli.
* layout festlegen
perform layout_build using gs_layout.
end-of-selection.
*---------------------------------------------------------------------*
* form fieldcat_init
*
*---------------------------------------------------------------------*
* aufbau des feldkataloges
*
*---------------------------------------------------------------------*
* --> lt_fieldcat
*
*---------------------------------------------------------------------*
form fieldcat_init using e01_lt_fieldcat type
slis_t_fieldcat_alv.
*&---------------------------------------------------------------------*
*& form pc_fld
*&---------------------------------------------------------------------*
form pc_fld using value(row) type i value(col) type i
value(field) type c value(heading)
type c
value(len) type i value(direction)
type c
value(tabname) type c value(is_sum)
type c.
clear w_fld.
*---------------------------------------------------------------------*
* form comment_build
*
*---------------------------------------------------------------------*
* list-kommentare
*
*---------------------------------------------------------------------*
* --> lt_top_of_page
*
*---------------------------------------------------------------------*
form comment_build using lt_top_of_page type
slis_t_listheader.
clear ls_line.
perform create_headline using '21' changing ls_line.
ls_line-typ = 's'.
ls_line-key = ' '.
*&---------------------------------------------------------------------*
*& form top_standard
*&---------------------------------------------------------------------*
* standard top_of_page
*
*----------------------------------------------------------------------*
form create_headline using offset type stat_offset
changing ls_line type
slis_listheader.
data: w_day type scal-indicator,
w_weekname type t246-langt,
w_shortname(3) type c,
w_datstr type string.
w_shortname = w_weekname(3).
translate w_shortname+1(2) to lower case.
concatenate '(' w_shortname ')' into w_datstr.
condense string.
move string to ls_line+offset.
endform. " top_standard
*---------------------------------------------------------------------*
* form eventtab_build
*
*---------------------------------------------------------------------*
* --> lt_events
*
*---------------------------------------------------------------------*
form eventtab_build using lt_events type slis_t_event.
data: ls_event type slis_alv_event.
*
call function 'reuse_alv_events_get'
exporting
i_list_type = 0
importing
et_events = lt_events.
if sy-subrc = 0.
move gc_formname_top_of_page to ls_event-form.
append ls_event to lt_events.
endif.
endform. " eventtab_build
*---------------------------------------------------------------------*
* form t_sort_build
*
*---------------------------------------------------------------------*
* sortierung
*
*---------------------------------------------------------------------*
* --> lt_sort
*
*---------------------------------------------------------------------*
form t_sort_build using lt_sort type
slis_t_sortinfo_alv.
data: ls_sort type slis_sortinfo_alv.
*
ls_sort-fieldname = 'ad_type'.
ls_sort-spos = 1.
ls_sort-up = 'x'.
* ls_sort-subtot = 'x'.
append ls_sort to lt_sort.
*
ls_sort-fieldname = 'ad_creat'.
ls_sort-spos = 2.
ls_sort-up = 'x'.
* ls_sort-subtot = 'x'.
append ls_sort to lt_sort.
*---------------------------------------------------------------------*
* form layout_build
*
*---------------------------------------------------------------------*
* layout-gestaltung
*
*---------------------------------------------------------------------*
* <-> ls_layout
*
*---------------------------------------------------------------------*
form layout_build using ls_layout type
slis_layout_alv.
* ls_layout-f2code = p_f2code.
ls_layout-f2code = '&eta'.
ls_layout-key_hotspot = 'x'.
ls_layout-detail_popup = 'x'.
ls_layout-get_selinfos = 'x'.
endform.
*&---------------------------------------------------------------------*
*& form user_comman
*&---------------------------------------------------------------------*
*& user command
*&---------------------------------------------------------------------*
form user_command using ucomm like sy-ucomm
selfield type
slis_selfield.
case ucomm.
when '&ic1'.
clear ucomm.
endcase.
endform.
*---------------------------------------------------------------------*
* form top_of_page
*
*---------------------------------------------------------------------*
* event 'top_of_page'
form top_of_page.
*
call function 'reuse_alv_commentary_write'
exporting
it_list_commentary = gt_list_top_of_page.
endform. " top_of_page
*&---------------------------------------------------------------------*
*& form get_data
*&---------------------------------------------------------------------*
form get_data.
* sap order
refresh: it_detail.
select erfuser avm_nr pstyv breite hoehe from jhaga
into wa_detail
where ber_termin in s_date and gf_status <> '01'.
endat.
w_count = w_count + 1.
w_size = w_size + wa_detail-breite *
wa_detail-hoehe.
at end of erfuser.
if wa_detail-pstyv = '0013'.
wa_summary-ad_type = 'adpower'.
else.
wa_summary-ad_type = 'sap'.
endif.
wa_summary-ad_num = w_count.
wa_summary-ad_size = w_size.
wa_summary-ad_creat = wa_detail-erfuser.
append wa_summary to it_summary.
endat.
endloop.
endform. " get_data