Monday, December 20, 2010
Use USER_COMMAND event in ALV to set SELECT ALL / DESELECT ALL button on ALV output.
REPORT ztest. DATA: BEGIN OF it_t100 OCCURS 0, checkbox LIKE abgr-kzart, arbgb LIKE t100-arbgb, msgnr LIKE t100-msgnr, text LIKE t100-text, END OF it_t100. DATA: program TYPE sy-repid VALUE sy-repid. TYPE-POOLS slis. DATA: it_fieldcat TYPE slis_t_fieldcat_alv, wa_fieldcat LIKE LINE OF it_fieldcat. DEFINE fieldcatalog. wa_fieldcat-fieldname = &1. wa_fieldcat-tabname = 'IT_T100'. wa_fieldcat-checkbox = &2. wa_fieldcat-edit = &3. wa_fieldcat-seltext_m = &4. append wa_fieldcat to it_fieldcat. clear wa_fieldcat. END-OF-DEFINITION. START-OF-SELECTION. SELECT * FROM t100 INTO TABLE it_t100 UP TO 100 ROWS. fieldcatalog: 'CHECKBOX' 'X' 'X' 'CHECKBOX', 'ARBGB' '' '' 'ARBGB' , 'MSGNR' '' '' 'MSGNR' , 'TEXT' '' '' 'TEXT' . CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' EXPORTING i_callback_program = program i_callback_pf_status_set = 'PF_STATUS_SET' i_callback_user_command = 'USER_COMMAND' it_fieldcat = it_fieldcat TABLES t_outtab = it_t100. *&---------------------------------------------------------------------* *& Form PF_STATUS_SET *&---------------------------------------------------------------------* FORM pf_status_set USING rt_extab TYPE slis_t_extab. SET PF-STATUS 'STATUS' EXCLUDING rt_extab. ENDFORM. "PF_STATUS_SET *&---------------------------------------------------------------------* *& Form user_command *&---------------------------------------------------------------------* FORM user_command USING ucomm TYPE sy-ucomm selfield TYPE slis_selfield. IF ucomm = 'SEL_ALL'. LOOP AT it_t100. it_t100-checkbox = 'X'. MODIFY it_t100 INDEX sy-tabix. ENDLOOP. selfield-refresh = 'X'. ELSEIF ucomm = 'DESEL_ALL'. LOOP AT it_t100. it_t100-checkbox = space. MODIFY it_t100 INDEX sy-tabix. ENDLOOP. selfield-refresh = 'X'. ENDIF. ENDFORM. "user_command
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
0 comments:
Post a Comment
Your useful comments, suggestions are appreciated.Your comments are moderated.