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

Capturing the ALV Grid Event

Former Member
0 Likes
2,626

Hi Experts,

I am working on ALV Grid , Data is Displayed in Grid well , But Can Any one please tell me how can i capture the event (back,exit and cancel) which is persent on standard toolbar on ALV Gried output .

Rgds,

Premraj

1 ACCEPTED SOLUTION
Read only

RoySayak
Active Participant
0 Likes
1,570

Hi PremRaj,

To capture the event (back,exit and cancel) which is present on standard toolbar on ALV Grid output, go to the PBO screen of the ALV output and put a PF-STATUS for the output screen and in that pf-status Function Key section declare the BACK, CANCEL and EXIT for the corresponding icon it will capture the event for that particular button.

some code snippet..

*---------------------------------------------------------------------*
*       MODULE PBO OUTPUT                           *
*---------------------------------------------------------------------*
module pbo output.
  set pf-status 'MAIN100'.
  set titlebar 'MAIN100'.
*
*
<your code portion>
endmodule.

Best Regards,

Sayak..

Hi Experts,

I am working on ALV Grid , Data is Displayed in Grid well , But Can Any one please tell me how can i capture the event (back,exit and cancel) which is persent on standard toolbar on ALV Gried output .

Rgds,

Premraj

7 REPLIES 7
Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
1,570

Hi,

Use this document,

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/an%20easy%20r...

Hope this will help you a lot with ALV Grid Control.

Or use links:-

Hope this helps you.

Thanks & Regards,

Tarun Gambhir

Edited by: Tarun Gambhir on Jan 8, 2009 5:46 PM

Read only

Former Member
Read only

Former Member
0 Likes
1,570

Hello PremRaj ,

Please find an dummy program to capture the events below:

TYPE-POOLS slis.

DATA: ITAB_EVENTS TYPE slis_t_event,

WA_EVENTS TYPE SLIS_ALV_EVENT.

DATA: IT_END TYPE SLIS_T_LISTHEADER,

WA_END TYPE SLIS_LISTHEADER.

** This function module will get all the events present in alv into internal table itab_events*

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

  • EXPORTING

  • I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = ITAB_EVENTS

  • EXCEPTIONS

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

** With this read table statement itab_events is read for the desired event*+

READ TABLE itAB_eventS INTO wa_eventS WITH KEY name = 'END_OF_LIST'.

wa_eventS-form = 'END'.

MODIFY itAB_eventS FROM wa_eventS INDEX sy-tabix.

CLEAR wa_eventS.

*Pass the ITAB_EVENTS created in this Function Module

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

IT_EVENTS = ITAB_EVENTS

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

t_outtab = it_tab

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

*READ TABLE itAB_eventS INTO wa_eventS WITH KEY name = 'END_OF_LIST'.

  • wa_eventS-form = 'END'.

  • MODIFY itAB_eventS FROM wa_eventS INDEX sy-tabix.

  • CLEAR wa_eventS.

*in these statements ,the second line will automatically try to call subroutine with name end.

FORM END.

WA_END-TYP = 'S'.

WA_END-KEY = TEXT-004.

WA_END-INFO = SY-DATUM.

APPEND WA_end TO IT_END.

CLEAR WA_END.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = IT_END

  • I_LOGO =

  • I_END_OF_LIST_GRID =

  • I_ALV_FORM =

.

ENDFORM.

Hope it helps you.

Thanks Mansi

Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 11:02 AM

Edited by: MANSI ASNANI on Jan 9, 2009 7:31 AM

Read only

RoySayak
Active Participant
0 Likes
1,571

Hi PremRaj,

To capture the event (back,exit and cancel) which is present on standard toolbar on ALV Grid output, go to the PBO screen of the ALV output and put a PF-STATUS for the output screen and in that pf-status Function Key section declare the BACK, CANCEL and EXIT for the corresponding icon it will capture the event for that particular button.

some code snippet..

*---------------------------------------------------------------------*
*       MODULE PBO OUTPUT                           *
*---------------------------------------------------------------------*
module pbo output.
  set pf-status 'MAIN100'.
  set titlebar 'MAIN100'.
*
*
<your code portion>
endmodule.

Best Regards,

Sayak..

Read only

Pawan_Kesari
Active Contributor
0 Likes
1,570

Hi Experts,

I am working on ALV Grid , Data is Displayed in Grid well , But Can Any one please tell me how can i capture the event (back,exit and cancel) which is persent on standard toolbar on ALV Gried output .

Rgds,

Premraj

Assuming you are using FM to display grid you can use below parameter to specify that you need to capture specified FCODE


*"     REFERENCE(IT_EVENT_EXIT) TYPE  SLIS_T_EVENT_EXIT OPTIONAL

Structure of SLIS_T_EVENT is


types: begin of slis_event_exit.
types:   ucomm like sy-ucomm,
         before(1) type c,
         after(1) type c,
       end of slis_event_exit.

Insert three row in table IT_EVENT_EXIT and with FCODE in UCOMM

and put X in BEFORE or AFTER. Then your USER_COMMAND form

will be called accordingly.

FCODE you need are

Back - &F03

Exit- &F15

Cancel- &F12

Edited by: Pawan Kesari on Jan 8, 2009 9:29 PM

Read only

Former Member
0 Likes
1,570

thanks to all .

Read only

Former Member
0 Likes
1,570

Hi ,

If i click on save the event is not catured ,