Skip to Content
0
Former Member
Jan 21, 2008 at 08:42 AM

hi -- oops interative report

21 Views

i have written code for interative report but secondary list is not displayed, i have just change the existing program given in sdn forum, but it not working, therefore i would like to know what is wrong in my coding using latest classes.

types : begin of itab1,

lifnr type ekko-lifnr,

netwr type ekpo-netwr,

name1 type lfa1-name1,

end of itab1.

data : itab type standard table of itab1 with header line.

data : itab2 type standard table of itab1.

types : begin of mat_det1,

ebeln type ekko-ebeln,

lifnr type ekko-lifnr,

bedat type ekko-bedat,

matnr type ekpo-matnr,

menge type ekpo-menge,

netpr type ekpo-netpr,

NETWR type EKPO-NETWR,

maktx type makt-maktx,

end of mat_det1.

data : mat_det type standard table of mat_det1 with header line.

data : mat_det2 type standard table of mat_det1.

data : ispfli type table of spfli.

data : xspfli type spfli.

data : gr_table type ref to cl_salv_table.

data : gr_functions type ref to cl_salv_functions_list.

data : gr_events type ref to cl_salv_events_table.

data : gr_selections type ref to cl_salv_selections.

tables : ekko,ekpo,lfa1.

select-options: s_bedat for ekko-bedat.

class lcl_handle_events definition.

public section.

methods: on_user_command for event added_function of cl_salv_events

importing e_salv_function,

on_double_click for event double_click of cl_salv_events_table

importing row column.

endclass.

data : event_handler type ref to lcl_handle_events.

start-of-selection.

*select * into corresponding fields of table ispfli from spfli up to 100 rows .

select alifnr " sum( bnetwr ) as netwr

into corresponding fields of itab

from ekko as a inner join ekpo as b on bebeln = aebeln

where abedat in s_bedat group by alifnr.

select single name1 from lfa1 into itab-name1

where lifnr = itab-lifnr.

append itab to itab2.

endselect.

call method cl_salv_table=>factory

importing

r_salv_table = gr_table

changing

t_table = itab2.

gr_table->set_screen_status(

pfstatus = 'SALV_TABLE_STANDARD'

report = sy-repid

set_functions = gr_table->c_functions_all ).

gr_events = gr_table->get_event( ).

create object event_handler.

set handler event_handler->on_user_command for gr_events.

set handler event_handler->on_double_click for gr_events.

gr_selections = gr_table->get_selections( ).

gr_selections->set_selection_mode( 1 ).

gr_table->display( ).

class lcl_handle_events implementation.

method on_user_command.

Get the selection rows

data: lr_selections type ref to cl_salv_selections.

data: lt_rows type salv_t_row.

data: ls_rows type i.

data: message type string.

case e_salv_function.

when 'MYFUNCTION' .

lr_selections = gr_table->get_selections( ).

lt_rows = lr_selections->get_selected_rows( ).

*****read table lt_rows into ls_rows index 1.

*****read table ispfli into xspfli index ls_rows.

*****concatenate xspfli-carrid xspfli-connid xspfli-cityfrom xspfli-cityto into message separated by space.

****

*****message i001(00) with 'You pushed the button!' message .

endcase.

Endmethod.

method on_double_click.

data: message type string.

data: row_c(4) type c.

row_c = row.

data: lr_selections type ref to cl_salv_selections.

data: lt_rows type salv_t_row.

data: ls_rows type i.

lr_selections = gr_table->get_selections( ).

lt_rows = lr_selections->get_selected_rows( ).

read table lt_rows into ls_rows index 1.

read table itab2 into itab index ls_rows.

select ebeln bedat lifnr from ekko into corresponding fields of mat_det

where ebeln = p_itab2-ebeln and bedat = p_itab2-bedat

where lifnr = itab-lifnr..

select matnr menge netpr NETWR from ekpo

into corresponding fields of mat_det

where ebeln = mat_det-ebeln.

select single maktx from makt into corresponding fields of mat_det

where matnr = mat_det-matnr.

append mat_DET to mat_DET2.

endselect.

endselect.

****call method cl_salv_table=>factory

****importing

****r_salv_table = gr_table

****changing

****t_table = mat_DET2.

gr_table->set_screen_status(

pfstatus = 'SALV_TABLE_STANDARD'

report = sy-repid

set_functions = gr_table->c_functions_all ).

gr_events = gr_table->get_event( ).

create object event_handler.

set handler event_handler->on_user_command for gr_events.

set handler event_handler->on_double_click for gr_events.

gr_selections = gr_table->get_selections( ).

gr_selections->set_selection_mode( 1 ).

gr_table->display( ).

*****concatenate 'Row' row_c 'Column' column into message separated by space.

*****message i001(00) with 'You double-clicked on ' message.

endmethod.

endclass.

thanx

rocky