Monday, December 20, 2010
This sample program shows check box and DISPLAY button on report output. When you select checkbox and click on display button, selected records are displayed.
REPORT zovh_alv_row_selection. "Variables DATA: BEGIN OF it_output OCCURS 0, select TYPE c, "This variable stores the value when row selected bukrs TYPE t001-bukrs, butxt TYPE t001-butxt, END OF it_output. TYPE-POOLS:slis. DATA: it_events TYPE STANDARD TABLE OF slis_alv_event, it_fieldcat TYPE STANDARD TABLE OF slis_fieldcat_alv, wa_fieldcat TYPE slis_fieldcat_alv, wa_events TYPE slis_alv_event, wa_layout TYPE slis_layout_alv. DATA:g_program TYPE sy-repid VALUE sy-repid. START-OF-SELECTION. SELECT * FROM t001 INTO CORRESPONDING FIELDS OF TABLE it_output UP TO 100 ROWS. "Field Catalog creation DEFINE fieldcatalog. wa_fieldcat-fieldname = &1. wa_fieldcat-tabname = &2. wa_fieldcat-seltext_l = &3. append wa_fieldcat to it_fieldcat. clear wa_fieldcat. END-OF-DEFINITION. fieldcatalog: "Column table col text 'BUKRS' 'IT_OUTPUT' 'BUKRS', 'BUTXT' 'IT_OUTPUT' 'BUTXT'. "Layout design wa_layout-box_fieldname = 'SELECT'. "This has to be set to get selection wa_layout-colwidth_optimize = 'X'. "Events tables wa_events-name = 'PF_STATUS_SET'. wa_events-form = 'PF_STATUS_SET'. APPEND wa_events TO it_events. CLEAR wa_events. wa_events-name = 'USER_COMMAND'. wa_events-form = 'USER_COMMAND'. APPEND wa_events TO it_events. CLEAR wa_events. "Table Display in ALV format CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' EXPORTING i_callback_program = g_program is_layout = wa_layout it_fieldcat = it_fieldcat it_events = it_events TABLES t_outtab = it_output. *&---------------------------------------------------------------------* *& Form PF_STATUS_SET *&---------------------------------------------------------------------* FORM pf_status_set USING rt_extab TYPE slis_t_extab. SET PF-STATUS 'ZTEST'. * 1. When you set Pf status ZTEST, standard application tools will be removed. * 2. Goto SE41 give program 'SAPLKKBL' and status 'STANDARD_FULLSCREEN'. * 3. Copy the status from those to ZTEST of our program. Now you will see all standard functions. ENDFORM. "PF_STATUS_SET *------------------------------------------------------------------* * FORM USER_COMMAND * *------------------------------------------------------------------* FORM user_command USING r_ucomm LIKE sy-ucomm rs_selfield TYPE slis_selfield. * Check function code CASE r_ucomm. WHEN 'DISPLAY'. "user presses SAVE LOOP AT it_output. IF it_output-select EQ 'X'. "Process records that have been selected WRITE:/ it_output. ENDIF. ENDLOOP. ENDCASE. 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
a hearty thanks to the author of the program..
ReplyDelete