SAP ALV Tutorial 2 – Event

Andy posted @ Thu, 03 Sep 2009 06:51:05 +0800 in ABAP with tags ABAP ALV ERP , 7350 readers


     This article deals with event handling in SAP alv and mechanism behind it. In a nutshell, alv Grid is an implementation of custom control. You must be very familiar with the dynpro programming. In dynpro programming, we general have two events: PBO and PAI. If user have some actions in the frontend screen, the event PAI will be triggered and program can have different reactions according to different function codes. In the custom control, things become a slight different. It will trigger an specific event, if user does some actions in the frontend. There are two types of event: system event and application event.

The only difference of the two events are the sequence of triggering event handler method and the PAI event.

System event: A system event is triggered before any automatic field checks (for example,required fields) have taken place on the screen, and before any field transport. The PAI and PBO events are not triggered. Consequently, you cannot access any values that the user has just changed on the screen. Furthermore, there is no field transport back to the screen after the event, so values that you have changed in the event handling are not updated onthe screen.

The handler method that you defined for the event is called automatically by the system.However, you can use the method set_new_ok_code  to set a new value for the OK_CODE field. This then triggers the PAI and PBO modules, and you can evaluate the contents of the OK_CODE field as normal in a PAI module.

Application event: This event is processed in the PAI event. Consequently, all field checks and field transport has taken place. If you want the event handler method to be called at a particular point in your application program, you must process the event using the static method CL_GUI_CFW=>DISPATCH.

Events in alv

The alv Grid Control uses the grid control to display the output table. So we can say that the alv Grid Control is a wrapper that uses the wrapper of a Basis control. As the ‘outer layer’, this wrapper spares the developer from having to register the events on the frontend in order to simplify event handling. The alv Grid Control differs from Basis controls in the following respects:All events are registered as system events when the control is instantiated.If you want to register all events as application events, you must use parameter I_APPL_EVENTS ( See also: CONSTRUCTOR). As usual, you must then call method CL_GUI_CFW=>DISPATCH in the PAI module.

Events DELAYED_CALLBACK or DELAYED_CHANGED_SEL_CALLBACK are registered using method register_delayed_event.

Below are all the events that are valid in alv. But there are some differences depanding on how we call the alv.

In object oriented method, we generally have below events:

User-defined Text Output

print_end_of_list Define output text to be printed at the end of the entire list
print_top_of_list Define output text to be printed at the beginning of the entire list
print_end_of_page Define output text to be printed at the end of each page
print_top_of_page Define output text to be printed at the beginning of each page
subtotal_text Define self-defined subtotals texts

Mouse-controlled Actions in the Grid Control

button_click Query a click on a pushbutton in the alv Grid Control
double_click Query a double-click on a cell of the alv Grid control
hotspot_click Query a hotspot click on columns defined for this purpose in advance
onDrag Collect information when elements of the alv Grid Control are dragged
onDrop Process information when elements of the alv Grid Control are dropped
onDropComplete Perform final actions after successful Drag&Drop
onDropGetFlavor Distinguish between options for Drag&Drop behavior

Processing of Self-defined and Standard Functions

before_user_command Query self-defined and standard function codes
user_command Query self-defined function codes
after_user_command Query self-defined and standard function codes

Definition of Self-defined Functions

toolbar Change, delete or add GUI elements in the toolbar
menu_button Define menus for menu buttons in the toolbar
context_menu_request Change context menu
onf1 Define self-defined F1 help

In function module method, we can call funciton module ’REUSE_ALV_EVENTS_GET’to get all the events supported by FM ‘REUSE_ALV_GRID_DISPLAY’. You can also find all the event constants in the type pool SLIS, e.g. SLIS_EV_TOP_OF_PAGE,SLIS_EV_USER_COMMAND.

Ok, above are all the basic introduction about alv event and its mechanism. In the next article of this series, I will use some specific code to demo how to use event both in OO and FM method.

Avatar_small
Cedric said:
Wed, 14 Oct 2009 21:07:18 +0800

Hi guys. There is an evil tendency underlying all our technology - the tendency to do what is reasonable even when it isn't any good. Help me! I can not find sites on the: Caring for human hair extensions. I found only this - <a href="http://bwmonumental.spellcaster.com.br/Members/Extensions">african american human hair extension testimonials</a>. Some include that the morphological two brushes are prominent. Septum contributions possess uterus males in poem to time, metamorphosis, and continent. Best regards :cool:, Cedric from Arabia.

Avatar_small
jennifer said:
Wed, 15 Apr 2020 13:27:12 +0800

Andy's Blog is very informative. Through this article, the author shares the different tutorial videos. From this article, you can learn about new things. Thank you so much for sharing this article and I am happy to see it. https://photoeditingindia.com/services/photo--services

Avatar_small
MILY said:
Tue, 26 May 2020 17:55:58 +0800

Thanks for providing this article on ALV events. The SAP provides a set of ALV function modules, which can be put into use to embellish the output of a report. This set of ALV events is used to enhance the readability and functionality of any report output. www.getcbdinformation.com

Avatar_small
Zaiya said:
Mon, 27 Jul 2020 16:26:42 +0800

In this tutorial, they have explained about the event handling in SAP alv and the mechanism behind it. online diamond dealers I hope that these are some good and informative piece of information that you guys have read from here. You will get more about this from here.

Avatar_small
nio said:
Mon, 10 Aug 2020 17:30:26 +0800

It is so great to see this article here. I get a great knowledge regarding the programming applications as well as web development from this post. This very interesting to read all the posts that is sharing in this website cbd health benefits

Avatar_small
king size bedroom se said:
Mon, 04 Oct 2021 20:11:53 +0800

I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post.

Avatar_small
bed set said:
Tue, 05 Oct 2021 00:27:03 +0800

Nice to read your article! I am looking forward to sharing your adventures and experiences.
<a href="https://www.purbafurniture.ca/bedroom.html">furniture bedroom</a>

Avatar_small
www.lagunaderocha.or said:
Sat, 09 Oct 2021 00:20:33 +0800

This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post!

Avatar_small
La Quinta Daycare said:
Sun, 10 Oct 2021 15:09:03 +0800

I read a article under the same title some time ago, but this articles quality is much, much better. How you do this..

Avatar_small
best binary options said:
Tue, 12 Oct 2021 18:48:05 +0800

I appreciate everything you have added to my knowledge base.Admiring the time and effort you put into your blog and detailed information you offer.Thanks.

Avatar_small
best forex brokers said:
Mon, 18 Oct 2021 22:38:55 +0800

Great Article it its really informative and innovative keep us posted with new updates. its was really valuable. thanks a lot.

Avatar_small
local Boise escape r said:
Sun, 24 Oct 2021 20:14:38 +0800

I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business.

Avatar_small
locksmith service Bo said:
Tue, 26 Oct 2021 17:49:16 +0800

Thank you for the update, very nice site..

Avatar_small
The Rug Cleaning Sho said:
Tue, 26 Oct 2021 18:50:57 +0800

I'm glad I found this web site, I couldn't find any knowledge on this matter prior to.Also operate a site and if you are ever interested in doing some visitor writing for me if possible feel free to let me know, i am always look for people to check out my web site.

Avatar_small
Weathertight Roofing said:
Tue, 26 Oct 2021 19:38:51 +0800

I am no expert, but I believe you just made an excellent point. You certainly fully understand what you are speaking about, and I can truly get behind that.

Avatar_small
Excellent Digitizing said:
Thu, 28 Oct 2021 23:52:34 +0800

This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work

Avatar_small
forex education said:
Sat, 30 Oct 2021 18:19:38 +0800

Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging,

Avatar_small
custom patch maker said:
Sun, 31 Oct 2021 18:21:15 +0800

I admit, I have not been on this web page in a long time... however it was another joy to see It is such an important topic and ignored by so many, even professionals. professionals. I thank you to help making people more aware of possible issues.

Avatar_small
DKH Farm Fencing said:
Wed, 03 Nov 2021 17:03:09 +0800

This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post!

Avatar_small
rent a car beograd said:
Sun, 07 Nov 2021 02:03:10 +0800

Yes i am totally agreed with this article and i just want say that this article is very nice and very informative article.I will make sure to be reading your blog more. You made a good point but I can't help but wonder, what about the other side? !!!!!!THANKS!!!!!!

Avatar_small
abogado de inmigraci said:
Sun, 14 Nov 2021 19:19:43 +0800

I am hoping the same best effort from you in the future as well. In fact your creative writing skills has inspired me.

Avatar_small
abogado de inmigraci said:
Sun, 14 Nov 2021 20:11:27 +0800

Wonderful article, thanks for putting this together! This is obviously one great post. Thanks for the valuable information and insights you have so provided here.

Avatar_small
immigration lawyer said:
Mon, 15 Nov 2021 14:37:14 +0800

I have read your blog it is very helpful for me. I want to say thanks to you. I have bookmark your site for future updates.
<a href='https://my.talladega.edu/ICS/Academics/BUS/BUS__368/2016_SU-BUS__368-FT___2/Coursework.jnz?portlet=Coursework&screen=StudentAssignmentFacultyView&screenType=change&id=cc42c0e5-cdd0-4947-a94b-545c22d766c5&s=74cd54b5-85af-473c-aa6d-f49b0f116704'>immigration lawyer</a>

Avatar_small
immigration lawyer said:
Mon, 15 Nov 2021 14:37:46 +0800

I have read your blog it is very helpful for me. I want to say thanks to you. I have bookmark your site for future updates.

Avatar_small
tire said:
Sun, 12 Dec 2021 18:02:28 +0800

Great write-up, I am a big believer in commenting on blogs to inform the blog writers know that they’ve added something worthwhile to the world wide web!..

Avatar_small
pneumatici said:
Mon, 13 Dec 2021 13:51:45 +0800

I found your this post while searching for information about blog-related research ... It's a good post .. keep posting and updating information.

Avatar_small
reifen said:
Mon, 13 Dec 2021 23:46:16 +0800

Admiring the time and effort you put into your blog and detaileccd information you offer!..

Avatar_small
AAA said:
Sat, 01 Jan 2022 13:51:39 +0800

Thank you for taking the time to publish such a detailed and informative write-up. 메이저사이트

Avatar_small
kitten foods said:
Sun, 16 Jan 2022 23:04:21 +0800

Great content material and great layout. Your website deserves all of the positive feedback it’s been getting.

Avatar_small
AAA said:
Wed, 16 Feb 2022 05:11:11 +0800

Any movies is normally outstanding. You've gotten a lot of particularly as good writers and singers. Document prefer you will the best quality about financial success. 메이저사이트

Avatar_small
AAA said:
Sat, 28 May 2022 04:58:16 +0800

Thanks for the information provided! I was finding for this information for a long time, but I wasn’t able to find a reliable source. 토토사이트

Avatar_small
AAA said:
Sun, 05 Jun 2022 04:58:08 +0800

More often than not, when you use service search terms these firms specialize in jobs appointing during my realm possibly work around my local area. Nothing at all is nope during this. Truthfully, near painful global financial eras travelers needs to be tiny bit far more powerful utilizing a assignment shop. Whenever you want to contemplate it, the reason that most guys need a purpose in the geographic area is actually easiness. It is somewhat convenient to work almost domestic since it will reduce problems, strains, but also money created by transportation. Prospect that are searhing for activities retaining during my domain is because definitely is nifty to remain dear to home assuming any type of critical internal crisis rears its ugly head. This is certainly to tell you practically of the classic benefits caught up once you have young children. 雲台

Avatar_small
AAA said:
Tue, 14 Jun 2022 16:20:07 +0800

This web site seems to get a sizable ammount of visitors. How do you obtain visitors to this? It provides a good person twist on issues. I guess having something authentic or considerable to give information on is the most important element. tradein macbook

Avatar_small
meidir said:
Mon, 03 Oct 2022 23:05:57 +0800

I got what you intend,bookmarked , very nice internet site . 攝影器材

Avatar_small
seo service UK said:
Thu, 26 Oct 2023 15:21:53 +0800

I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work...

Avatar_small
뉴토끼 said:
Thu, 07 Dec 2023 17:25:58 +0800

"Very nice post. I just stumbled upon your weblog and wanted tto say that
I've really enjoyed surfing around your blog posts. After all I will be subscribing to your feed and I hope yyou write again very soon!"


Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter