Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Ashg1402
Contributor

Introduction: -


This document is to show how to make a simple interactive report in OOPS by using event 'HOTSPOT_CLICK' present in standard sap class 'CL_GUI_ALV_GRID'.

               I have taken a scenario of displaying the PO (Header and Item) data for a vendor by creating event driven interactive report. The program is created in ALV+OOPS. The interaction will be done on vendor number and PO document number.


The flow will be: - Vendor Details -> PO (Header) -> PO (Item)

For code snippet please check the attached file.

Steps:-


  Create a program in SE38 and SE51. The names of the programs should be same and keep on saving the progress with time to time.  In the screen painter add the 3 custom containers which will show the data in ALV GRID format. Here we will add two fields which will take the vendor number as input from user.

       Declare the internal tables and the object for the custom container in ABAP editor.

       As it is an event driven program we need to create a local class for creating a method which will be registered as an event for our interactive working. Save it.

Un-comment the PBO and PAI modules from SE51 and navigate to ABAP editor.

Here in the methods we will declare the working of our program, i.e. registering the event, putting select query and creating field catalogues for ALV output.

Our program is created in SE51 i.e. it is already having 4 events of its own so we have to be careful while writing code and creating the program flow.

Double click on STATUS_0011 method and it will switch to the ABAP editor. Here we will create our objects which we declared for custom containers previously. Just like for lfa1_container, create the remaining two for EKKO and EKPO. We will register the method which we created as event handle in status_0011 as that event will trigger at runtime.

After this save it, go back and double click on method under PROCESS AFTER INPUT.

It will again switch to editor. In this we will declare the select query which will select the initial vendor data according to the user input and we will also declare the button command triggering.

Above we declared and implemented our local class for event handling. There we created a subroutine in the method. After declaring as shown  create the ‘FORM’ part of that subroutine.

  Declare the field catalogs for the internal tables and activate everything. While creating field catalogs, declare the property ‘HOTSPOT’ as ‘X’ for the field on which the interactive will work.  Create a t-code in SE93 for our program.  Give the input in the fields which we declared and click on display.

Output:-


8 Comments
Former Member
0 Kudos

nice and detailed tutorial :smile:

former_member196331
Active Contributor
0 Kudos

Good Expecting More Documents. Related to OOPS.

Thank u..........

Ashg1402
Contributor
0 Kudos

Thank u, will try uploading more on OOPS

:smile:

Ashg1402
Contributor
0 Kudos

Thank you Elzkie.. :smile:

Former Member
0 Kudos

Hi

nice to see the demo.

Do you have to customize the GUI? :razz:

Jelena
Active Contributor
0 Kudos

To be honest, you lost me here:

Create a program in SE38 and SE51. The names of the programs should be same

Yeah, because it is the same program. Or, to be accurate, one ABAP report (let's use the SAP terminology). SE51 is just Screen Painter. Actually one does not even need to go there because you can add a screen from SE38 (ABAP Editor), just open the object list. Although most developers probably moved on to SE80 a while ago.

And why is it necessary to create a transaction? Someone without a clue might assume this is a vital step while the report can be simply executed from the Editor.

There are quite good demo reports for all possible ALV functionality already available in SAP, just search in SE38 by SALV*. For example, SALV_DEMO_HIERSEQ_EVENTS is specifically for the events.

Not saying there should be no blogs on this on SCN but they should (a) be accurate; (b) offer the readers something more than a demo program does. E.g. are there any specific design considerations? Any OOP theory you'd like to share? Is there some peculiar business requirement that can be satisfied by using this? What compelled you to write this blog? Were you not aware of the demo programs? Did you have any difficulties? Simple "do these steps because I said so" doesn't add the whole lot of value IMHO.

There are some good blogs with suggestions for other bloggers, this one is a good start:

http://scn.sap.com/community/about/blog/2013/06/13/build-a-better-blog-step-1-tell-the-story-you-wan...

Ashg1402
Contributor
0 Kudos

Hello Jelena,

    I tried to keep it as simple as I could, so that the one who is freshman can understand it. I agree with you that most developers are probably moved to SE80 and I am one of them too.

And I also agree that there are many good demo reports in ALV, like the one which you suggested, but is it possible for all to understand.? There is just coding and no explanation I guess.

Jelena
Active Contributor
0 Kudos

The demo reports have all the explanations at the beginning and one can use the paragraph marks to find the corresponding piece of code. And there are additional comments in the program's body. If someone finds this difficult to understand then they might want to revisit a decision to pursue an SAP career - it won't get any easier than that.

Unfortunately the demo programs only offer a technical description of the steps, without any design background or an explanation why all those steps are necessary. But, as noted above, this post doesn't offer any additional information either.