ALV TABLE-COTROL
1.画屏幕
2.流逻辑
CONTROLS gr_9112_control TYPE TABLEVIEW USING SCREEN 9112. PROCESS BEFORE OUTPUT. MODULE status_9112. *处理LOOP从内表读到表控制 LOOP WITH CONTROL gr_9112_control. MODULE filltbl1_9112. ENDLOOP. PROCESS AFTER INPUT. *处理LOOP从表控制更新内表 LOOP WITH CONTROL gr_9112_control. MODULE readtbl1_9112. ENDLOOP. MODULE user_command_9112. MODULE exit_9112 AT EXIT-COMMAND. *&---------------------------------------------------------------------* *& Module STATUS_9112 OUTPUT *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* MODULE status_9112 OUTPUT. SET PF-STATUS 'STATUS_9112'. SET TITLEBAR 'TITLE_9112'. DESCRIBE TABLE gt_belnr LINES gv_lines. IF gv_lines < 13. gr_9112_control-lines = 13. ELSE. gr_9112_control-lines = gv_lines. ENDIF. ENDMODULE. *&---------------------------------------------------------------------* *& Module FILLTBL1_9112 OUTPUT *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* MODULE filltbl1_9112 OUTPUT. READ TABLE gt_belnr INTO gs_belnr INDEX gr_9112_control-current_line. ENDMODULE. *&---------------------------------------------------------------------* *& Module READTBL1_9112 INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE readtbl1_9112 INPUT. PERFORM readtbl1_9112. ENDMODULE. *&---------------------------------------------------------------------* *& Form readtbl1_9112 *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-- p2 text *&---------------------------------------------------------------------* FORM readtbl1_9112 . IF gr_9112_control-current_line <= lines( gt_belnr ). MODIFY gt_belnr FROM gs_belnr INDEX gr_9112_control-current_line. ELSE. APPEND gs_belnr TO gt_belnr. ENDIF. ENDFORM. *&---------------------------------------------------------------------* *& Form frm_user_command_9112 *&---------------------------------------------------------------------* *& text *&---------------------------------------------------------------------* *& --> p1 text *& <-- p2 text *&---------------------------------------------------------------------* FORM frm_user_command_9112 . CLEAR:gv_ok_code. gv_ok_code = ok_code. CLEAR:ok_code. CASE gv_ok_code. WHEN 'CREA_ITEML'. PERFORM frm_crea_iteml. LEAVE TO SCREEN 0. ENDCASE. ENDFORM. *&---------------------------------------------------------------------* *& Module EXIT_9112 INPUT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* MODULE exit_9112 INPUT. CLEAR:gv_ok_code. gv_ok_code = ok_code. CLEAR:ok_code. CASE gv_ok_code. WHEN 'ZCANCEL'. LEAVE TO SCREEN 0. ENDCASE. ENDMODULE.