Saturday, December 18, 2010
Use function module REUSE_ALV_POPUP_TO_SELECT to be able to display in ALV in popup.
REPORT zovh_alv_popup. ** Types TYPES: BEGIN OF t_p0001, checkbox TYPE c, pernr TYPE p0001-pernr, ename TYPE p0001-ename, END OF t_p0001. ** Work Areas DATA: w_p0001 TYPE t_p0001. * Internal tables DATA: i_p0001 TYPE STANDARD TABLE OF t_p0001. PARAMETERS:p_pernr TYPE pernr-pernr. *&---------------------------------------------------------------------* * ALV Declarations *----------------------------------------------------------------------* * Types Pools TYPE-POOLS: slis. * Types TYPES: t_fieldcat TYPE slis_fieldcat_alv, t_events TYPE slis_alv_event, t_layout TYPE slis_layout_alv. * Workareas DATA: w_fieldcat TYPE t_fieldcat, w_events TYPE t_events, w_layout TYPE t_layout. * Internal Tables DATA: i_fieldcat TYPE STANDARD TABLE OF t_fieldcat, i_events TYPE STANDARD TABLE OF t_events. START-OF-SELECTION. PERFORM get_data. END-OF-SELECTION. PERFORM display_data. *&---------------------------------------------------------------------* *& Form get_data *&---------------------------------------------------------------------* FORM get_data . SELECT pernr ename FROM pa0001 INTO CORRESPONDING FIELDS OF TABLE i_p0001 UP TO 10 ROWS. ENDFORM. " get_data *&---------------------------------------------------------------------* *& Form display_data *&---------------------------------------------------------------------* FORM display_data . PERFORM build_fieldcatalog. PERFORM display_data_alv. ENDFORM. " display_data *&---------------------------------------------------------------------* *& Form display_data_alv *&---------------------------------------------------------------------* FORM display_data_alv . DATA: l_program TYPE sy-repid. l_program = sy-repid. CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT' EXPORTING i_title = 'XYZ' i_tabname = 'I_P0001' i_checkbox_fieldname = 'CHECKBOX' it_fieldcat = i_fieldcat i_callback_program = l_program TABLES t_outtab = i_p0001. IF sy-subrc = 0. DATA:i_pa0002 TYPE TABLE OF pa0002. DELETE i_p0001 WHERE checkbox NE 'X'. SELECT * FROM pa0002 INTO TABLE i_pa0002 FOR ALL ENTRIES IN i_p0001 WHERE pernr = i_p0001-pernr. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING i_callback_program = l_program i_structure_name = 'PA0002' TABLES t_outtab = i_pa0002. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. ELSE. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. ENDFORM. " display_data_alv *&---------------------------------------------------------------------* *& Form build_fieldcatalog *&---------------------------------------------------------------------* FORM build_fieldcatalog . CLEAR: w_fieldcat, i_fieldcat[]. w_fieldcat-fieldname = 'PERNR'. w_fieldcat-tabname = 'I_P0001'. w_fieldcat-seltext_m = 'Emp No'. APPEND w_fieldcat TO i_fieldcat. CLEAR w_fieldcat. w_fieldcat-fieldname = 'ENAME'. w_fieldcat-tabname = 'I_P0001'. w_fieldcat-seltext_m = 'Name'. APPEND w_fieldcat TO i_fieldcat. CLEAR w_fieldcat. ENDFORM. " build_fieldcatalog
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
tks!!!
ReplyDelete