您的位置:首页 > 其它

ABAP图标查询实例,貌似很垃圾

2011-08-19 16:39 218 查看
*&---------------------------------------------------------------------*

*& Report ZTEST34

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

REPORT ztest34 NO STANDARD PAGE HEADING.

*-----------------------------------------------------------------------

*... This report demonstrates tooltips in ALV

* For color encoding, two options exist:

* - a length 1 encoding ranging from 0 to 7 corresponding to the ABAP colors

* - a length 3 encoding like in the ALV fieldcatalog for colors (parameter emphasize):

* code xyz corresponds to

* x: ABAP color number (like length 1 encoding)

* y: intensified on - 1 - intensified off - 0 -

* z: inverse on - 1 - inverse off - 0 -

*

*

* - cl_salv_table (Fullscreen Grid, Fullscreen List, Grid)

*-----------------------------------------------------------------------

TYPE-POOLS: col,

icon,

sym.

TYPES: BEGIN OF g_type_s_test,

amount TYPE i,

repid TYPE syrepid,

display TYPE i,

dynamic TYPE sap_bool,

END OF g_type_s_test.

CONSTANTS: gc_true TYPE sap_bool VALUE 'X',

BEGIN OF gc_s_display,

list TYPE i VALUE 1,

fullscreen TYPE i VALUE 2,

grid TYPE i VALUE 3,

END OF gc_s_display.

DATA: gs_test TYPE g_type_s_test.

TYPES: BEGIN OF gs_outtab.

TYPES: lights TYPE char1,

color TYPE i,

tabcol TYPE lvc_t_scol,

id TYPE char25,

name TYPE icon-name,

symbol TYPE icon-id,

END OF gs_outtab.

DATA: gt_outtab TYPE STANDARD TABLE OF gs_outtab.

* ... and a model class object

DATA: gr_grid TYPE REF TO cl_gui_alv_grid.

* if you want to display the data table on your own Dynpro, you also need a container

DATA: gr_container TYPE REF TO cl_gui_custom_container,

gs_layout TYPE lvc_s_layo,

gt_fieldcat TYPE lvc_t_fcat.

DATA: g_okcode TYPE syucomm.

DATA: gt_exc TYPE TABLE OF alv_s_qinf.

DATA: text TYPE string.

text = text-b01.

*----------------------------------------------------------------------*

* SELECTION-SCREEN - for demonstration purposes only *

*----------------------------------------------------------------------*

SELECTION-SCREEN BEGIN OF BLOCK gen WITH FRAME.

PARAMETERS:

p_amount TYPE i DEFAULT 20.

SELECTION-SCREEN END OF BLOCK gen.

SELECTION-SCREEN BEGIN OF BLOCK dsp WITH FRAME.

PARAMETERS:

p_full RADIOBUTTON GROUP dsp,

p_list RADIOBUTTON GROUP dsp,

p_grid RADIOBUTTON GROUP dsp.

SELECTION-SCREEN END OF BLOCK dsp.

*----------------------------------------------------------------------*

* START-OF-SELECTION *

*----------------------------------------------------------------------*

START-OF-SELECTION.

gs_test-amount = p_amount.

gs_test-repid = sy-repid.

CASE gc_true.

WHEN p_list.

gs_test-display = gc_s_display-list.

WHEN p_full.

gs_test-display = gc_s_display-fullscreen.

WHEN p_grid.

gs_test-display = gc_s_display-grid.

ENDCASE.

*----------------------------------------------------------------------*

* END-OF-SELECTION *

*----------------------------------------------------------------------*

END-OF-SELECTION.

PERFORM select_data.

CASE gs_test-display.

WHEN gc_s_display-fullscreen.

PERFORM display_fullscreen.

WHEN gc_s_display-grid.

PERFORM display_grid.

WHEN gc_s_display-list.

PERFORM display_list.

ENDCASE.

*&---------------------------------------------------------------------*

*& Form select_data

*&---------------------------------------------------------------------*

* §2 to display the data, you first have to select it in some table

*----------------------------------------------------------------------*

FORM select_data.

* select icons

SELECT * FROM icon INTO CORRESPONDING FIELDS OF TABLE gt_outtab

UP TO gs_test-amount ROWS.

ENDFORM. " select_data

*&---------------------------------------------------------------------*

*& Form display_fullscreen

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

FORM display_fullscreen .

DATA: ls_layout TYPE slis_layout_alv,

lt_fcat TYPE slis_t_fieldcat_alv,

ls_fcat TYPE slis_fieldcat_alv.

ls_layout-lights_tabname = '1'.

ls_layout-lights_fieldname = 'LIGHTS'.

ls_layout-coltab_fieldname = 'TABCOL'.

CLEAR ls_fcat.

ls_fcat-fieldname = 'LIGHTS'.

ls_fcat-inttype = 'C'.

ls_fcat-seltext_l = text-hl4.

ls_fcat-seltext_m = text-hl4.

ls_fcat-seltext_s = text-hl4.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'COLOR'.

ls_fcat-inttype = 'I'.

ls_fcat-seltext_l = text-hl3.

ls_fcat-seltext_m = text-hl3.

ls_fcat-seltext_s = text-hl3.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'ID'.

ls_fcat-inttype = 'C'.

ls_fcat-seltext_l = text-hl1.

ls_fcat-seltext_m = text-hl1.

ls_fcat-seltext_s = text-hl1.

ls_fcat-icon = abap_true.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'SYMBOL'.

ls_fcat-inttype = 'C'.

ls_fcat-seltext_l = text-hl2.

ls_fcat-seltext_m = text-hl2.

ls_fcat-seltext_s = text-hl2.

ls_fcat-symbol = abap_true.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'NAME'.

ls_fcat-tech = abap_true.

APPEND ls_fcat TO lt_fcat.

PERFORM select_data.

PERFORM set_tooltips.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

* I_INTERFACE_CHECK = ' '

* I_BYPASSING_BUFFER = ' '

* I_BUFFER_ACTIVE = ' '

* I_CALLBACK_PROGRAM = ' '

* I_CALLBACK_PF_STATUS_SET = ' '

* I_CALLBACK_USER_COMMAND = ' '

* I_CALLBACK_TOP_OF_PAGE = ' '

* I_CALLBACK_HTML_TOP_OF_PAGE = ' '

* I_CALLBACK_HTML_END_OF_LIST = ' '

* I_STRUCTURE_NAME =

* I_BACKGROUND_ID = ' '

* I_GRID_TITLE =

* I_GRID_SETTINGS =

is_layout = ls_layout

it_fieldcat = lt_fcat

* IT_EXCLUDING =

* IT_SPECIAL_GROUPS =

* IT_SORT =

* IT_FILTER =

* IS_SEL_HIDE =

* I_DEFAULT = 'X'

* I_S***E = ' '

* IS_VARIANT =

* IT_EVENTS =

* IT_EVENT_EXIT =

* IS_PRINT =

* IS_REPREP_ID =

* I_SCREEN_START_COLUMN = 0

* I_SCREEN_START_LINE = 0

* I_SCREEN_END_COLUMN = 0

* I_SCREEN_END_LINE = 0

* I_HTML_HEIGHT_TOP = 0

* I_HTML_HEIGHT_END = 0

* IT_ALV_GRAPHICS =

* IT_HYPERLINK =

* IT_ADD_FIELDCAT =

it_except_qinfo = gt_exc

* IR_SALV_FULLSCREEN_ADAPTER =

* IMPORTING

* E_EXIT_CAUSED_BY_CALLER =

* ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = gt_outtab

EXCEPTIONS

program_error = 1

OTHERS = 2

.

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_fullscreen

*&---------------------------------------------------------------------*

*& Form display_list

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

FORM display_list .

DATA: ls_layout TYPE slis_layout_alv,

lt_fcat TYPE slis_t_fieldcat_alv,

ls_fcat TYPE slis_fieldcat_alv.

ls_layout-lights_tabname = '1'.

ls_layout-lights_fieldname = 'LIGHTS'.

ls_layout-coltab_fieldname = 'TABCOL'.

CLEAR ls_fcat.

ls_fcat-fieldname = 'LIGHTS'.

ls_fcat-inttype = 'C'.

ls_fcat-seltext_l = text-hl4.

ls_fcat-seltext_m = text-hl4.

ls_fcat-seltext_s = text-hl4.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'COLOR'.

ls_fcat-inttype = 'I'.

ls_fcat-seltext_l = text-hl3.

ls_fcat-seltext_m = text-hl3.

ls_fcat-seltext_s = text-hl3.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'ID'.

ls_fcat-inttype = 'C'.

ls_fcat-seltext_l = text-hl1.

ls_fcat-seltext_m = text-hl1.

ls_fcat-seltext_s = text-hl1.

ls_fcat-icon = abap_true.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'SYMBOL'.

ls_fcat-inttype = 'C'.

ls_fcat-seltext_l = text-hl2.

ls_fcat-seltext_m = text-hl2.

ls_fcat-seltext_s = text-hl2.

ls_fcat-symbol = abap_true.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'NAME'.

ls_fcat-tech = abap_true.

APPEND ls_fcat TO lt_fcat.

PERFORM select_data.

PERFORM set_tooltips.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

* I_INTERFACE_CHECK = ' '

* I_BYPASSING_BUFFER = ' '

* I_BUFFER_ACTIVE = ' '

* I_CALLBACK_PROGRAM = ' '

* I_CALLBACK_PF_STATUS_SET = ' '

* I_CALLBACK_USER_COMMAND = ' '

* I_CALLBACK_TOP_OF_PAGE = ' '

* I_CALLBACK_HTML_TOP_OF_PAGE = ' '

* I_CALLBACK_HTML_END_OF_LIST = ' '

* I_STRUCTURE_NAME =

* I_BACKGROUND_ID = ' '

* I_GRID_TITLE =

* I_GRID_SETTINGS =

is_layout = ls_layout

it_fieldcat = lt_fcat

* IT_EXCLUDING =

* IT_SPECIAL_GROUPS =

* IT_SORT =

* IT_FILTER =

* IS_SEL_HIDE =

* I_DEFAULT = 'X'

* I_S***E = ' '

* IS_VARIANT =

* IT_EVENTS =

* IT_EVENT_EXIT =

* IS_PRINT =

* IS_REPREP_ID =

* I_SCREEN_START_COLUMN = 0

* I_SCREEN_START_LINE = 0

* I_SCREEN_END_COLUMN = 0

* I_SCREEN_END_LINE = 0

* I_HTML_HEIGHT_TOP = 0

* I_HTML_HEIGHT_END = 0

* IT_ALV_GRAPHICS =

* IT_HYPERLINK =

* IT_ADD_FIELDCAT =

it_except_qinfo = gt_exc

* IR_SALV_FULLSCREEN_ADAPTER =

* IMPORTING

* E_EXIT_CAUSED_BY_CALLER =

* ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = gt_outtab

EXCEPTIONS

program_error = 1

OTHERS = 2

.

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_list

*&--------------------------------------------------------------------*

*& Form display_grid

*&--------------------------------------------------------------------*

* text

*---------------------------------------------------------------------*

FORM display_grid.

CALL SCREEN 100.

ENDFORM. "display_grid

*&---------------------------------------------------------------------*

*& Module d0100_pbo OUTPUT

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

MODULE d0100_pbo OUTPUT.

PERFORM d0100_pbo.

ENDMODULE. " d0100_pbo OUTPUT

*&---------------------------------------------------------------------*

*& Module d0100_pai INPUT

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

MODULE d0100_pai INPUT.

PERFORM d0100_pai.

ENDMODULE. " d0100_pai INPUT

*&---------------------------------------------------------------------*

*& Form d0100_pbo

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

FORM d0100_pbo .

SET PF-STATUS 'D0100'.

IF gr_container IS NOT BOUND.

*§3a for displaying the data in your own Dynpro, create a container ...

CREATE OBJECT gr_container

EXPORTING

container_name = 'CONTAINER'.

CREATE OBJECT gr_grid

EXPORTING i_parent = gr_container.

DATA: ls_layout TYPE lvc_s_layo,

lt_fcat TYPE lvc_t_fcat,

ls_fcat TYPE lvc_s_fcat.

ls_layout-excp_fname = 'LIGHTS'.

ls_layout-ctab_fname = 'TABCOL'.

CLEAR ls_fcat.

ls_fcat-fieldname = 'LIGHTS'.

ls_fcat-inttype = 'C'.

ls_fcat-scrtext_l = text-hl4.

ls_fcat-scrtext_m = text-hl4.

ls_fcat-scrtext_s = text-hl4.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'COLOR'.

ls_fcat-inttype = 'I'.

ls_fcat-scrtext_l = text-hl3.

ls_fcat-scrtext_m = text-hl3.

ls_fcat-scrtext_s = text-hl3.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'ID'.

ls_fcat-inttype = 'C'.

ls_fcat-scrtext_l = text-hl1.

ls_fcat-scrtext_m = text-hl1.

ls_fcat-scrtext_s = text-hl1.

ls_fcat-icon = abap_true.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'SYMBOL'.

ls_fcat-inttype = 'C'.

ls_fcat-scrtext_l = text-hl2.

ls_fcat-scrtext_m = text-hl2.

ls_fcat-scrtext_s = text-hl2.

ls_fcat-symbol = abap_true.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'NAME'.

ls_fcat-tech = abap_true.

APPEND ls_fcat TO lt_fcat.

PERFORM select_data.

* perform set_tooltips.

DATA: lt_tooltips TYPE lvc_t_qinf,

lt_toolb TYPE ui_functions,

ls_toolb TYPE ui_func.

ls_toolb = cl_gui_alv_grid=>mc_fc_call_crbatch.

APPEND ls_toolb TO lt_toolb.

lt_tooltips = gt_exc.

CALL METHOD gr_grid->set_table_for_first_display

EXPORTING

is_layout = ls_layout

it_except_qinfo = lt_tooltips

it_toolbar_excluding = lt_toolb

CHANGING

it_fieldcatalog = lt_fcat

it_outtab = gt_outtab.

ENDIF.

ENDFORM. " d0100_pbo

*&---------------------------------------------------------------------*

*& Form d0100_pai

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

FORM d0100_pai .

CASE g_okcode.

WHEN 'BACK'.

PERFORM set_tooltips.

* CALL METHOD gr_grid->refresh_table_display.

DATA ls_stbl TYPE lvc_s_stbl.

ls_stbl-row = 'X'.

CALL METHOD gr_grid->refresh_table_display

EXPORTING

is_stable = ls_stbl.

WHEN 'EXIT' OR 'CANC'.

SET SCREEN 0.

LE***E SCREEN.

ENDCASE.

ENDFORM. " d0100_pai

*&--------------------------------------------------------------------*

*& Form show_salv_function

*&--------------------------------------------------------------------*

* text

*---------------------------------------------------------------------*

FORM show_salv_function USING value(i_function) TYPE salv_de_function.

CASE i_function.

WHEN 'TEST'.

ENDCASE.

ENDFORM. " show_salv_function

*&---------------------------------------------------------------------*

*& Form display

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM display .

PERFORM set_tooltips.

ENDFORM. " display

*&---------------------------------------------------------------------*

*& Form set_tooltips

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM set_tooltips .

DATA: ls_symbol TYPE icon,

lt_symbol TYPE STANDARD TABLE OF icon,

ls_exc TYPE alv_s_qinf.

DEFINE mac_get_symbol.

ls_symbol-id = &2.

ls_symbol-name = &1.

append ls_symbol to lt_symbol.

END-OF-DEFINITION.

mac_get_symbol sym_space ' ' ." SPACE

mac_get_symbol sym_plus_box '!' ." box with plus inside

mac_get_symbol sym_minus_box '"' ." box with minus inside

mac_get_symbol sym_plus_circle '#' ." circle with plus inside

mac_get_symbol sym_minus_circle '$' ." circle with minus inside

mac_get_symbol sym_filled_square '%' ." filled square

mac_get_symbol sym_half_filled_square '&' ." half-filled square

mac_get_symbol sym_square '''' ." empty square

mac_get_symbol sym_filled_circle '(' ." filled circle

mac_get_symbol sym_half_filled_circle ')' ." half-filled circle

mac_get_symbol sym_circle '*' ." empty circle

mac_get_symbol sym_filled_diamond '+' ." filled diamond

mac_get_symbol sym_diamond ',' ." empty diamond

mac_get_symbol sym_bold_x '.' ." diagonal cross (cancel)

mac_get_symbol sym_note '/ '." word balloon, note

mac_get_symbol sym_document '0' ." document

mac_get_symbol sym_checked_document '1' ." document with checkmark

mac_get_symbol sym_documents '2 '." double documents

mac_get_symbol sym_folder '3 '." folder

mac_get_symbol sym_plus_folder '4 '." folder with plus inside

mac_get_symbol sym_minus_folder '5 '." folder with minus inside

mac_get_symbol sym_open_folder '6 '." open folder

mac_get_symbol sym_bold_minus '7' ." bold minus sign

mac_get_symbol sym_bold_plus '8' ." bold plus sign

mac_get_symbol sym_checkbox '9 '." selected checkbox

mac_get_symbol sym_radiobutton ': '." selected radiobutton

mac_get_symbol sym_left_triangle ';' ." triangle pointing left

mac_get_symbol sym_right_triangle '<' ." triangle pointing right

mac_get_symbol sym_up_triangle '=' ." triangle pointing up

mac_get_symbol sym_down_triangle '>' ." triangle pointing down

mac_get_symbol sym_left_hand '? '." hand pointing left

mac_get_symbol sym_left_arrow 'A' ." left arrow

mac_get_symbol sym_right_arrow 'B' ." right arrow

mac_get_symbol sym_up_arrow 'C' ." up arrow

mac_get_symbol sym_down_arrow 'D' ." down arrow

mac_get_symbol sym_check_mark 'E' ." check mark

mac_get_symbol sym_pencil 'F' ." pencil

mac_get_symbol sym_glasses 'G '." glasses

mac_get_symbol sym_locked 'H' ." closed padlock

mac_get_symbol sym_unlocked 'I' ." open padlock

mac_get_symbol sym_phone 'J '." telephone

mac_get_symbol sym_printer 'K '." printer

mac_get_symbol sym_fax 'L '." fax machine

mac_get_symbol sym_asterisk 'M' ." asterisk

mac_get_symbol sym_right_hand 'N '." hand pointing right

mac_get_symbol sym_sorted_up 'O '." sorted ascending

mac_get_symbol sym_sorted_down 'P '." sorted descending

mac_get_symbol sym_cumulated 'Q '." cumulated

mac_get_symbol sym_delete 'R' ." delete mark

mac_get_symbol sym_executable 'S '." executable

mac_get_symbol sym_workflow_item 'T '." workflow-object

mac_get_symbol sym_caution 'U '." caution

mac_get_symbol sym_flash 'V' ." express, urgent

mac_get_symbol sym_large_square 'W '." large empty square

mac_get_symbol sym_ellipsis 'X'. " ellipsis (...)

* fill the symbols, colors in to table and set tooltips

FIELD-SYMBOLS: <outtab> TYPE gs_outtab.

DATA: tooltips TYPE REF TO cl_salv_tooltips,

settings TYPE REF TO cl_salv_functional_settings,

value TYPE char128,

text TYPE char40,

tabix TYPE sy-tabix,

col TYPE lvc_s_scol.

LOOP AT gt_outtab ASSIGNING <outtab>.

tabix = sy-tabix.

READ TABLE lt_symbol INDEX sy-tabix INTO ls_symbol.

<outtab>-symbol = ls_symbol-id.

value = <outtab>-id(3).

text = <outtab>-name.

CONCATENATE value 'Q' text '@' INTO value.

<outtab>-id = value.

value = ls_symbol-id.

text = ls_symbol-name.

ls_exc-type = cl_salv_tooltip=>c_type_symbol.

ls_exc-value = value.

ls_exc-text = text.

APPEND ls_exc TO gt_exc.

<outtab>-color = tabix MOD 7 + 1.

<outtab>-lights = tabix MOD 3 + 1.

col-fname = 'COLOR'.

col-color-col = tabix MOD 7 + 1.

IF tabix GE 7.

col-color-inv = 1.

ENDIF.

IF tabix GE 14.

col-color-int = 1.

ENDIF.

APPEND col TO <outtab>-tabcol.

ENDLOOP.

ls_exc-type = cl_salv_tooltip=>c_type_exception.

ls_exc-value = '1'.

ls_exc-text = text-et1.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_exception.

ls_exc-value = '2'.

ls_exc-text = text-et2.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_exception.

ls_exc-value = '3'.

ls_exc-text = text-et3.

APPEND ls_exc TO gt_exc.

* length 3 encoding for colors

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '110'.

ls_exc-text = text-ct1.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '210'.

ls_exc-text = text-ct2.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '310'.

ls_exc-text = text-ct3.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '410'.

ls_exc-text = text-ct4.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '510'.

ls_exc-text = text-ct5.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '610'.

ls_exc-text = text-ct6.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '710'.

ls_exc-text = text-ct7.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '101'.

ls_exc-text = text-ct1.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '201'.

ls_exc-text = text-ct2.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '301'.

ls_exc-text = text-ct3.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '401'.

ls_exc-text = text-ct4.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '501'.

ls_exc-text = text-ct5.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '601'.

ls_exc-text = text-ct6.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '701'.

ls_exc-text = text-ct7.

APPEND ls_exc TO gt_exc.

* simple length 1 encoding for colors - corresponds to intensified and inverse off

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '1'.

ls_exc-text = text-ct1.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '2'.

ls_exc-text = text-ct2.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '3'.

ls_exc-text = text-ct3.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '4'.

ls_exc-text = text-ct4.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '5'.

ls_exc-text = text-ct5.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '6'.

ls_exc-text = text-ct6.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '7'.

ls_exc-text = text-ct7.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '0'.

ls_exc-text = text-ct0.

APPEND ls_exc TO gt_exc.

ENDFORM. " set_tooltips

*&---------------------------------------------------------------------*

*& Report ZTEST34

*&

*&---------------------------------------------------------------------*

*&

*&

*&---------------------------------------------------------------------*

REPORT ztest34 NO STANDARD PAGE HEADING.

*-----------------------------------------------------------------------

*... This report demonstrates tooltips in ALV

* For color encoding, two options exist:

* - a length 1 encoding ranging from 0 to 7 corresponding to the ABAP colors

* - a length 3 encoding like in the ALV fieldcatalog for colors (parameter emphasize):

* code xyz corresponds to

* x: ABAP color number (like length 1 encoding)

* y: intensified on - 1 - intensified off - 0 -

* z: inverse on - 1 - inverse off - 0 -

*

*

* - cl_salv_table (Fullscreen Grid, Fullscreen List, Grid)

*-----------------------------------------------------------------------

TYPE-POOLS: col,

icon,

sym.

TYPES: BEGIN OF g_type_s_test,

amount TYPE i,

repid TYPE syrepid,

display TYPE i,

dynamic TYPE sap_bool,

END OF g_type_s_test.

CONSTANTS: gc_true TYPE sap_bool VALUE 'X',

BEGIN OF gc_s_display,

list TYPE i VALUE 1,

fullscreen TYPE i VALUE 2,

grid TYPE i VALUE 3,

END OF gc_s_display.

DATA: gs_test TYPE g_type_s_test.

TYPES: BEGIN OF gs_outtab.

TYPES: lights TYPE char1,

color TYPE i,

tabcol TYPE lvc_t_scol,

id TYPE char25,

name TYPE icon-name,

symbol TYPE icon-id,

END OF gs_outtab.

DATA: gt_outtab TYPE STANDARD TABLE OF gs_outtab.

* ... and a model class object

DATA: gr_grid TYPE REF TO cl_gui_alv_grid.

* if you want to display the data table on your own Dynpro, you also need a container

DATA: gr_container TYPE REF TO cl_gui_custom_container,

gs_layout TYPE lvc_s_layo,

gt_fieldcat TYPE lvc_t_fcat.

DATA: g_okcode TYPE syucomm.

DATA: gt_exc TYPE TABLE OF alv_s_qinf.

DATA: text TYPE string.

text = text-b01.

*----------------------------------------------------------------------*

* SELECTION-SCREEN - for demonstration purposes only *

*----------------------------------------------------------------------*

SELECTION-SCREEN BEGIN OF BLOCK gen WITH FRAME.

PARAMETERS:

p_amount TYPE i DEFAULT 20.

SELECTION-SCREEN END OF BLOCK gen.

SELECTION-SCREEN BEGIN OF BLOCK dsp WITH FRAME.

PARAMETERS:

p_full RADIOBUTTON GROUP dsp,

p_list RADIOBUTTON GROUP dsp,

p_grid RADIOBUTTON GROUP dsp.

SELECTION-SCREEN END OF BLOCK dsp.

*----------------------------------------------------------------------*

* START-OF-SELECTION *

*----------------------------------------------------------------------*

START-OF-SELECTION.

gs_test-amount = p_amount.

gs_test-repid = sy-repid.

CASE gc_true.

WHEN p_list.

gs_test-display = gc_s_display-list.

WHEN p_full.

gs_test-display = gc_s_display-fullscreen.

WHEN p_grid.

gs_test-display = gc_s_display-grid.

ENDCASE.

*----------------------------------------------------------------------*

* END-OF-SELECTION *

*----------------------------------------------------------------------*

END-OF-SELECTION.

PERFORM select_data.

CASE gs_test-display.

WHEN gc_s_display-fullscreen.

PERFORM display_fullscreen.

WHEN gc_s_display-grid.

PERFORM display_grid.

WHEN gc_s_display-list.

PERFORM display_list.

ENDCASE.

*&---------------------------------------------------------------------*

*& Form select_data

*&---------------------------------------------------------------------*

* §2 to display the data, you first have to select it in some table

*----------------------------------------------------------------------*

FORM select_data.

* select icons

SELECT * FROM icon INTO CORRESPONDING FIELDS OF TABLE gt_outtab

UP TO gs_test-amount ROWS.

ENDFORM. " select_data

*&---------------------------------------------------------------------*

*& Form display_fullscreen

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

FORM display_fullscreen .

DATA: ls_layout TYPE slis_layout_alv,

lt_fcat TYPE slis_t_fieldcat_alv,

ls_fcat TYPE slis_fieldcat_alv.

ls_layout-lights_tabname = '1'.

ls_layout-lights_fieldname = 'LIGHTS'.

ls_layout-coltab_fieldname = 'TABCOL'.

CLEAR ls_fcat.

ls_fcat-fieldname = 'LIGHTS'.

ls_fcat-inttype = 'C'.

ls_fcat-seltext_l = text-hl4.

ls_fcat-seltext_m = text-hl4.

ls_fcat-seltext_s = text-hl4.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'COLOR'.

ls_fcat-inttype = 'I'.

ls_fcat-seltext_l = text-hl3.

ls_fcat-seltext_m = text-hl3.

ls_fcat-seltext_s = text-hl3.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'ID'.

ls_fcat-inttype = 'C'.

ls_fcat-seltext_l = text-hl1.

ls_fcat-seltext_m = text-hl1.

ls_fcat-seltext_s = text-hl1.

ls_fcat-icon = abap_true.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'SYMBOL'.

ls_fcat-inttype = 'C'.

ls_fcat-seltext_l = text-hl2.

ls_fcat-seltext_m = text-hl2.

ls_fcat-seltext_s = text-hl2.

ls_fcat-symbol = abap_true.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'NAME'.

ls_fcat-tech = abap_true.

APPEND ls_fcat TO lt_fcat.

PERFORM select_data.

PERFORM set_tooltips.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

* I_INTERFACE_CHECK = ' '

* I_BYPASSING_BUFFER = ' '

* I_BUFFER_ACTIVE = ' '

* I_CALLBACK_PROGRAM = ' '

* I_CALLBACK_PF_STATUS_SET = ' '

* I_CALLBACK_USER_COMMAND = ' '

* I_CALLBACK_TOP_OF_PAGE = ' '

* I_CALLBACK_HTML_TOP_OF_PAGE = ' '

* I_CALLBACK_HTML_END_OF_LIST = ' '

* I_STRUCTURE_NAME =

* I_BACKGROUND_ID = ' '

* I_GRID_TITLE =

* I_GRID_SETTINGS =

is_layout = ls_layout

it_fieldcat = lt_fcat

* IT_EXCLUDING =

* IT_SPECIAL_GROUPS =

* IT_SORT =

* IT_FILTER =

* IS_SEL_HIDE =

* I_DEFAULT = 'X'

* I_S***E = ' '

* IS_VARIANT =

* IT_EVENTS =

* IT_EVENT_EXIT =

* IS_PRINT =

* IS_REPREP_ID =

* I_SCREEN_START_COLUMN = 0

* I_SCREEN_START_LINE = 0

* I_SCREEN_END_COLUMN = 0

* I_SCREEN_END_LINE = 0

* I_HTML_HEIGHT_TOP = 0

* I_HTML_HEIGHT_END = 0

* IT_ALV_GRAPHICS =

* IT_HYPERLINK =

* IT_ADD_FIELDCAT =

it_except_qinfo = gt_exc

* IR_SALV_FULLSCREEN_ADAPTER =

* IMPORTING

* E_EXIT_CAUSED_BY_CALLER =

* ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = gt_outtab

EXCEPTIONS

program_error = 1

OTHERS = 2

.

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_fullscreen

*&---------------------------------------------------------------------*

*& Form display_list

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

FORM display_list .

DATA: ls_layout TYPE slis_layout_alv,

lt_fcat TYPE slis_t_fieldcat_alv,

ls_fcat TYPE slis_fieldcat_alv.

ls_layout-lights_tabname = '1'.

ls_layout-lights_fieldname = 'LIGHTS'.

ls_layout-coltab_fieldname = 'TABCOL'.

CLEAR ls_fcat.

ls_fcat-fieldname = 'LIGHTS'.

ls_fcat-inttype = 'C'.

ls_fcat-seltext_l = text-hl4.

ls_fcat-seltext_m = text-hl4.

ls_fcat-seltext_s = text-hl4.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'COLOR'.

ls_fcat-inttype = 'I'.

ls_fcat-seltext_l = text-hl3.

ls_fcat-seltext_m = text-hl3.

ls_fcat-seltext_s = text-hl3.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'ID'.

ls_fcat-inttype = 'C'.

ls_fcat-seltext_l = text-hl1.

ls_fcat-seltext_m = text-hl1.

ls_fcat-seltext_s = text-hl1.

ls_fcat-icon = abap_true.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'SYMBOL'.

ls_fcat-inttype = 'C'.

ls_fcat-seltext_l = text-hl2.

ls_fcat-seltext_m = text-hl2.

ls_fcat-seltext_s = text-hl2.

ls_fcat-symbol = abap_true.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'NAME'.

ls_fcat-tech = abap_true.

APPEND ls_fcat TO lt_fcat.

PERFORM select_data.

PERFORM set_tooltips.

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'

EXPORTING

* I_INTERFACE_CHECK = ' '

* I_BYPASSING_BUFFER = ' '

* I_BUFFER_ACTIVE = ' '

* I_CALLBACK_PROGRAM = ' '

* I_CALLBACK_PF_STATUS_SET = ' '

* I_CALLBACK_USER_COMMAND = ' '

* I_CALLBACK_TOP_OF_PAGE = ' '

* I_CALLBACK_HTML_TOP_OF_PAGE = ' '

* I_CALLBACK_HTML_END_OF_LIST = ' '

* I_STRUCTURE_NAME =

* I_BACKGROUND_ID = ' '

* I_GRID_TITLE =

* I_GRID_SETTINGS =

is_layout = ls_layout

it_fieldcat = lt_fcat

* IT_EXCLUDING =

* IT_SPECIAL_GROUPS =

* IT_SORT =

* IT_FILTER =

* IS_SEL_HIDE =

* I_DEFAULT = 'X'

* I_S***E = ' '

* IS_VARIANT =

* IT_EVENTS =

* IT_EVENT_EXIT =

* IS_PRINT =

* IS_REPREP_ID =

* I_SCREEN_START_COLUMN = 0

* I_SCREEN_START_LINE = 0

* I_SCREEN_END_COLUMN = 0

* I_SCREEN_END_LINE = 0

* I_HTML_HEIGHT_TOP = 0

* I_HTML_HEIGHT_END = 0

* IT_ALV_GRAPHICS =

* IT_HYPERLINK =

* IT_ADD_FIELDCAT =

it_except_qinfo = gt_exc

* IR_SALV_FULLSCREEN_ADAPTER =

* IMPORTING

* E_EXIT_CAUSED_BY_CALLER =

* ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = gt_outtab

EXCEPTIONS

program_error = 1

OTHERS = 2

.

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_list

*&--------------------------------------------------------------------*

*& Form display_grid

*&--------------------------------------------------------------------*

* text

*---------------------------------------------------------------------*

FORM display_grid.

CALL SCREEN 100.

ENDFORM. "display_grid

*&---------------------------------------------------------------------*

*& Module d0100_pbo OUTPUT

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

MODULE d0100_pbo OUTPUT.

PERFORM d0100_pbo.

ENDMODULE. " d0100_pbo OUTPUT

*&---------------------------------------------------------------------*

*& Module d0100_pai INPUT

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

MODULE d0100_pai INPUT.

PERFORM d0100_pai.

ENDMODULE. " d0100_pai INPUT

*&---------------------------------------------------------------------*

*& Form d0100_pbo

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

FORM d0100_pbo .

SET PF-STATUS 'D0100'.

IF gr_container IS NOT BOUND.

*§3a for displaying the data in your own Dynpro, create a container ...

CREATE OBJECT gr_container

EXPORTING

container_name = 'CONTAINER'.

CREATE OBJECT gr_grid

EXPORTING i_parent = gr_container.

DATA: ls_layout TYPE lvc_s_layo,

lt_fcat TYPE lvc_t_fcat,

ls_fcat TYPE lvc_s_fcat.

ls_layout-excp_fname = 'LIGHTS'.

ls_layout-ctab_fname = 'TABCOL'.

CLEAR ls_fcat.

ls_fcat-fieldname = 'LIGHTS'.

ls_fcat-inttype = 'C'.

ls_fcat-scrtext_l = text-hl4.

ls_fcat-scrtext_m = text-hl4.

ls_fcat-scrtext_s = text-hl4.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'COLOR'.

ls_fcat-inttype = 'I'.

ls_fcat-scrtext_l = text-hl3.

ls_fcat-scrtext_m = text-hl3.

ls_fcat-scrtext_s = text-hl3.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'ID'.

ls_fcat-inttype = 'C'.

ls_fcat-scrtext_l = text-hl1.

ls_fcat-scrtext_m = text-hl1.

ls_fcat-scrtext_s = text-hl1.

ls_fcat-icon = abap_true.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'SYMBOL'.

ls_fcat-inttype = 'C'.

ls_fcat-scrtext_l = text-hl2.

ls_fcat-scrtext_m = text-hl2.

ls_fcat-scrtext_s = text-hl2.

ls_fcat-symbol = abap_true.

APPEND ls_fcat TO lt_fcat.

CLEAR ls_fcat.

ls_fcat-fieldname = 'NAME'.

ls_fcat-tech = abap_true.

APPEND ls_fcat TO lt_fcat.

PERFORM select_data.

* perform set_tooltips.

DATA: lt_tooltips TYPE lvc_t_qinf,

lt_toolb TYPE ui_functions,

ls_toolb TYPE ui_func.

ls_toolb = cl_gui_alv_grid=>mc_fc_call_crbatch.

APPEND ls_toolb TO lt_toolb.

lt_tooltips = gt_exc.

CALL METHOD gr_grid->set_table_for_first_display

EXPORTING

is_layout = ls_layout

it_except_qinfo = lt_tooltips

it_toolbar_excluding = lt_toolb

CHANGING

it_fieldcatalog = lt_fcat

it_outtab = gt_outtab.

ENDIF.

ENDFORM. " d0100_pbo

*&---------------------------------------------------------------------*

*& Form d0100_pai

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

FORM d0100_pai .

CASE g_okcode.

WHEN 'BACK'.

PERFORM set_tooltips.

* CALL METHOD gr_grid->refresh_table_display.

DATA ls_stbl TYPE lvc_s_stbl.

ls_stbl-row = 'X'.

CALL METHOD gr_grid->refresh_table_display

EXPORTING

is_stable = ls_stbl.

WHEN 'EXIT' OR 'CANC'.

SET SCREEN 0.

LE***E SCREEN.

ENDCASE.

ENDFORM. " d0100_pai

*&--------------------------------------------------------------------*

*& Form show_salv_function

*&--------------------------------------------------------------------*

* text

*---------------------------------------------------------------------*

FORM show_salv_function USING value(i_function) TYPE salv_de_function.

CASE i_function.

WHEN 'TEST'.

ENDCASE.

ENDFORM. " show_salv_function

*&---------------------------------------------------------------------*

*& Form display

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM display .

PERFORM set_tooltips.

ENDFORM. " display

*&---------------------------------------------------------------------*

*& Form set_tooltips

*&---------------------------------------------------------------------*

* text

*----------------------------------------------------------------------*

* --> p1 text

* <-- p2 text

*----------------------------------------------------------------------*

FORM set_tooltips .

DATA: ls_symbol TYPE icon,

lt_symbol TYPE STANDARD TABLE OF icon,

ls_exc TYPE alv_s_qinf.

DEFINE mac_get_symbol.

ls_symbol-id = &2.

ls_symbol-name = &1.

append ls_symbol to lt_symbol.

END-OF-DEFINITION.

mac_get_symbol sym_space ' ' ." SPACE

mac_get_symbol sym_plus_box '!' ." box with plus inside

mac_get_symbol sym_minus_box '"' ." box with minus inside

mac_get_symbol sym_plus_circle '#' ." circle with plus inside

mac_get_symbol sym_minus_circle '$' ." circle with minus inside

mac_get_symbol sym_filled_square '%' ." filled square

mac_get_symbol sym_half_filled_square '&' ." half-filled square

mac_get_symbol sym_square '''' ." empty square

mac_get_symbol sym_filled_circle '(' ." filled circle

mac_get_symbol sym_half_filled_circle ')' ." half-filled circle

mac_get_symbol sym_circle '*' ." empty circle

mac_get_symbol sym_filled_diamond '+' ." filled diamond

mac_get_symbol sym_diamond ',' ." empty diamond

mac_get_symbol sym_bold_x '.' ." diagonal cross (cancel)

mac_get_symbol sym_note '/ '." word balloon, note

mac_get_symbol sym_document '0' ." document

mac_get_symbol sym_checked_document '1' ." document with checkmark

mac_get_symbol sym_documents '2 '." double documents

mac_get_symbol sym_folder '3 '." folder

mac_get_symbol sym_plus_folder '4 '." folder with plus inside

mac_get_symbol sym_minus_folder '5 '." folder with minus inside

mac_get_symbol sym_open_folder '6 '." open folder

mac_get_symbol sym_bold_minus '7' ." bold minus sign

mac_get_symbol sym_bold_plus '8' ." bold plus sign

mac_get_symbol sym_checkbox '9 '." selected checkbox

mac_get_symbol sym_radiobutton ': '." selected radiobutton

mac_get_symbol sym_left_triangle ';' ." triangle pointing left

mac_get_symbol sym_right_triangle '<' ." triangle pointing right

mac_get_symbol sym_up_triangle '=' ." triangle pointing up

mac_get_symbol sym_down_triangle '>' ." triangle pointing down

mac_get_symbol sym_left_hand '? '." hand pointing left

mac_get_symbol sym_left_arrow 'A' ." left arrow

mac_get_symbol sym_right_arrow 'B' ." right arrow

mac_get_symbol sym_up_arrow 'C' ." up arrow

mac_get_symbol sym_down_arrow 'D' ." down arrow

mac_get_symbol sym_check_mark 'E' ." check mark

mac_get_symbol sym_pencil 'F' ." pencil

mac_get_symbol sym_glasses 'G '." glasses

mac_get_symbol sym_locked 'H' ." closed padlock

mac_get_symbol sym_unlocked 'I' ." open padlock

mac_get_symbol sym_phone 'J '." telephone

mac_get_symbol sym_printer 'K '." printer

mac_get_symbol sym_fax 'L '." fax machine

mac_get_symbol sym_asterisk 'M' ." asterisk

mac_get_symbol sym_right_hand 'N '." hand pointing right

mac_get_symbol sym_sorted_up 'O '." sorted ascending

mac_get_symbol sym_sorted_down 'P '." sorted descending

mac_get_symbol sym_cumulated 'Q '." cumulated

mac_get_symbol sym_delete 'R' ." delete mark

mac_get_symbol sym_executable 'S '." executable

mac_get_symbol sym_workflow_item 'T '." workflow-object

mac_get_symbol sym_caution 'U '." caution

mac_get_symbol sym_flash 'V' ." express, urgent

mac_get_symbol sym_large_square 'W '." large empty square

mac_get_symbol sym_ellipsis 'X'. " ellipsis (...)

* fill the symbols, colors in to table and set tooltips

FIELD-SYMBOLS: <outtab> TYPE gs_outtab.

DATA: tooltips TYPE REF TO cl_salv_tooltips,

settings TYPE REF TO cl_salv_functional_settings,

value TYPE char128,

text TYPE char40,

tabix TYPE sy-tabix,

col TYPE lvc_s_scol.

LOOP AT gt_outtab ASSIGNING <outtab>.

tabix = sy-tabix.

READ TABLE lt_symbol INDEX sy-tabix INTO ls_symbol.

<outtab>-symbol = ls_symbol-id.

value = <outtab>-id(3).

text = <outtab>-name.

CONCATENATE value 'Q' text '@' INTO value.

<outtab>-id = value.

value = ls_symbol-id.

text = ls_symbol-name.

ls_exc-type = cl_salv_tooltip=>c_type_symbol.

ls_exc-value = value.

ls_exc-text = text.

APPEND ls_exc TO gt_exc.

<outtab>-color = tabix MOD 7 + 1.

<outtab>-lights = tabix MOD 3 + 1.

col-fname = 'COLOR'.

col-color-col = tabix MOD 7 + 1.

IF tabix GE 7.

col-color-inv = 1.

ENDIF.

IF tabix GE 14.

col-color-int = 1.

ENDIF.

APPEND col TO <outtab>-tabcol.

ENDLOOP.

ls_exc-type = cl_salv_tooltip=>c_type_exception.

ls_exc-value = '1'.

ls_exc-text = text-et1.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_exception.

ls_exc-value = '2'.

ls_exc-text = text-et2.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_exception.

ls_exc-value = '3'.

ls_exc-text = text-et3.

APPEND ls_exc TO gt_exc.

* length 3 encoding for colors

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '110'.

ls_exc-text = text-ct1.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '210'.

ls_exc-text = text-ct2.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '310'.

ls_exc-text = text-ct3.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '410'.

ls_exc-text = text-ct4.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '510'.

ls_exc-text = text-ct5.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '610'.

ls_exc-text = text-ct6.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '710'.

ls_exc-text = text-ct7.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '101'.

ls_exc-text = text-ct1.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '201'.

ls_exc-text = text-ct2.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '301'.

ls_exc-text = text-ct3.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '401'.

ls_exc-text = text-ct4.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '501'.

ls_exc-text = text-ct5.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '601'.

ls_exc-text = text-ct6.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '701'.

ls_exc-text = text-ct7.

APPEND ls_exc TO gt_exc.

* simple length 1 encoding for colors - corresponds to intensified and inverse off

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '1'.

ls_exc-text = text-ct1.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '2'.

ls_exc-text = text-ct2.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '3'.

ls_exc-text = text-ct3.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '4'.

ls_exc-text = text-ct4.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '5'.

ls_exc-text = text-ct5.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '6'.

ls_exc-text = text-ct6.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '7'.

ls_exc-text = text-ct7.

APPEND ls_exc TO gt_exc.

ls_exc-type = cl_salv_tooltip=>c_type_color.

ls_exc-value = '0'.

ls_exc-text = text-ct0.

APPEND ls_exc TO gt_exc.

ENDFORM. " set_tooltips
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: