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

Former Member
0 Likes
528

Hi all,

I have created a grid display for displaying data.Now when i click a particular line i need to get a gist i.e the data of that particular line displayed in a vertical manner (like in the database). wat do i have to use to pul it up.

Thanks

Kavitha

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
496

if u r using the following FM to display ALV grid.

'REUSE_ALV_GRID_DISPLAY'

Exporting

Remove emporting parameter comment line for the below field and assign field which was newly created as below

DATA: W_CALLBACK_UCOMM TYPE SLIS_FORMNAME VALUE 'USER_COMMANDS',

assign to th FM as per below

I_CALLBACK_USER_COMMAND = W_CALLBACK_UCOMM

Dyanmically it call the routine as shown below. so need to create it

FORM USER_COMMANDS USING R_UCOMM LIKE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.""#EC CALLED

IF RS_SELFIELD-TABINDEX IS INITIAL.

EXIT.

ELSE.

CASE R_UCOMM.

ENDCASE

ENDFORM.

U need to write logic in case and endcase for wat u want to display. whether it is box or new screen wat ever. As per u r requirment. if u want to pop up display lot fm are there. Pls find from se 37

Thanks

Sridhar

Hi all,

I have created a grid display for displaying data.Now when i click a particular line i need to get a gist i.e the data of that particular line displayed in a vertical manner (like in the database). wat do i have to use to pul it up.

Thanks

Kavitha

3 REPLIES 3
Read only

Former Member
0 Likes
497

if u r using the following FM to display ALV grid.

'REUSE_ALV_GRID_DISPLAY'

Exporting

Remove emporting parameter comment line for the below field and assign field which was newly created as below

DATA: W_CALLBACK_UCOMM TYPE SLIS_FORMNAME VALUE 'USER_COMMANDS',

assign to th FM as per below

I_CALLBACK_USER_COMMAND = W_CALLBACK_UCOMM

Dyanmically it call the routine as shown below. so need to create it

FORM USER_COMMANDS USING R_UCOMM LIKE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.""#EC CALLED

IF RS_SELFIELD-TABINDEX IS INITIAL.

EXIT.

ELSE.

CASE R_UCOMM.

ENDCASE

ENDFORM.

U need to write logic in case and endcase for wat u want to display. whether it is box or new screen wat ever. As per u r requirment. if u want to pop up display lot fm are there. Pls find from se 37

Thanks

Sridhar

Read only

Former Member
0 Likes
496

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'. " here your double occurs

if rs_selfield-fieldname = '<your field name>' " give the field name which you want to double click.

:

Write your code here..

I.e write your select statements retrieve data into internal table and use

"REUSE_ALV_POPUP_TO_SELECT" to show the details in a small window..

or you can REUSE_ALV_GRID_DISPLAY again for second line items

:

endif.

if rs_selfield-fieldname = '<your field name>' " give another field name which you want to double click.

:

Write your code here..

I.e write your select statements retrieve data into internal table and use

"REUSE_ALV_POPUP_TO_SELECT" to show the details in a small window..

or you can REUSE_ALV_GRID_DISPLAY again for second line items

:

endif.

endcase.

ENDFORM.

rewards if useful,

regards,

nazeer

Read only

0 Likes
496

for this in <b>oops ALV</b> you have to use EVENTS.

the <b>fallowing EVENTS and there usage is given.</b>

<b>button_click</b>

Query a click on a pushbutton in the ALV Grid Control

<b>double_click</b>

Query a double-click on a cell of the ALV Grid control

<b>hotspot_click</b>

Query a hotspot click on columns defined for this purpose in advance

<b>onDrag</b>

Collect information when elements of the ALV Grid Control are dragged

<b>toolbar</b>

Change, delete or add GUI elements in the toolbar

General Scheme for the Event Handler Class

Here is a sample code to illustrate a general scheme for local class.

<b>CLASS lcl_event_handler DEFINITION .</b>

PUBLIC SECTION .

METHODS:

*--To add new functional buttons to the ALV toolbar

handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid

IMPORTING e_object e_interactive ,

*--To implement user commands

handle_user_command

FOR EVENT user_command OF cl_gui_alv_grid

IMPORTING e_ucomm ,

*--Hotspot click control

handle_hotspot_click

FOR EVENT hotspot_click OF cl_gui_alv_grid

IMPORTING e_row_id e_column_id es_row_no ,

*--Double-click control

handle_double_click

FOR EVENT double_click OF cl_gui_alv_grid

IMPORTING e_row e_column ,

*--To be triggered before user commands

handle_before_user_command

FOR EVENT before_user_command OF cl_gui_alv_grid

IMPORTING e_ucomm ,

*--To be triggered after user commands

handle_after_user_command

FOR EVENT context_menu_request OF cl_gui_alv_grid

IMPORTING e_object

*--Controlling data changes when ALV Grid is editable

handle_data_changed

FOR EVENT data_changed OF cl_gui_alv_grid

IMPORTING er_data_changed ,

*--To be triggered after data changing is finished

handle_data_changed_finished

FOR EVENT data_changed_finished OF cl_gui_alv_grid

IMPORTING e_modified ,

*--To control menu buttons

handle_menu_button

FOR EVENT menu_button OF cl_gui_alv_grid

IMPORTING e_oject e_ucomm ,

*--To control button clicks

handle_button_click

FOR EVENT button_click OF cl_gui_alv_grid

IMPORTING e_oject e_ucomm .

PRIVATE SECTION.

ENDCLASS.

<b>CLASS lcl_event_handler IMPLEMENTATION .</b>

*--Handle Toolbar

METHOD handle_toolbar.

PERFORM handle_toolbar USING e_object e_interactive .

ENDMETHOD .

*--Handle Hotspot Click

METHOD handle_hotspot_click .

PERFORM handle_hotspot_click USING e_row_id e_column_id es_row_no .

ENDMETHOD .

*--Handle Double Click

METHOD handle_double_click .

PERFORM handle_double_click USING e_row e_column es_row_no .

ENDMETHOD .

*--Handle User Command

METHOD handle_user_command .

PERFORM handle_user_command USING e_ucomm .

ENDMETHOD.

*--Handle After User Command

METHOD handle_context_menu_request .

PERFORM handle_context_menu_request USING e_object .

ENDMETHOD.

*--Handle Before User Command

METHOD handle_before_user_command .

PERFORM handle_before_user_command USING e_ucomm .

ENDMETHOD .

*--Handle Data Changed

METHOD handle_data_changed .

PERFORM handle_data_changed USING er_data_changed .

ENDMETHOD.

*--Handle Data Changed Finished

METHOD handle_data_changed_finished .

PERFORM handle_data_changed_finished USING e_modified .

ENDMETHOD .

*--Handle Menu Buttons

METHOD handle_menu_button .

PERFORM handle_menu_button USING e_object e_ucomm .

ENDMETHOD .

*--Handle Button Click

METHOD handle_button_click .

PERFORM handle_button_click USING e_object e_ucomm .

ENDMETHOD .

ENDCLASS .

<b>Creating event handler instance and registering handler methods</b>

DATA gr_event_handler TYPE REF TO lcl_event_handler .

.. ..

*--Creating an instance for the event handler

CREATE OBJECT gr_event_handler .

*--Registering handler methods to handle ALV Grid events

SET HANDLER gr_event_handler->handle_user_command FOR gr_alvgrid .

SET HANDLER gr_event_handler->handle_toolbar FOR gr_alvgrid .

SET HANDLER gr_event_handler->handle_menu_button FOR gr_alvgrid .

SET HANDLER gr_event_handler->handle_double_click FOR gr_alvgrid .

SET HANDLER gr_event_handler->handle_hotspot_click FOR gr_alvgrid .

SET HANDLER gr_event_handler->handle_button_click FOR gr_alvgrid .

SET HANDLER gr_event_handler->handle_before_user_command

FOR gr_alvgrid .

SET HANDLER gr_event_handler->handle_context_menu_request

FOR gr_alvgrid .

SET HANDLER gr_event_handler->handle_data_changed FOR gr_alvgrid .

SET HANDLER gr_event_handler->handle_data_changed_finished

FOR gr_alvgrid .

<b>

Hotspot Clicking</b>

From field catalog field definitions, we know that we can make some columns to respond to single clicks as hotspots by setting the value for the field “HOTSPOT” to ‘X’ while generating the field catalog. After clicking, the event “hotspot_click” is triggered. This event has three parameters in its interface. The parameter “e_row_id” is obsolete. Other two parameters are “es_row_no” which is of type “LVC_S_ROID” and passes information about the row index at “es_row_no-row_id”, and “e_column_id” of type “LVC_S_COL” which returns the column fieldname at “e_column_id-fieldname”. Utilizing these parameters you know where the user clicked and trigger your action.

FORM handle_hotspot_click USING i_row_id TYPE lvc_s_row

i_column_id TYPE lvc_s_col

is_row_no TYPE lvc_s_roid.

READ TABLE gt_list INDEX is_row_no-row_id .

IF sy-subrc = 0 AND i_column_id-fieldname = 'SEATSOCC' .

CALL SCREEN 200 . "Details about passenger-seat matching

ENDIF .

ENDFORM .

in complete give u r mail id i will send useful material

<b>Reward all helpful replies</b>