Tuesday, December 21, 2010
When you use ALV list display, use TOP_OF_PAGE event to display traffic lights.
REPORT ztest_alv_traffic_lights . DATA: BEGIN OF it_data OCCURS 0, matnr TYPE mard-matnr, werks TYPE mard-werks, lgort TYPE mard-lgort, END OF it_data. TYPE-POOLS: slis. 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. SELECT matnr werks lgort FROM mard INTO CORRESPONDING FIELDS OF TABLE it_data UP TO 10 ROWS. w_events-name = 'TOP_OF_PAGE'. w_events-form = 'TOP_OF_PAGE'. APPEND w_events TO i_events. CLEAR:w_fieldcat,i_fieldcat[]. w_fieldcat-fieldname = 'MATNR'. w_fieldcat-tabname = 'IT_DATA'. w_fieldcat-seltext_m = 'MATNR'. APPEND w_fieldcat TO i_fieldcat. CLEAR w_fieldcat. w_fieldcat-fieldname = 'WERKS'. w_fieldcat-tabname = 'IT_DATA'. w_fieldcat-seltext_m = 'WERKS'. APPEND w_fieldcat TO i_fieldcat. CLEAR w_fieldcat. w_fieldcat-fieldname = 'LGORT'. w_fieldcat-tabname = 'IT_DATA'. w_fieldcat-seltext_m = 'LGORT'. APPEND w_fieldcat TO i_fieldcat. CLEAR w_fieldcat. CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' EXPORTING i_callback_program = sy-repid is_layout = w_layout it_fieldcat = i_fieldcat it_events = i_events TABLES t_outtab = it_data. *&---------------------------------------------------------------------* *& Form top_of_page *&---------------------------------------------------------------------* FORM top_of_page. WRITE:/ 'top_of_page start'. WRITE:/ '@08@'," Green light; positive '@09@'," Yellow light; neutral '@0A@'." Red light; negative WRITE:/ 'top_of_page end'. ENDFORM. "top_of_page
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.