Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all articles
Browse latest Browse all 935

Simple event handling in ABAP OOPS

$
0
0

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)

 

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.

 

 

yalv_oops11.JPG

 

 

 

 

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

 

 

yalv_oops1.PNG

yalv_oops2.JPG

 

       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.

 

yalv_oops3.JPG

 

 

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.

yalv_oops10.JPG

 

 

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.

 

yalv_oops5.JPG

 

yalv_oops6.JPG

 

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.

 

yalv_oops9.JPG

 

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.

 

yalv_oops7.JPG

yalv_oops8.JPG

 

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

yalv_oops12.JPG


yalv_oops13.JPG


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>