Tuesday, December 28, 2010
Internal Table to be shown on table control should have one field(CHECK in the below example) for check box on table control.
Flow logic of screen 1001.
Report ztest_program. *--------------------------------------------------------------------------* "Table control related declaration *--------------------------------------------------------------------------* CONTROLS tchkbox TYPE TABLEVIEW USING SCREEN 1001 . DATA: BEGIN OF it_nfal OCCURS 0, check TYPE c, einri TYPE nfal-einri, falnr TYPE nfal-falnr, falar TYPE nfal-falar, patnr TYPE nfal-patnr, bekat TYPE nfal-bekat, END OF it_nfal. DATA:ok_code TYPE sy-ucomm. START-OF-SELECTION. call screen 1001. *&---------------------------------------------------------------------* *& Module STATUS_1001 OUTPUT *&---------------------------------------------------------------------* MODULE status_1001 OUTPUT. SET PF-STATUS 'ZTEST_PROGRAM'. * SET TITLEBAR 'xxx'. ENDMODULE. " STATUS_1001 OUTPUT *&---------------------------------------------------------------------* *& Module GET_DATA_FROM_NFAL OUTPUT *&---------------------------------------------------------------------* MODULE get_data_from_nfal OUTPUT. IF it_nfal[] IS INITIAL. SELECT * FROM nfal INTO CORRESPONDING FIELDS OF TABLE it_nfal WHERE einri EQ 'KKH'. ENDIF. ENDMODULE. " GET_DATA_FROM_NFAL OUTPUT *&---------------------------------------------------------------------* *& Module USER_COMMAND_1001 INPUT *&---------------------------------------------------------------------* MODULE user_command_1001 INPUT. CLEAR ok_code. ok_code = sy-ucomm. CASE ok_code. WHEN 'BACK' OR 'EXIT' OR 'CANCEL'. LEAVE TO SCREEN 0. WHEN 'DELETE'. LOOP AT it_nfal WHERE check = 'X'. DELETE it_nfal. ENDLOOP. WHEN 'SELECTALL'. LOOP AT it_nfal. it_nfal-check = 'X'. MODIFY it_nfal INDEX sy-tabix TRANSPORTING check. ENDLOOP. WHEN 'DSELECTALL'. LOOP AT it_nfal. it_nfal-check = space. MODIFY it_nfal INDEX sy-tabix TRANSPORTING check. ENDLOOP. ENDCASE. ENDMODULE. " USER_COMMAND_1001 INPUT *&---------------------------------------------------------------------* *& Module READ_TABLE_CONTROL INPUT *&---------------------------------------------------------------------* MODULE read_table_control INPUT. MODIFY it_nfal INDEX tchkbox-current_line. ENDMODULE. " READ_TABLE_CONTROL INPUT
Flow logic of screen 1001.
*PBO process before output. module status_1001. MODULE get_data_from_nfal. LOOP AT it_nfal WITH CONTROL tchkbox. ENDLOOP. *PAI process after input. LOOP AT it_nfal. MODULE read_table_control. ENDLOOP. module user_command_1001.
Followers
Popular Posts
- ABAP - ALV Report example with steps
- ABAP - Step by step tutorial on Smart Forms - Template Node
- ABAP - Sending email with pdf attachment
- SAP Adobe Form - Steps to create simple ADOBE Form and calling it from ABAP Program
- SAP ABAP - CL_ABAP_CHAR_UTILITIES class usage
- ABAP - Multiple value selection from F4 help for SELECT-OPTIONS
- Execute ABAP Report using SUBMIT statement
- ABAP - Select all or Deselect all in ALV or Check box handling in ALV
- Web Dynpro ABAP ALV - ON_CLICK event
- ABAP - Dynamic WHERE clause
This Tutorial is extremely helpful on Table Control with check boxes and i am really impressed and benefited from this.
ReplyDeleteThank a lot for whom so ever has sent this .
Prashanth
Thanks Prashanth.
ReplyDeleteHi, what if there is a secondary list to be displayed based on the values checkboxed in the basic list, then how do we go about it?
ReplyDelete