Application Development 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: 

Showing both button and grid in same place...

Former Member
0 Kudos

Hai Gurus,

I have created a ALV Grid with a exit button in SE51. But when when executed, it shows the Grid with records in full screen and only when click the back button we can able to see the exit button. But with in the grid place the button also should be viewable, so convey your ideasfor this with an example...

1 REPLY 1

Former Member
0 Kudos

If you are using class based ALV.

Refer below, handling of some events related to ALV. Similarly you can implement your functionality.

To trigger an event, a class must

1. Declare the event in its declaration part.

2. Trigger the event in one of its methods.

To handle an event, a method must

1. be defined as an event handler method for that event.

2. be registered at runtime for the event.

Registering Event Handler Methods :To allow an event handler method to react to an event, you must determine at runtime the trigger to which it is to react. It links a list of handler methods with corresponding trigger methods.

<b>class lcl_event_receiver definition.</b>

public section.

class-methods:

<b>handle_toolbar</b> for event toolbar of cl_gui_alv_grid

importing e_object e_interactive,

<b>handle_user_command</b>

for event user_command of cl_gui_alv_grid

importing e_ucomm ,

<b>endclass.</b>

Now next is <u><b>implementation</b></u> of lcl_event_receiver.

class lcl_event_receiver implementation.

*-TOOLBAR- Method for implementing a customized and interactive tool bar

method handle_toolbar.

**-- append a separator to normal toolbar, for appending a separator put butn_type

**-- equivalent to 3. And append the ls_toolbar to e_object->mt_toolbar.

clear ls_toolbar.

ls_toolbar-butn_type = 3.

append ls_toolbar to e_object->mt_toolbar.

**-- Fill ls_toolbar structure And append the ls_toolbar to e_object->mt_toolbar.

**--append an icon to toolbar VIEW

clear ls_toolbar.

ls_toolbar-function = 'VIEW'.

ls_toolbar-icon = icon_detail.

ls_toolbar-quickinfo = 'View'.

ls_toolbar-text = 'View'.

ls_toolbar-disabled = ' '.

append ls_toolbar to e_object->mt_toolbar.

endmethod.

*------ User COMMAND -


Next module is to handle the events that are

*----- raised by user actions and returns a value :

method handle_user_command.

data: lt_rows type lvc_t_row.

----++-User Commands--++----

case e_ucomm.

when 'VIEW'.

refresh lt_rows.

clear lt_rows.

*---- When user selects a row and click on some button on toolbar or application bar, the *---- selected row is stored in a table using method ‘get_selected_row’

call method grid->get_selected_rows

importing et_index_rows = lt_rows.

perform get_index tables lt_rows .

*---- Method to synchronize the automation queue

call method cl_gui_cfw=>flush.

if sy-subrc ne 0.

g_repid = sy-repid.

*---- add your handling, for example

call function 'POPUP_TO_INFORM'

exporting

titel = g_repid

txt2 = sy-subrc

txt1 = 'Error in Flush'(500).

endif.

**-----call for a user defined subroutine

perform view_instalment_details .

endcase.

endmethod.

endclass.

Regds,

Vishal