Friday, December 17, 2010
The below sample program is used to show ALV output in the pop-up window. We call REUSE_ALV_POPUP_TO_SELECT function module by providing fieldcatalog table with information and data table to be display.
REPORT ztst_alv_popup. ********************************************************************** * Declarations. ********************************************************************** ** 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. *&---------------------------------------------------------------------* * 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. ********************************************************************** START-OF-SELECTION. PERFORM get_data. ********************************************************************** * end-of-selection. ********************************************************************** 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' it_fieldcat = i_fieldcat i_callback_program = l_program TABLES t_outtab = i_p0001. IF sy-subrc <> 0. * 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 - Sending email with pdf attachment
- ABAP - Step by step tutorial on Smart Forms - Template Node
- 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.