Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

alv double_click event problem

Former Member
0 Likes
335

hey,experts,i am a newly abaper,i encouterd a problem.blow,it is my code,can u point why i couldnt trigger the alv's double event,thx in advance.

REPORT zexercise_kevin.

DATA: wa_alv_field TYPE slis_fieldcat_alv.

DATA: wa_alv_fieldcat TYPE slis_t_fieldcat_alv.

TYPES: BEGIN OF linetype ,

cityfrom LIKE spfli-cityfrom,

cityto LIKE spfli-cityto,

carrid LIKE spfli-carrid,

connid LIKE spfli-connid,

END OF linetype .

DATA: it_flights TYPE STANDARD TABLE OF linetype,

wa_flights TYPE linetype .

SELECT * UP TO 10 ROWS

FROM spfli INNER JOIN sflight ON

spflicarrid = sflightcarrid AND

spfliconnid = sflightconnid

INTO CORRESPONDING FIELDS OF TABLE IT_FLIGHTS

.

***set column

wa_alv_field-col_pos = 1.

wa_alv_field-fieldname = 'CARRID'.

wa_alv_field-seltext_m = 'CARRID'.

APPEND wa_alv_field TO wa_alv_fieldcat .

wa_alv_field-col_pos = 2.

wa_alv_field-fieldname = 'CONNID'.

wa_alv_field-seltext_m = 'CONNID'.

APPEND wa_alv_field TO wa_alv_fieldcat .

wa_alv_field-col_pos = 3.

wa_alv_field-fieldname = 'CITYFROM'.

wa_alv_field-seltext_m = 'CITYFROM'.

APPEND wa_alv_field TO wa_alv_fieldcat .

wa_alv_field-col_pos = 4.

wa_alv_field-fieldname = 'CITYTO'.

wa_alv_field-seltext_m = 'CITYTO'.

APPEND wa_alv_field TO wa_alv_fieldcat .

*****CALL FUNCTION

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

it_fieldcat = wa_alv_fieldcat

  • IMPORTING

TABLES

t_outtab = it_flights

  • 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.

CLASS lcl_event_receiver DEFINITION DEFERRED.

CLASS lcl_event_receiver DEFINITION.

PUBLIC SECTION.

METHODS:

handle_double_click

FOR EVENT DOUBLE_CLICK OF cl_gui_alv_grid

IMPORTING E_ROW E_COLUMN.

ENDCLASS. "lcl_event_receiver DEFINITION

CLASS lcl_event_receiver IMPLEMENTATION.

METHOD handle_double_click.

  • DATA: li_linetype LIKE LINE OF it_flights.

  • READ TABLE it_flights INDEX e_row-index INTO li_linetype.

WRITE:/ 'ddd'.

MESSAGE e111(ymess).

ENDMETHOD. "handle_double_click

ENDCLASS. "lcl_event_receiver IMPLEMENTATION

3 REPLIES 3
Read only

Former Member
0 Likes
314

Hi,

You have to call your function like this:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' 
EXPORTING 
... 
I_CALLBACK_PROGRAM = z_variant-report 
(or your program name, not sy-repid because this will 
change during the use of ALV Grid) 
I_CALLBACK_USER_COMMAND = 'USER_COMMAND2' 
(or some other name) 
...

then you define your form:

form user_command2 using r_ucomm like sy-ucomm 
rs_selfield type slis_selfield. 
case r_ucomm. 
when '&IC1'. (doubleclick) 
if rs_selfield-tabindex > 0 and 
rs_selfield-sumindex le 0. 
read table itab into wa index 
rs_selfield-tabindex. 
perform second_grid. 
endif. 
endcase.

then your form for the second grid:

form second_grid. 
(here you can make your selections for the second grid 
based on the row you selected into workarea wa from the 
first grid, and then call REUSE_ALV_GRID_DISPLAY again, 
with another field catalog, internal table etc...) 
endform.

REgards,

Nandha

Read only

0 Likes
314

hey,nandha,why when write down my program name

then with error: filed 'zexercise_kevin'is unkown

my code:

I_CALLBACK_PROGRAM = zexercise_kevin

Read only

Former Member
0 Likes
314

thxs, nandha.

i will go through and follow ur code,even still be little bit lost~~