g_repid = sy-repid.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = g_repid
i_callback_pf_status_set = 'STATUS_SET'
i_callback_user_command = 'ALV_USER_COMMAND'
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME = I_STRUCTURE_NAME
* I_BACKGROUND_ID = ' '
i_grid_title = 'TITLE'
* I_GRID_SETTINGS = I_GRID_SETTINGS
is_layout = wa_layout
it_fieldcat = t_fieldcat[]
* IT_EXCLUDING = IT_EXCLUDING
* IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
* IT_SORT = IT_SORT
* IT_FILTER = IT_FILTER
* IS_SEL_HIDE = IS_SEL_HIDE
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT = IS_VARIANT
* it_events = gt_xevents
* IT_EVENT_EXIT = IT_EVENT_EXIT
* IS_PRINT = IS_PRINT
* IS_REPREP_ID = IS_REPREP_ID
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS = IT_ALV_GRAPHICS
* IT_HYPERLINK = IT_HYPERLINK
* IT_ADD_FIELDCAT = IT_ADD_FIELDCAT
* IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
* IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
* ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
tables
t_outtab = t_out
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
*&---------------------------------------------------------------------*
*& Form status_set
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PT_EXTAB text
*----------------------------------------------------------------------*
form status_set using pt_extab type slis_t_extab. "#EC CALLED
set pf-status 'ALV_STATUS'.
endform.
*&---------------------------------------------------------------------*
*& Form alv_user_command
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->L_UCOMM text
* -->L_SELFIELD text
*----------------------------------------------------------------------*
form alv_user_command using
l_ucomm like sy-ucomm
l_selfield type slis_selfield.
case l_ucomm.
when 'SAVE'.
data:l_text(50) type c value
'Confirm update database?',
l_answer type c.
perform month_check.
call function 'POPUP_TO_CONFIRM'
exporting
titlebar = 'Warning'
text_question = l_text
text_button_1 = 'Yes'
text_button_2 = 'No'
default_button = '2'
display_cancel_button = 'X'
importing
answer = l_answer
exceptions
text_not_found = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
if l_answer = '1'.
......
else.
.......
leave screen.
endif.
else.
exit.
endif.
endcase.
endform. "alv_user_command
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = g_repid
i_callback_pf_status_set = 'STATUS_SET'
i_callback_user_command = 'ALV_USER_COMMAND'
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME = I_STRUCTURE_NAME
* I_BACKGROUND_ID = ' '
i_grid_title = 'TITLE'
* I_GRID_SETTINGS = I_GRID_SETTINGS
is_layout = wa_layout
it_fieldcat = t_fieldcat[]
* IT_EXCLUDING = IT_EXCLUDING
* IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
* IT_SORT = IT_SORT
* IT_FILTER = IT_FILTER
* IS_SEL_HIDE = IS_SEL_HIDE
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT = IS_VARIANT
* it_events = gt_xevents
* IT_EVENT_EXIT = IT_EVENT_EXIT
* IS_PRINT = IS_PRINT
* IS_REPREP_ID = IS_REPREP_ID
* I_SCREEN_START_COLUMN = 0
* I_SCREEN_START_LINE = 0
* I_SCREEN_END_COLUMN = 0
* I_SCREEN_END_LINE = 0
* I_HTML_HEIGHT_TOP = 0
* I_HTML_HEIGHT_END = 0
* IT_ALV_GRAPHICS = IT_ALV_GRAPHICS
* IT_HYPERLINK = IT_HYPERLINK
* IT_ADD_FIELDCAT = IT_ADD_FIELDCAT
* IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
* IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
* ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
tables
t_outtab = t_out
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
*&---------------------------------------------------------------------*
*& Form status_set
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PT_EXTAB text
*----------------------------------------------------------------------*
form status_set using pt_extab type slis_t_extab. "#EC CALLED
set pf-status 'ALV_STATUS'.
endform.
*&---------------------------------------------------------------------*
*& Form alv_user_command
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->L_UCOMM text
* -->L_SELFIELD text
*----------------------------------------------------------------------*
form alv_user_command using
l_ucomm like sy-ucomm
l_selfield type slis_selfield.
case l_ucomm.
when 'SAVE'.
data:l_text(50) type c value
'Confirm update database?',
l_answer type c.
perform month_check.
call function 'POPUP_TO_CONFIRM'
exporting
titlebar = 'Warning'
text_question = l_text
text_button_1 = 'Yes'
text_button_2 = 'No'
default_button = '2'
display_cancel_button = 'X'
importing
answer = l_answer
exceptions
text_not_found = 1
others = 2.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
if l_answer = '1'.
......
else.
.......
leave screen.
endif.
else.
exit.
endif.
endcase.
endform. "alv_user_command
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21122155/viewspace-578422/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/21122155/viewspace-578422/