April 20, 2010 – 10:57 pm | 11 Comments

Dear Jane,
95% of this presentation is half mental.
Seriously! STOP playing games. Throw away those shrouds of insanity. Get out of that virtual ‘web’.
Ok, about your presentation, in few words – no reasoning. Just some facts …

Read the full story »
Bon Voyage

Business-Startups

Healthcare

MBA

Technology

Home » Technology

Technology: SAP ABAP Simplified Part-IV

Submitted by Ameya Pimpalgaonkar on July 17, 2008 – 5:32 am 5 Comments

- Swarna Munukoti

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


Twitter del.icio.us Digg Facebook linked-in Yahoo Buzz StumbleUpon

Related Articles

5 Comments »

  • Suresh said:

    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

  • Ramesh said:

    Hi Swarna:

    Very good articles on SAP ABAP. Expect more articles from real time perspective.

    Regards,
    Ramesh

  • Swarna Munukoti said:

    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.

  • admin said:

    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

  • Sathish Kumar said:

    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!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar blog.

eXTReMe Tracker