| Home • Tips • Tutorials • Forums • Certification Q's • Interview Q's • Jobs • Testimonials • Contact Us | ||||||||||||||||
Document Categories:
What's New?
Contribute?Sample SpecsWhat's Hot? |
ALV Utility ProgramBy Agnihotro Sinha, Dell Services
Developers would like build the various ALV interactive Event handlers of a Report with the minimum effort and would like to devote more time on the data extraction and data display logic. At the same time Client would like to have all the Reports maintain a consistence Event pattern like Top-of-page, End-of-Page pattern and invest more time in verifying data display in ALV. This document will help in implementing a global ALV
Utility class which can be used by all Reports for displaying output in ALV
format. Developers will be able to create ALV handlers just by
calling a method of this ALV Utility global class and passing the name of the
Report Program. Details of the Report will be automatically picked by the
Utility class. Moreover this Class has options for enhancements and hence
can be customized as per the Project need. This Guide will demonstrate how to automate the creation of Top-Of-Page
event of an ALV output.
We have developed a Utility Class ZCL_ALV_HEADER_UTILITY which can be used to implement Top-of-page section of any ALV Report with minimum coding effort. This class has different methods which, if used in proper sequence, can build a Top-of-page in any customized way. Basic steps to implement the Top-of-page logic using this Utility class:
1. Selection screen naming convention should be as per Project naming convention guideline. This will help in configuring the Utility program for generic use. For example: 1.1. Parameter: P_<NAME> 1.2. Select-options: S_<NAME> 2. All the Selection screen elements should have their correspondence Text created in the Text pool of the Report program. This is crucial since the Utility class reads the Text pool of the report. 3.
Report program can use either ALV with OOPs approach or ALV
with Function Module approach.
4.
For events of ALV grid we always create a Local Class to
handle the events. Design the Local class in the Program to handle TOP-OF-PAGE.
This Local Class should have a method to write code for TOP_OF_PAGE of Class
CL_GUI_ALV_GRID. Here this method is LCL_EVENT_HANDLER.
5.
The FORM will have an object of the Class CL_DD_DOCUMENT. This
Object has to be designed to display the TOP-OF-PAGE form. Here this object is
E_DYNDOC_ID.
In the above code: 5.1. The Object for the Utility Class is built using the Constructor method. This Constructor needs a reference object of Class CL_DD_DOCUMENT, which will be used internally by the Class to build up the TOP_OF_PAGE. The reference Object shown here
is P_DYNDOC_ID. This Object has been
created while creating the implementation of the local class event.
5.2.
After the Utility Class object is created, we have to use the READ_SELECTION_SCREEN
method of this class to read the Selection screen elements of our current
program. This is done by simply passing the Report program name using SY-REPID
system variable.
5.3. If there are any Parameters or Select Options in the Selection screen which has to have special formatting while display, then the method ADD_SPECIAL_PARAM has to be used. In this method we have to pass the name of the special parameter/select-option and also pass the type of this parameter. Presently in this example, we
wanted to display S_DATE select-option of the selection screen using External
Date formatting. Passing the details of the parameter to this class method,
internally the class will be converting the Date entry for this select-option to
external user recognized format and will display it.
5.4. Finally call the method SET_GRID_TOP to display the top of the page. In this method interface we can define a maximum of 4 titles for the Report. These titles will be displayed in the top before the Selection parameters are listed.
|
|||||||||||||||
|
Please send us your feedback/suggestions at webmaster@SAPTechnical.COM Home • Contribute • About Us • Privacy • Terms Of Use • Disclaimer • Safe • Companies: Advertise on SAPTechnical.COM | Post Job • Contact Us ©2006-2007 SAPTechnical.COM. All rights reserved. All
product names are trademarks of their respective companies. SAPTechnical.COM
is in no way affiliated with SAP AG. Graphic Design by Round the Bend Wizards |
||||||||||||||||