| Home • Tips • Tutorials • Forums • Certification Q's • Interview Q's • Jobs • Testimonials • Contact Us | ||
Tips Categories:
Contribute?What's New?
What's Hot? |
Aspects of Object Orientation using Function Groupby Raghava Vakada, Mouri Tech Solutions “I would like to explain about Aspects of Object
Orientation through “Function Group”. The function group can be created
using the standard SAP transaction SE37. Once the function group is created you
can declare “Global Variables” in the
function group and can be used any function module which has
belong to that function group”. In this article I am creating a function group
“ZCOUNTER” and created a global variable “COUNTER”. I have created 3
custom function modules “ZSET_COUNTER”, ZSET_INCREMENT and ZGET_COUNTER. The
following function modules are called in a report program “ZFG_REPORT”. Creating a “Function Group”. Create function Group in “SE37”
Enter the Function Group name “ZCOUNTER” and Short text.
Click “Save” button and specify the local package. Create function module “ZSET_COUNTER” and enter the
following details shown below screen shot.
Goto à
Global Data.
Create Global Variable “COUNTER”, as shown below.
Save, Check and Activate the Top include program. Get Back to function Module. Enter the following source code.
Save, Check and Activate the function module. Create function module “ZSET_INCREMENT” and enter the
following details shown below.
Enter the following code as shown below.
Save, Check and Activate the function module. Create function module “ZGET_COUNTER” and enter the
following details shown below.
Enter the following code as shown below .
Create the report program “ZFG_REPORT”
and enter the below code. *&---------------------------------------------------------------------* *& Report ZFG_REPORT * *& * *&---------------------------------------------------------------------* *& * *& * *&---------------------------------------------------------------------* REPORT ZFG_REPORT . data number type i value 5. CALL FUNCTION 'ZSET_COUNTER'
EXPORTING
VAL = number
.
do 3 times. CALL FUNCTION 'ZSET_INCREMENT'
.
enddo.
CALL FUNCTION 'ZGET_COUNTER'
IMPORTING
GETVAL = number.
.
write :/ 'The number has value : ' color 7, number color 5.
After
this section of the program has been processed, the program variable NUMBER will
have the value 8.
|
|
|
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 |
||