*&---------------------------------------------------------------------*
*& Report YAPP02R223Q
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
report yapp02r223q.
tables: pa0002.
include <icon>.
types: begin of ty_outtab,
pernr like pa0002-pernr,
begda like pa0002-begda,
endda like pa0002-endda,
vorna like pa0002-vorna,
nachn like pa0002-nachn,
icon type icon_d,
end of ty_outtab.
data: gt_outtab type standard table of ty_outtab.
data: gr_table type ref to cl_salv_table.
constants: gc_true type sap_bool value 'X',
gc_false type sap_bool value ' '.
*----------------------------------------------------------------------*
* SELECTION-SCREEN *
*----------------------------------------------------------------------*
selection- screen begin of block dsp with frame.
select-options:s_pernr for pa0002-pernr.
selection- screen end of block dsp.
*----------------------------------------------------------------------*
* START-OF-SELECTION *
*----------------------------------------------------------------------*
start- of-selection.
perform select_data.
perform display_data.
end- of-selection.
*---------------------------------------------------------------------*
*& Form select_data
*----------------------------------------------------------------------*
form select_data .
select * from pa0002
into corresponding fields of table gt_outtab
where pernr in s_pernr .
field-symbols: <ls_outtab> type ty_outtab.
data: l_erg type i.
loop at gt_outtab assigning <ls_outtab>.
l_erg = sy-tabix mod 3.
case l_erg.
when 1.
<ls_outtab>- icon = icon_okay.
when 2.
<ls_outtab>- icon = icon_cancel.
when 0.
<ls_outtab>- icon = icon_display.
endcase.
endloop.
endform. " select_data
*&---------------------------------------------------------------------*
*& Form DISPLAY_DATA
*----------------------------------------------------------------------*
form display_data .
cl_salv_table=>factory(
importing
r_salv_table = gr_table
changing
t_table = gt_outtab ).
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_optimize( gc_true ).
lr_column ?= lr_columns->get_column( 'ICON' ).
lr_column->set_icon( if_salv_c_bool_sap=>true ).
lr_column->set_long_text( 'ICON' ).
gr_table->display( ).
endform. "display_data
*& Report YAPP02R223Q
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
report yapp02r223q.
tables: pa0002.
include <icon>.
types: begin of ty_outtab,
pernr like pa0002-pernr,
begda like pa0002-begda,
endda like pa0002-endda,
vorna like pa0002-vorna,
nachn like pa0002-nachn,
icon type icon_d,
end of ty_outtab.
data: gt_outtab type standard table of ty_outtab.
data: gr_table type ref to cl_salv_table.
constants: gc_true type sap_bool value 'X',
gc_false type sap_bool value ' '.
*----------------------------------------------------------------------*
* SELECTION-SCREEN *
*----------------------------------------------------------------------*
selection- screen begin of block dsp with frame.
select-options:s_pernr for pa0002-pernr.
selection- screen end of block dsp.
*----------------------------------------------------------------------*
* START-OF-SELECTION *
*----------------------------------------------------------------------*
start- of-selection.
perform select_data.
perform display_data.
end- of-selection.
*---------------------------------------------------------------------*
*& Form select_data
*----------------------------------------------------------------------*
form select_data .
select * from pa0002
into corresponding fields of table gt_outtab
where pernr in s_pernr .
field-symbols: <ls_outtab> type ty_outtab.
data: l_erg type i.
loop at gt_outtab assigning <ls_outtab>.
l_erg = sy-tabix mod 3.
case l_erg.
when 1.
<ls_outtab>- icon = icon_okay.
when 2.
<ls_outtab>- icon = icon_cancel.
when 0.
<ls_outtab>- icon = icon_display.
endcase.
endloop.
endform. " select_data
*&---------------------------------------------------------------------*
*& Form DISPLAY_DATA
*----------------------------------------------------------------------*
form display_data .
cl_salv_table=>factory(
importing
r_salv_table = gr_table
changing
t_table = gt_outtab ).
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_optimize( gc_true ).
lr_column ?= lr_columns->get_column( 'ICON' ).
lr_column->set_icon( if_salv_c_bool_sap=>true ).
lr_column->set_long_text( 'ICON' ).
gr_table->display( ).
endform. "display_data