w_exit(1) type c,
w_user_specic(1) type c,
w_callback_ucomm type slis_formname, "字符型
w_print type slis_print_alv, "类型组
w_layout type slis_layout_alv, "类型组
w_html_top_of_page type slis_formname, "字符型
w_eldcat_alv like line of i_eldcat_alv,
w_excluding like line of i_excluding,
w_events like line of i_events,
w_event_exit like line of i_event_exit,
w_list_comments like line of i_list_comments.
*=============================================
==============================*
initialization.
perform init_variant. “这个子函数很重要,没有它会出错
*-----------------------------------------*
它对应的start-of-selection中定义子函数如下:
start-of-selection.
perform getdata. “从数据库中取数据到相应内表中
perform event_build.
perform layout_build. “用于定义ALV表单的相关格式、属性
perform elds. “用来定义表单中的各个列的相关信息,比如列名等
perform display_data. “用来显示ALV表单
*-----------------------------------------*
子函数定义如下:(这里只定义前面文档没有提到的子函数,其他同名的请参考前面)
form init_variant.
clear: w_variant.
w_repid = sy-repid. “当前程序
w_variant-report = w_repid.
w_variant-username = sy-uname.
w_variant_save = 'A'. "All types
endform.
form event_build.
call function 'REUSE_ALV_EVENTS_GET'
exporting
i_list_type = 0
importing
et_events = i_events.
read table i_events
with key name = slis_ev_top_of_page
into w_events.
if sy-subrc = 0.