人法地,地法天,天法道,道法自然
分类:
2009-05-06 16:10:39
Table Control设计
Tabstrip设计:
子屏幕设计:
最终结果:
子屏幕中设计TC的代码:
REPORT ZTEST_S .
tables:zsd19info.
CONTROLS MYTAB TYPE TABSTRIP.
CONTROLS MYTABCONT TYPE TABLEVIEW USING SCREEN 110.
DATA: ok_code TYPE sy-ucomm,
save_ok TYPE sy-ucomm.
DATA number TYPE sy-dynnr.
data : fill type i,
lines type i,
limit type i.
FIELD-SYMBOLS
data: g_mytabcont_lines like sy-loopc,
l_tc_lines_name like feld-name.
mytab-activetab = 'PUSH2'.
data : begin of tc_info occurs 0,
xuhao type i,
extwg like zsd19info-extwg,
maktt like zsd19info-maktt,
end of tc_info.
data:title type string,
itab like table of tc_info with header line.
call screen 100.
*&---------------------------------------------------------------------*
*& Module STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module STATUS_0100 output.
SET PF-STATUS 'SCREEN_100'.
perform TC_INFO_INIT.
endmodule. " STATUS_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module USER_COMMAND_0100 input.
save_ok = ok_code.
* MESSAGE SAVE_OK TYPE 'S' .
CLEAR ok_code.
IF save_ok = 'OK'.
MESSAGE i888(sabapdocu) WITH 'MYTABSTRIP-ACTIVETAB ='
mytab-activetab.
ELSE.
mytab-activetab = save_ok.
CASE save_ok.
WHEN 'PUSH1'.
number = '0110'.
WHEN 'PUSH2'.
number = '0120'.
WHEN 'PUSH3'.
number = '0130'.
when 'BACK' .
LEAVE PROGRAM.
ENDCASE.
ENDIF.
endmodule. " USER_COMMAND_0100 INPUT
MODULE read_table_control INPUT.
MODIFY itab FROM tc_info INDEX mytabcont-current_line.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Module CANCEL INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module CANCEL input.
LEAVE PROGRAM.
endmodule. " CANCEL INPUT
form TC_INFO_INIT.
clear tc_info[].
clear itab[].
*clear t_chuk.
*read table
select * from zsd19info into corresponding fields of table itab .
loop at itab.
itab-xuhao = sy-tabix.
modify itab index sy-tabix.
endloop.
DESCRIBE TABLE ITAB LINES fill.
mytabcont-lines = fill.
endform.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0110 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module USER_COMMAND_0110 input.
save_ok = ok_code.
CLEAR ok_code.
* CONCATENATE 'G_' 'MYTABCONT' '_LINES' INTO L_TC_LINES_NAME.
* ASSIGN (L_TC_LINES_NAME) TO
* lines =
CASE save_ok.
when 'FIRST_PAGE'.
mytabcont-top_line = 0.
when 'PREV_PAGE'.
mytabcont-top_line = mytabcont-top_line - lines.
if mytabcont-top_line < 0.
mytabcont-top_line = 0.
endif.
when 'PREV_LINE'.
mytabcont-top_line = mytabcont-top_line - 1.
if mytabcont-top_line < 0.
mytabcont-top_line = 0.
endif.
when 'NEXT_LINE'.
mytabcont-top_line = mytabcont-top_line + 1.
limit = fill - lines + 1.
if mytabcont-top_line > limit.
mytabcont-top_line = limit.
endif.
when 'NEXT_PAGE'.
mytabcont-top_line = mytabcont-top_line + lines.
limit = fill - lines + 1 .
if mytabcont-top_line > limit .
mytabcont-top_line = limit.
endif.
when 'LAST_PAGE'.
mytabcont-top_line = fill - lines + 1.
when 'EXP' .
message '导出' type 'I' .
ENDCASE.
endmodule. " USER_COMMAND_0110 INPUT
*&---------------------------------------------------------------------*
*& Module GET_LINES OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module get_lines output. "屏幕中可见的行号,也就是每页能显示的行数
* g_mytabcont_lines = sy-loopc.
lines = sy-loopc.
endmodule. " GET_LINES OUTPUT