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

double click

Former Member
0 Likes
967

hallow

i doing alv report and in one colman i display org.units.

i wont to now how to do double click on one org.unit and it open

small window with all org.unit that below the org.unit i choose.

i never handle double click i new with that

regards

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
923

Hi..,

<b><u>Assigning a function to double-click</u></b>

The function code 'F2' for double-click or hotspot must have the ALV standard function code '&IC1' in the interface. This applies for both the ALV standard interface and applicationspecifically enhanced interfaces.

If double-click or hotspot should call another function code, you can assign the function code

to be called to the field <b>IS_LAYOUT-F2CODE</b> in the ALV importing structure <b>IS_LAYOUT</b>.

Any function (ALV standard or application-specific function) can be assigned to double-click or

hotspot in this way.

reward all helpful answers..

Vijay

7 REPLIES 7
Read only

Former Member
0 Likes
924

Hi..,

<b><u>Assigning a function to double-click</u></b>

The function code 'F2' for double-click or hotspot must have the ALV standard function code '&IC1' in the interface. This applies for both the ALV standard interface and applicationspecifically enhanced interfaces.

If double-click or hotspot should call another function code, you can assign the function code

to be called to the field <b>IS_LAYOUT-F2CODE</b> in the ALV importing structure <b>IS_LAYOUT</b>.

Any function (ALV standard or application-specific function) can be assigned to double-click or

hotspot in this way.

reward all helpful answers..

Vijay

Read only

Former Member
0 Likes
923

Check the pgm below:

BCALV_GRID_03

This program implements a function on event DOUBLE_CLICK. According to the selected line data from table SBOOK is selected and displayed by a second ALV Control in a dialog dynpro.

Read only

Former Member
0 Likes
923

Hi,

CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY' Or grid display

EXPORTING

I_CALLBACK_PROGRAM = GT_REPID

:

I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND' " FORM NAME

:

:

IT_FIELDCAT = GT_FIELDCAT

.....................................

TABLES

T_OUTTAB = ITAB

...........................

FORM F_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

CASE R_UCOMM.

When '&IC1'.

if rs_selfield-fieldname = '<your field name>'

:

Write your code here..

you can use "REUSE_ALV_POPUP_TO_SELECT"

to show the details in a small window..

:

endif.

endcase.

ENDFORM.

Reward points if useful..

regards,

nazeer

Message was edited by:

nazeer shaik

Read only

Former Member
0 Likes
923

Hi Antonio,

Just copy paste this code......... to get your desired functionality.

This program definitely help you to solve ur problem.

class lcl_event_receiver definition deferred.

DATA: OK_CODE LIKE SY-UCOMM,

code like ok_code,

G_CONTAINER(10),

GRID1 TYPE REF TO CL_GUI_ALV_GRID,

G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.

data g_control type ref to CL_GUI_CONTROL .

DATA:

FS_LAYOUT TYPE LVC_S_LAYO.

DATA:

T_SFLIGHT LIKE STANDARD TABLE OF SFLIGHT,

event_receiver type ref to lcl_event_receiver.

DATA:

T_SBOOK LIKE STANDARD TABLE OF SBOOK.

DATA:

INDEX TYPE I VALUE 1.

***************************************************************

  • LOCAL CLASSES: Definition

****************************************************************

*===============================================================

  • class lcl_event_receiver: local class to handle event DOUBLE_CLICK

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,

change_fcode

for event before_user_command of cl_gui_alv_grid

importing e_ucomm.

endclass.

<b>class lcl_event_receiver implementation.

method handle_double_click.

data: ls_sflight like line of t_sflight.

CLEAR LS_SFLIGHT.

read table t_sflight index e_row-index into ls_sflight.

CLEAR E_ROW.

perform select_table_sbook using ls_sflight

changing t_sbook.

call screen 101 STARTING AT 10 5.

endmethod. "handle_double_click</b>

method change_fcode.

CALL METHOD GRID1->set_user_command

exporting

I_UCOMM = '&SORT_ASC'.

call screen 101 STARTING AT 10 5.

endmethod.

endclass.

start-of-selection.

----


  • MAIN *

----


SELECT * FROM SFLIGHT INTO CORRESPONDING FIELDS OF TABLE T_SFLIGHT.

CALL SCREEN 100.

----


  • MODULE PBO OUTPUT *

----


MODULE PBO OUTPUT.

SET PF-STATUS 'MAIN100'.

G_CONTAINER = 'XYZ'.

IF G_CUSTOM_CONTAINER IS INITIAL.

CREATE OBJECT G_CUSTOM_CONTAINER

EXPORTING CONTAINER_NAME = G_CONTAINER.

CREATE OBJECT GRID1

EXPORTING I_PARENT = G_CUSTOM_CONTAINER.

CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING I_STRUCTURE_NAME = 'SFLIGHT'

IS_LAYOUT = FS_LAYOUT

CHANGING IT_OUTTAB = T_SFLIGHT

.

ENDIF.

create object event_receiver.

set handler event_receiver->handle_double_click for grid1.

ENDMODULE.

----


  • MODULE PAI INPUT *

----


MODULE PAI INPUT.

CODE = OK_CODE.

CLEAR OK_CODE.

CASE CODE.

WHEN 'EXIT'.

leave program.

WHEN OTHERS.

  • do nothing

ENDCASE.

ENDMODULE.

&----


*& Module STATUS_0101 OUTPUT

&----


  • text

----


module STATUS_0101 output.

SET PF-STATUS 'MAIN100'.

  • SET TITLEBAR 'xxx'.

G_CONTAINER = 'NEW'.

IF INDEX EQ 1.

CREATE OBJECT G_CUSTOM_CONTAINER

EXPORTING CONTAINER_NAME = G_CONTAINER.

CREATE OBJECT GRID1

EXPORTING I_PARENT = G_CUSTOM_CONTAINER.

CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY

EXPORTING I_STRUCTURE_NAME = 'SBOOK'

CHANGING IT_OUTTAB = T_SBOOK

.

ENDIF.

ADD 1 TO INDEX.

CALL METHOD GRID1->refresh_table_display.

endmodule. " STATUS_0101 OUTPUT

&----


*& Module USER_COMMAND_0101 INPUT

&----


  • text

----


module USER_COMMAND_0101 input.

CODE = OK_CODE.

case code.

when 'EXIT'.

leave to screen 0.

endcase.

clear ok_code.

endmodule. " USER_COMMAND_0101 INPUT

&----


*& Form select_table_sbook

&----


  • text

----


  • -->P_LS_SFLIGHT text

  • <--P_GT_SBOOK text

----


form select_table_sbook using p_ls_sflight LIKE SFLIGHT

changing p_gt_sbook.

CLEAR T_SBOOK[].

SELECT *

FROM SBOOK

INTO CORRESPONDING FIELDS OF TABLE T_SBOOK

WHERE CARRID EQ P_LS_SFLIGHT-CARRID

AND CONNID EQ P_LS_SFLIGHT-CONNID

AND FLDATE EQ P_LS_SFLIGHT-FLDATE.

endform. " select_table_sbook

<b>

Reward if helpful.</b>

Regards,

V.Raghavender.

Read only

Former Member
0 Likes
923

Hi

You can use FORM USER_COMMAND in which you can get the index of org unit record.

For the Function code of Double click you can CALL SCREEN for specific parameters. & have the final output.

Thanks

Sandeep

Reward if helpful

Read only

Former Member
0 Likes
923

Hi,

check this code for double click event:

&----


report zkeerthi_alv5 .

&----


*& tables declaration

&----


tables: vbrk,vbrp.

&----


*& type-pools declaration

&----


type-pools: slis.

&----


*& data declaration

&----


data: g_repid type sy-repid.

data : it_fieldcat type slis_t_fieldcat_alv, "mara

wa_fieldcat type slis_fieldcat_alv,

wa_layout type slis_layout_alv,

wa_event type slis_alv_event,

t_event type slis_t_event.

data: v_vbeln like vbrk-vbeln,

v_matnr like vbrp-matnr.

data: begin of it_vbrk occurs 0,

vbeln like vbrk-vbeln,

waerk like vbrk-waerk,

vkorg like vbrk-vkorg,

fkdat like vbrk-fkdat,

bukrs like vbrk-bukrs,

netwr like vbrk-netwr,

end of it_vbrk.

data: begin of it_vbrp occurs 0,

vbeln like vbrp-vbeln,

posnr like vbrp-posnr,

fkimg like vbrp-fkimg,

vrkme like vbrp-vrkme,

netwr like vbrp-netwr,

matnr like vbrp-matnr,

arktx like vbrp-arktx,

end of it_vbrp.

&----


*& selection screen

&----


selection-screen begin of block b with frame title text-001.

select-options: s_vbeln for vbrk-vbeln,

s_fkdat for vbrk-fkdat,

s_matnr for vbrp-matnr.

selection-screen end of block b.

**INITIALIZATION.

initialization.

g_repid = sy-repid.

s_fkdat-low = sy-datum - 200.

s_fkdat-high = sy-datum.

append s_fkdat.

***AT SELECTION-SCREEN.

at selection-screen.

if not s_vbeln is initial.

select single vbeln from vbrk

into v_vbeln

where vbeln in s_vbeln.

if sy-subrc <> 0.

message e001(zz2).

endif.

endif.

if not s_matnr is initial.

select single matnr from mara

into v_matnr

where matnr in s_matnr.

if sy-subrc <> 0.

message e001(zz2).

endif.

endif.

***START-OF-SELECTION.

start-of-selection.

perform get_data_vbrk.

&----


*& Form GET_DATA_VBRK

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form get_data_vbrk .

select vbeln

waerk

vkorg

fkdat

bukrs

netwr

into table it_vbrk

from vbrk

where vbeln in s_vbeln

and fkdat in s_fkdat.

endform. " GET_DATA_VBRK

&----


*& Form GET_DATA_VBRP

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form get_data_vbrp .

select vbeln

posnr

fkimg

vrkme

netwr

matnr

arktx

from vbrp

into table it_vbrp

where vbeln = it_vbrk-vbeln.

endform. " GET_DATA_VBRP

***END-OF-SELECTION.

end-of-selection.

perform event_list.

perform get_field_catalog.

perform list_disp .

form list_disp .

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

i_callback_program = g_repid

  • I_CALLBACK_PF_STATUS_SET = 'POPUP'

i_callback_user_command = '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 = WA_LAYOUT

it_fieldcat = it_fieldcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • 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

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

tables

t_outtab = it_vbrk

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. " LIST_DISP

&----


*& Form GET_FIELD_CATALOG

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form get_field_catalog .

call function 'REUSE_ALV_FIELDCATALOG_MERGE'

exporting

i_program_name = g_repid

i_internal_tabname = 'IT_VBRK'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

i_inclname = g_repid

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

changing

ct_fieldcat = it_fieldcat

exceptions

inconsistent_interface = 1

program_error = 2

others = 3

.

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. " GET_FIELD_CATALOG

&----


*& Form event_list

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form event_list .

clear wa_event.

wa_event-name = 'USER_COMMAND'.

wa_event-form = 'USER_COMMAND'.

append wa_event to t_event.

clear wa_event.

endform. " event_list

form user_command using r_ucomm like sy-ucomm

rs_selfield type slis_selfield.

case r_ucomm.

when '&IC1'.

read table it_vbrk index rs_selfield-tabindex.

perform get_data_vbrp.

perform build_fieldcatalog_vbrp .

perform display_alv_vbrp.

endcase.

endform.

&----


*& Form BUILD_FIELDCATALOG_VBRP

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form build_fieldcatalog_vbrp .

call function 'REUSE_ALV_FIELDCATALOG_MERGE'

exporting

i_program_name = g_repid

i_internal_tabname = 'IT_VBRP'

  • I_STRUCTURE_NAME =

  • I_CLIENT_NEVER_DISPLAY = 'X'

i_inclname = g_repid

  • I_BYPASSING_BUFFER =

  • I_BUFFER_ACTIVE =

changing

ct_fieldcat = it_fieldcat

exceptions

inconsistent_interface = 1

program_error = 2

others = 3

.

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. " BUILD_FIELDCATALOG_VBRP

&----


*& Form DISPLAY_ALV_VBRP

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form display_alv_vbrp .

call function 'REUSE_ALV_GRID_DISPLAY'

exporting

  • I_INTERFACE_CHECK = ' '

  • I_BYPASSING_BUFFER = ' '

  • I_BUFFER_ACTIVE = ' '

i_callback_program = g_repid

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

it_fieldcat = it_fieldcat

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

  • I_SAVE = ' '

  • 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

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • I_HTML_HEIGHT_TOP =

  • I_HTML_HEIGHT_END =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

tables

t_outtab = it_vbrp

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_ALV_VBRP

regards,

keerthi.

Read only

Former Member
0 Likes
923

In <b>FORM USER_COMMAND</b> check for the sy-ucomm <b>$IC1</b>. and the rsfieldsel

Regards

Rusdiar