REPORT  z17_21                                 .

 

TYPES: BEGIN OF g_type_itab.

                          INCLUDE TYPE sflight.

                      TYPES:   exception   TYPE char1,

             END OF g_type_itab.

 

DATA gt_itab    TYPE TABLE OF g_type_itab.

DATA gs_itab    TYPE g_type_itab.

DATA gr_table   TYPE REF TO cl_salv_table.

 

SELECT * FROM sflight INTO CORRESPONDING FIELDS OF TABLE gt_itab

UP TO 25 ROWS.

 

LOOP AT gt_itab INTO gs_itab.

             IF gs_itab-seatsocc >= 90.

                           gs_itab-exception = '1'.

             ELSEIF gs_itab-seatsocc >= 50.

                           gs_itab-exception = '2'.

             ELSE.

                           gs_itab-exception = '3'.

             ENDIF.

 

             MODIFY gt_itab FROM gs_itab.

ENDLOOP.

 

cl_salv_table=>factory(

             IMPORTING

                          r_salv_table = gr_table

             CHANGING

                          t_table      = gt_itab ).

 

DATA: lr_columns TYPE REF TO cl_salv_columns_table,

                          lr_column  TYPE REF TO cl_salv_column_table.

 

lr_columns = gr_table->get_columns( ).

lr_columns->set_exception_column( 'EXCEPTION' ).

 

lr_column ?= lr_columns->get_column( 'EXCEPTION' ).

lr_column->set_short_text( 'MY EXCEPT' ).

 

DATA: lr_functional_settings TYPE REF TO cl_salv_functional_settings.

 

lr_functional_settings = gr_table->get_functional_settings( ).

 

DATA: lr_tooltips TYPE REF TO cl_salv_tooltips.

 

lr_tooltips = lr_functional_settings->get_tooltips( ).

 

lr_tooltips->add_tooltip(

             type       = cl_salv_tooltip=>c_type_exception

             value      = '1').

 

lr_tooltips->add_tooltip(

             type       = cl_salv_tooltip=>c_type_exception

             value      = '2').

 

lr_tooltips->add_tooltip(

             type       = cl_salv_tooltip=>c_type_exception

             value      = '3').

 

gr_table->display( ).

사이트운영 : http://sapjoy.co.kr  

저         서 : Easy ABAP, Plus ABAP

경         험 : SAP ABAP Tuning, SAP SCM(SD/PP/QM/PM/WM/APO)

자         격 : SAP SD / PP  / SAP ABAP Certification 등

메         일 : sapjoy@naver.com