Technology: SAP ABAP Simplified Part-IV
-SAP Consultant, L & T Infotech
This is the 4th and last article of the series SAP ABAP Simplified and is also published by GoArticles. This acrticles is morever focused on explaining concepts of function modules and Badis. For your reference earlier articles of the series are as follows: SAP ABAP Simplified part -1, SAP ABAP Simplified part -2, SAP ABAP Simplified part -3
Function Modules:
Function modules are like sub routines which can be called from any part of ABAP program. The difference between sub routines and Function modules is that: Sub routines are useful with in a particular Program where as once a function module is created; it can be used in any program. We can say Function Modules are global where as sub routines are not. The type of the data element used in the import or export parameters of Function Module is to be defined initially in the dictionary.
A Function Group is to be defined prior to the definition of Function module. This function module is embedded to the function group. A function group contains any number of function modules.
A Function module contains the following elements:
1. Attributes
2. Import parameters
3. Export parameters
4. Changing
5. Tables
6. Exceptions
7. Source Code.
Attributes:
It defines the details of function module like the function group under which the function module is created, type of the function Module, and the general data like user who created and changed the object, and in which package it is present.
Import parameters:
The input to the function module is passed through the import parameters. Here we can only define a structure (which contains only 1 record) or separate fields.
Output Parameters:
The output generated after executing the program will be passed through export parameters. Here also we can pass only a structure with single records or as separate fields.
Changing:
The parameters which can be used as both input and output are declared using Changing tab of function module.
Tables:
The input or output parameters that contains multiple records are passed in and out of the function module using Tables Tab of function module. A structure will be treated as a table if it is defined in the associated type of this section.
Source code:
The real program logic will be written in the source code portion. All the manipulations with the import parameters are done in this section and the result is send through output parameters/tables/changing. A function module can make a call to any number of function modules. All the manipulations that are performed in report program can be done in Function modules also.As before mentioned we can define the type of the function module in the attributes section whether it is a Normal function module or Remote function Module.
By selecting the appropriate radio button the type is selected. The output of the stand alone function module is viewed using Execute button or F8.Here the user is allowed to give the required input parameters. It will pop up a window to enter the input value if the parameter is selected as Mandatory in the import parameter section.
BAdis:
Discussing the similarities of BAdis and User-Exits:
1. Both BAdi and User-exits are enhancement concepts.
2. Both will allow the users to write their own code in addition to the already existing standard code.
However, it replaces the user-exit concept which has fewer advantages compared to BAdi. BAdis are implemented using Object Oriented concept. The difference stays here that there can be only one user-exit for a definition but there can be n number of BAdis for a single BAdi definition which is called as BAdi Implementation. More over reusability of BAdis makes the biggest difference.
Through BAdi definition the enhancement point is defined and with the help of BAdi implementation the required code for the BAdi is implemented. There can be any number of implementations for a definition. Call to that particular implementation is done based on the requirement.
The process flow in User-Exit is sequential where as in BAdi the process is in the form of modules. BAdi provides the filter option to ensure that the specific implementation is called. The original code would not get affected when a BAdi is used. This is very useful when a particular application is a shared application.
Here we have reached to the end of SAP ABAP Simplified Series. Hope this series will be of greate help you. Comments are always welcome so that we can improve on our further articles.



Hi Swarna,
The Articles you are written are simply superb.Thanks for Sharing with many people.If you have some time you can write some more articles like this spanning different topics in SAP ABAP which are very useful for many people.Hope to see more articles.Again Thanks lot for your work.
Suresh
Hi Swarna:
Very good articles on SAP ABAP. Expect more articles from real time perspective.
Regards,
Ramesh
Hi Suresh & Ramesh,
Thanks for the support. Soon we will come up with new articles both on theoretical part and with practical examples.
Regards,
Swarna Munukoti.
Nice to know you people liked our articles. We are working on some more articles on SAP, Netweaver, MBA, Healthcare, Philosophy and more. I request people to read articles from other categories as well. Also we have launched the forums, please register yourself and explore some really great SAP code snippets and much more.
Visit forums here.
http://forums.madeitsimple.com
If anyone want to contribute then do mail us at following id:
madeitsimple@gmail.com
ameya@madeitsimple.com
Regards,
Ameya
Hi Swarana,
Your articles are very good.
Thanks for Your effort and intiating to share the knowledge with others.
This is very good platform to learn the new things. we are expecting more articles on from You.
regards,
Sathish.
Leave a comment!
Web Content by Ameya Pimpalgaonkar is copyright protected & licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 2.5 India License.
Based on a work at www.madeitsimple.com.
Categories
Interactive SAP Training Manual
Archive
Blogroll
Tag Cloud
ABAP ABAP Simple abap simplified AIMCAT apple apple imac apple iPhone Aromatherapy career CAT CAT 2008 CAT 2009 Crack SNAP Economy English EP Essential oils GK for SNAP GMAT Grammar Holiday how to use essential oils IIFT GK list of essential oils MBA MBA in niche sector MBA opportunities Media money Netweaver Niche MBA degree parner Parnerkar Parnerkar Maharaj Poornawad prepare for SNAP GK Recession SAP SAP ABAP SAP ABAP Simplified SAP EP sap ep interview questions SNAP GK TIME VARecent Posts
Most Commented
About Ameya