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:
Very beautiful Post. Really providing us technical knowledge.
ReplyDeleteSAP Courses in Pune