Class overhead, function overhead and parameter overhead

Hi all,
I am interested in class overhead, function overhead (each function in a class) and parameter overhead (each parameter in function).
I saw somewhere that class overhead are 200 bytes.
Is it wise to give up on class and go for functional programming? (Only classes required to run the j2me app are created and nothing else)
How does function get called? Does it work like a stack? Where each parameters get pushed into the stack and later on pop out when control pass on to the function?
If your program is full of functions doesn't this make it very processor intensive?
What is the best solution?
Thanks in advance!

Hallo,
silly question: but what exactly do you mean when you say "full of attributes and methods that will never be used for this instance"?
I assume that when you have created your class you thought about the attributes and methods you wanted to include, and have not included any unnecessary baggage. I can only think that, perhaps, you have a class X that you would like to reuse, because it does all that you want. The only problem is that, for your specific problem, it carries a lot of excess baggage with it. You only need a few of the attributes and methods. Am I correct?
Such a class reuse will certainly incur some overheads, but let us try to analyse where they are:
1. Extra Code. The 'big' class is already defined and probably already loaded, so there should not be any overheads for the code.
2. Extra Data. Certainly creating a new instance of the 'big' class will require more memory. The question is how big is 'big' class, and how many instances do you want to create or have in existance at any one time? If the class is less than a few kB big and you only need a few instances at any one time, then you can afford to ignore the overhead.
3. Performance. Every time that you create an instance of the 'big' class, the processor must do some work to initialize it. The question is, what is required to initialize the class? This depends on what is in the constructor.
4. Programmer Time. If there is an existing class, then it will (probably, depending on documentation) take less time to reuse the class
than to write another, streamlined class. Someone else will already (hopefully) have debugged the 'big' class.
I think my view would be to reuse 'big' class unless there good grounds not to do so (see above). Your time is more important than a few overheads.

Similar Messages

  • How to get Classes of Functional Location and Equipment

    Dear Experts,
    I would like to know how to get all the classes in Classificaition of Functional Location and Equipement, FM ITOB_GET_CLASS_STANDARD is only get 1 class, how do I get all declared classes inside classification?
    Any table or FM?
    Thank you.
    Regards,
    Weng

    Weng,
       Table KLAH would give you all the available classes for every class type.
        FM CLAF_CLASSIFICATION_OF_OBJECT would get you all the assigned classes of a particular type for a object.
    Regards
    Narasimhan

  • Class overhead

    I have created a Class with 10 fields and 20 methods;
    I then create a JTable (10 x 100) with each cell holding a copy of the Class created.
    My question is : Does each of these Class holding individual 20 methods? or does JVM manages each copy of the created Class having a shared method pool?

    For documentation, see
    Virtual machine specification section 2.17.6
    Creation of New Class Instances. Note that that talks about data - code is not
    discussed.True, but if that can be assumed to completely
    describe what memory is allocated when an instance is
    created, then the absence of any mention of code
    implies that no memory is allocated for code when an
    instance is created.Just as one would assume that a reasonable implementation of a JVM would limit the duplication of the byte code. However a naive implementation could do that.
    And the specs do not specifically state that code duplication does not occur. So the request above for docs is going to be limited to something, if it exists, that states that the Sun JVM does not duplicate code. I don't consider it likely that anyone bothered to document that simply because it is so obvious. But that means that there are no documents that state that.

  • [svn:osmf:] 12518: Unit tests: moving the utility functions assertThrows, and assertDispatches into a TestCaseEx class.

    Revision: 12518
    Revision: 12518
    Author:   [email protected]
    Date:     2009-12-04 02:28:08 -0800 (Fri, 04 Dec 2009)
    Log Message:
    Unit tests: moving the utility functions assertThrows, and assertDispatches into a TestCaseEx class.
    Modified Paths:
        osmf/trunk/framework/MediaFrameworkFlexTest/org/osmf/composition/TestCompositeMetadata.as
        osmf/trunk/framework/MediaFrameworkFlexTest/org/osmf/metadata/TestFacetGroup.as
    Added Paths:
        osmf/trunk/framework/MediaFrameworkFlexTest/org/osmf/flexunit/
        osmf/trunk/framework/MediaFrameworkFlexTest/org/osmf/flexunit/TestCaseEx.as

  • Table Link between Functional Location and Class

    Functional location has 'class' ( under section 'general data' in tab 'location'). Could anybody suggest the table name where I can get one to one mapping between the functional location and it's 'class'.
    I have put the functional location in KSSK-OBJEK   but when I am providing the functional location say 
    ?0100000000000838737 in this field of table KSSK, it is resulting no output. Could you please elaborate
    more or suggest something.
    Thanks,
    Hetal

    Hi Gurus
    I am also looking for same information.
    Would you please advise where to get this Internal Type?
    Also would you please advise what is the use of table KSSK in whole process?
    Thanks in advance
    Kris

  • Documentation of Function Modules and Class Methods

    Hi
        I would like to know the function modules that handle the documentation of function modules and class methods.Is it possible to assign the same documentation of a function module to a method as method documentation?
        Are these documentations stored in some system tables?
    Thanks in advance,
    Hema

    The documentation text is stored as Standard text.
    you can see these details in the function module->
    goto->documentation->
    you will now see a screen, there GOTO->HEADER.
    YOU will see a screen with the below details.
    Text Name       Z0MM_SCM_FNC_EVCOR_DELIVERY
    Language        EN
    Text ID         FU   Function module
    Text object     DOKU       Online Documentation
    in this case TEXT NAME = FUNCTION MODULE NAME.
    These details are stored in STXH &STXL . But you can use select from these tables. you have to use READ_TEXT to read the documentation to the program.
    regards
    srikanth

  • LR 5 functions, methods, and properties not in LR 4 docs

    While we're waiting for the SDK docs, I scanned for functions, methods, and properties not documented in the LR 4 SDK.  Here's what I found:
    LrCatalog
    Methods:
    assertHasReadAccess
    buildSmartPreviews (array of LrPhoto)
    createPublishService
    createVirtualCopies
    getPhotoByLocalId
    withReadAccessDo
    Properties:
    allPhotos
    hasCatalogAccess
    hasReadAccess
    hasWriteAccess
    path
    targetPhoto
    targetPhotos
    LrCollection
    Methods:
    getSearchDescription
    LrController
    nextPhoto
    previousPhoto
    showBezel
    showGrid
    showLoupe
    startSlideshow
    stopSlideshow
    triggerCapture
    LrDialogs
    closeFloatingDialogsForPlugin
    presentFloatingDialog
    presentWebViewDialog
    showBezel (string message, [number fadeDelay])
    showStringsDialog
    LrDigest
    HMAC
    MD4
    MD5
    SHA1
    SHA256
    SHA384
    SHA512
    LrLogger
    Methods:
    configure
    restoreConfiguration
    saveConfiguration
    wrapMethodWithTrace
    wrapMethodsWithTrace
    Properties:
    _actions
    _name
    _savedConfigurations
    will_debug
    will_error
    will_info
    will_trace
    will_warn
    LrPhoto
    Methods:
    applyDevelopSnapshot
    buildSmartPreview
    deleteDevelopSnapshot
    deleteSmartPreview
    getDevelopSnapshots
    locationIsPrivate
    readMetadata
    requestJpegThumbnail
    saveMetadata
    withSettingsForPluginDo
    Properties:
    countStackInFolderMembers
    countVirtualCopies
    isInStackInFolder
    isVirtualCopy
    localIdentifier
    masterPhoto
    path
    stackInFolderIsCollapsed
    stackInFolderMembers
    stackPositionInFolder
    uuid
    virtualCopies
    LrPhotoPictureView
    makePhotoPictureView
    LrPlugin
    nativeFunction
    LrPublishService
    delete
    getAllRemoteIds
    promptEditDialog
    LrPublishedCollection
    Methods:
    getSearchDescription
    publishSelected
    setSearchDescription
    LrPublishedCollectionSet
    Methods:
    delete
    LrPublishedPhoto
    Methods:
    getDevelopSettingsDigest
    getMetadataDigest
    LrTableUtils
    debugDumpTable
    LrUUID
    generateUUID
    LrView
    Methods:
    path_control
    square_button
    LrXml
    xmlElementToSimpleTable
    I didn't examine the classes LrExportContext, LrExportRendition, LrExportSession, LrExportSettings, LrFilterContext, LrVideoExportPreset, LrWebViewFactory.

    jarnoh wrote:
    catalog:createVirtualCopies()
    I can't get this to create multiple virtual copies .
    jarnoh wrote:
    it seems to create virtual copies for active selection.
    I assume you mean one virtual copy for each selected photo(?)
    Active selection meaning the (one) "most" selected photo, i.e. catalog:getTargetPhoto().
    jarnoh wrote:
    Takes as many copy name strings as many photos are selected.
    I tried passing array of copy name strings, and get internal error: "WFSqliteStatement:bind() - illegal data type used as value".
    I tried passing one string, which works, but then it only makes one copy.
    I tried unpacking the names array (i.e. passing each as a separat parameter) - again, it only makes one copy, it having the first name passed.
    What am I doing wrong??
    UPDATE:
    ~~~~~~~
    I'm still working on this, but note: return array is not necessarily freshly created virtual copies, nor are all photos returned guaranteed to be virtual - worth checking what gets returned at least until you've got it figured out (I don't, yet).
    I've been able to get it to create one copy, just fine, but can't get it to create multiple copies.
    Note: omitting all parameters, it creates one copy named "Copy N", or you can pass a string to be used as copy name. I just don't know how to pass multiple names and get it to create multiple copies.
    Has anybody actually gotten catalog:createVirtualCopies to create more than one virtual copy (with a single call I mean) ???
    PS - Worth noting: this function does not need to be called with catalog write access, strangely enough (but maybe that's part of the problem I'm having? - only does one copy if no catalog write access???).
    ~~~~~~~
    Thanks in advance,
    Rob

  • Difference between function module and a method?

    Hi Experts
    Can anybody pls tell me the technical and functional difference between function moduel and a method?
    Thanks
    Sudhansu

    Hi,
    Function modules are procedures that are defined in function groups (special ABAP programs with type F) and can be called from any ABAP program. Function groups act as containers for function modules that logically belong together. You create function groups and function modules in the ABAP Workbench using the Function Builder.
    Function modules allow you to encapsulate and reuse global functions in the R/3 System. They are stored in a central library. The R/3 System contains a wide range of predefined function modules that you can call from any ABAP program. Function modules also play an important role in database updates and in remote communications between R/3 Systems or between an R/3 System and a non-SAP system.
    You can declare methods in the declaration part of a class or in an interface. To declare instance methods, use the following statement:
    METHODS <meth> IMPORTING.. [VALUE(]<ii>[)] TYPE type [OPTIONAL]..
                   EXPORTING.. [VALUE(]<ei>[)] TYPE type [OPTIONAL]..
                   CHANGING.. [VALUE(]<ci>[)] TYPE type [OPTIONAL]..
                   RETURNING VALUE(<r>)
                   EXCEPTIONS.. <ei>..
    When you declare a method, you also define its parameter interface using the additions IMPORTING, EXPORTING, CHANGING, and RETURNING. The additions define the input, output, and input/output parameters, and the return code. They also define the attributes of the interface parameters, namely whether a parameter is to be passed by reference or value (VALUE), its type (TYPE), and whether it is optional (OPTIONAL, DEFAULT).
    Unlike in function modules, the default way of passing a parameter in a method is by reference.
    As in function modules, you can use exception parameters (EXCEPTIONS) to allow the user to react to error situations when the method is executed.
    As in function modules, you can use the RAISE <exception> and MESSAGE RAISING statements to handle error situations.
    Regards,
    Sruthi

  • Pass C++ Class Member Function as a callable function in AIR Native Extension

    I'm writing an ANE and I'd like to know if anyone has been able to pass a C++ class member function pointer as a callable function from AIR? I have tried this so far with a little bit of C++11 trickery and it's crashing. I've also statically linked the libstdc++ into my library, according to the documentation, in order to ensure that these features I use work correctly. I have code like so:
    FakeWorld* world = new FakeWorld();
    *numFunctions = 1;
    memberFunctions = (FRENamedFunction*) malloc(sizeof(FRENamedFunction) * (*numFunctions));
    ANEMemberFunction mCreateFakeBody = std::tr1::bind(&FakeWorld::createFakeBody, world, std::tr1::placeholders::_1, std::tr1::placeholders::_2, std::tr1::placeholders::_3, std::tr1::placeholders::_4);
    ANEFunction* createFakeBody = mCreateFakeBody.target<ANEFunction>();
    memberFunctions[0].name = (const uint8_t*) "createFakeBody";
    memberFunctions[0].functionData = NULL;
    memberFunctions[0].function = createFakeBody;
    FRESetContextNativeData(ctx, (void*)world);
    I just realized I'm using C here for allocating the member functions array.. silly me, but I don't think this is the cause of my issue. I refuse to believe that Adobe has built to the Native Extensions portion of the runtime in such a way that I have to cram every single function I want to create (natively) into a global, C formatted namespace (Especially since the documentation says that C is only required for the extenion and context initializing function interfacing and the rest of the code can be done in C++ or objective-C). So please let me know if and how this is possible and I thank you so much in advance for your time!P.
    P.S. Currently when I run this code, I can do the object initialization just fine. As soon as I invoke the "createFakeBody" method on the native side, the runtime dies and simply says:
    Problem signature:
      Problem Event Name: BEX
      Application Name: adl.exe
      Application Version: 3.1.0.4880
      Application Timestamp: 4eb7612e
      Fault Module Name: StackHash_0a9e
      Fault Module Version: 0.0.0.0
      Fault Module Timestamp: 00000000
      Exception Offset: 00000000
      Exception Code: c0000005
      Exception Data: 00000008
      OS Version: 6.1.7601.2.1.0.256.48
      Locale ID: 1033
      Additional Information 1: 0a9e
      Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
      Additional Information 3: 0a9e
      Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
    Read our privacy statement online:
      http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
    If the online privacy statement is not available, please read our privacy statement offline:
      C:\Windows\system32\en-US\erofflps.txt
    Thanks again for your assitance.

    It's been a little while since i've dealt with C++ and not up to speed on tr1 or C++0x, so forgive me if i'm not helping.
    The the examples of std::tr1::bind that i'm seeing out there seem to be either dereferencing the bound 'this' pointer when creating the bound method, i.e. in your case *world instead of world, or using std::tr1::ref(*world), therefore i believe that bind expects the bound parameters to be passed by reference.
    Given that the result of std::tr1::bind is callable (basing that on http://stackoverflow.com/questions/3678884/virtual-member-functions-and-stdtr1function-how -does-this-work) could you simplify to the following:
    memberFunctions[0].name = (const uint8_t*) "createFakeBody";
    memberFunctions[0].functionData = NULL;
    memberFunctions[0].function = std::tr1::bind(&FakeWorld::createFakeBody, *world, std::tr1::placeholders::_1, std::tr1::placeholders::_2, std::tr1::placeholders::_3, std::tr1::placeholders::_4);
    Or for an even simpler starting point, creating a test member function 'helloWorld' in FakeWorld that takes no arguments and using:
    memberFunctions[0].name = (const uint8_t*) "helloWorld";
    memberFunctions[0].functionData = NULL;
    memberFunctions[0].function = std::tr1::bind(&FakeWorld::helloWorld, *world);
    Hope this helps.

  • What is the difference between function groups and Object Orientation

    Hello all
    I have read about this on the help.sap.com site, I still do not understand it completely, can some one explain me with  a simple example please ? (Not the increment counter example please !).
    Thanks a ton.
    Rgds
    Sameer

    Hello Sameer
    When you call a module of a function group for the first time in your program then the entire function group is loaded. However, this can happen only once within your report and all global variables within the function group will have the same values all the time (except they are manipulated via fm's).
    In contrast, you can create as many instances of the same class as you want and all of them can have different global attributes. And all these instances are independent of each other.
    On the other hand, if fm_A changes global attributes of the function group and fm_B reads these attributes then fm_B read the changed values.
    Or in other words:
    Function Group = can be instantiated only ONCE
    Class = can be instantiated unlimited
    Regards
      Uwe

  • Calling a object of class from other class's function with in a package

    Hello Sir,
    I have a package.package have two classes.I want to use object of one class in function of another class of this same package.
    Like that:
    one.java
    package co;
    public class one
    private String aa="Vijay";  //something like
    }main.java:
    package co;
    import java.util.Stack;
    public class main extends Stack
    public void show(one obj)
    push(obj);
    public static void main(String args[])
    main oo=new main();
    }when I compile main class, Its not compile.
    Its give error.can not resolve symbol:
    symbol: class one
    location: class co.main
    public void show(one obj)
                              ^Please help How that compile "Calling a object of class from other class's function with in a package" beacuse I want to use this funda in an application

    kumar.vijaydahiya wrote:
    .It is set in environment variable.path=C:\bea\jdk141_02\bin;.,C:\oraclexe\app\oracle\product\10.2.0\server\bin;. command is:
    c:\Core\co\javac one.javaIts compiled already.
    c:\Core\co\javac main.javaBut it give error.
    Both java classes in co package.Okay, open a command prompt and execute these two commands:
    // to compile both classes:
    javac -cp c:\Core c:\Core\co\*.java
    // to run your main-class:
    java -cp c:\Core co.main

  • How to pass select-option filed to Function Module Exporting Parameter

    Hi,
        How to pass select-option filed to Function Module Exporting Parameter.
    Thanks

    Hi,
    DATA: BEGIN OF ITAB5_WRK OCCURS 0,
            KUNNR     TYPE KNKK-KUNNR,  "CUSTOMER #
            SBGRP     TYPE KNKK-SBGRP,  "CREDIT REP
            KLIMK     TYPE KNKK-KLIMK,  "CREDIT LIMIT
            NAME1     TYPE KNA1-NAME1,  "CUSTOMER NAME
            SKFOR     TYPE KNKK-SKFOR,  "TOTAL A/R
            AMT1      TYPE KNKK-SKFOR,  "CURRENT
            AMT2      TYPE KNKK-SKFOR,                          "01-30
            AMT3      TYPE KNKK-SKFOR,                          "31-60
            AMT4      TYPE KNKK-SKFOR,                          "61-90
            AMT5      TYPE KNKK-SKFOR,                          "91-120
            AMT6      TYPE KNKK-SKFOR,                          "OVR 120
            BZIRK     TYPE KNVV-BZIRK,
          END OF ITAB5_WRK.
    SELECT-OPTIONS P_COMP     FOR  T001-BUKRS
      SELECT KUNNR SBGRP  FROM KNKK
             INTO TABLE ITAB5_WRK
             WHERE SBGRP IN P_REP
               AND KUNNR GE '0001000000'
               AND SKFOR NE 0.
      LOOP AT ITAB5_WRK.
        DELETE ADJACENT DUPLICATES FROM ITAB5_WRK COMPARING KUNNR.
      ENDLOOP.
      PERFORM GET_CREDIT_LIMITS.
    *=======================================================================
      IF P_DIST NE SPACE.
        LOOP AT ITAB5_WRK.
          SELECT SINGLE * FROM KNVV WHERE KUNNR EQ ITAB5_WRK-KUNNR
                                      AND VKORG EQ P_COMP
                                      AND VTWEG EQ '20'
                                      AND SPART EQ '10'
                                      AND BZIRK IN P_DIST.
          IF SY-SUBRC EQ 0.
            MOVE KNVV-BZIRK TO ITAB5_WRK-BZIRK.
            MODIFY ITAB5_WRK.
          ELSE.
            DELETE ITAB5_WRK.
          ENDIF.
        ENDLOOP.
      ENDIF.
    *==============================================================
      LOOP AT ITAB5_WRK.
        MOVE: 'F/S'            TO WRK-KKBER,
               ITAB5_WRK-KUNNR TO WRK-KUNNR.
        PERFORM AGING.
        ADD: W_SNFAE  TO ITAB5_WRK-AMT1,
             W_SFAE1  TO ITAB5_WRK-AMT2,
             W_SFAE2  TO ITAB5_WRK-AMT3,
             W_SFAE3  TO ITAB5_WRK-AMT4,
             W_SFAE4  TO ITAB5_WRK-AMT5,
             W_SFAE5  TO ITAB5_WRK-AMT6,
             W_SFAEL  TO ITAB5_WRK-SKFOR,
             W_SNFAE  TO ITAB5_WRK-SKFOR.
        MOVE: 'SPEC'            TO WRK-KKBER,
               ITAB5_WRK-KUNNR TO WRK-KUNNR.
        *PERFORM AGING.*
        ADD: W_SNFAE  TO ITAB5_WRK-AMT1,
             W_SFAE1  TO ITAB5_WRK-AMT2,
             W_SFAE2  TO ITAB5_WRK-AMT3,
             W_SFAE3  TO ITAB5_WRK-AMT4,
             W_SFAE4  TO ITAB5_WRK-AMT5,
             W_SFAE5  TO ITAB5_WRK-AMT6,
             W_SFAEL  TO ITAB5_WRK-SKFOR,
             W_SNFAE  TO ITAB5_WRK-SKFOR.
        MODIFY ITAB5_WRK.
      ENDLOOP.
    FORM AGING.
      *CALL FUNCTION 'CUSTOMER_DUE_DATE_ANALYSIS'* 
      EXPORTING
          BUKRS             = P_COMP           
          KKBER             = WRK-KKBER
          KUNNR             = WRK-KUNNR
          RASID             = 'FEND'
          KLIMP             = 'X'
        IMPORTING
          SFAE1             = W_SFAE1
          SFAE2             = W_SFAE2
          SFAE3             = W_SFAE3
          SFAE4             = W_SFAE4
          SFAE5             = W_SFAE5
          SFAE6             = W_SFAE6
          SFAEL             = W_SFAEL
          SNFA1             = W_SNFA1
          SNFA2             = W_SNFA2
          SNFA3             = W_SNFA3
          SNFA4             = W_SNFA4
          SNFA5             = W_SNFA5
          SNFA6             = W_SNFA6
          SNFAE             = W_SNFAE
        EXCEPTIONS
          NO-AGING_SCHEDULE = 1
          NO_TABLE_INPUT    = 2.
      CASE SY-SUBRC.
        WHEN 1.
          MESSAGE E999 WITH 'PLEASE ENTER AGING SCHEDULE'.
        WHEN 2.
          MESSAGE E999 WITH 'DO NOTHING ??'.
      ENDCASE.
    ENDFORM.                    "AGING
    Thanks

  • Any Class or Function Module..?

    Hi,
    I have a requirement to update some Infotypes when the user updates the salary package from portal.
    Is there any class or Function Module available?
    Pls let me know.
    Thanks,
    KK
    Moderator Message: Thread locked. Points unassigned.
    Edited by: Suhas Saha on Sep 29, 2011 8:38 PM

    Hello,
    I had a similar requirement earlier and I've used the Function modules listed below to update the IT0008, IT0014 & IT0589 respectively.
    HR_SPA_FILL_IT0014_STRUCTURE
    HR_SPA_FILL_IT0008_STRUCTURE
    HR_SPA_FILL_IT0589_STRUCTURE
    Hope this helps.
    Regards,
    Venkata Phani Prasad K

  • Function Groups and Function Modules

    Hi,
    Can anyone give me the detail steps for creating Function Group and then from that function group creation of function module with example?
    Regards,
    Chandru

    Hi,
    Function Group creation -
           A function group is a program that contains function modules. With each R/3 system, SAP supplies more than 5,000 pre-existing function groups.
         In total, they contain more than 30,000 function modules. If the functionality you require is not already covered by these SAP-supplied function modules, you can also create your own function groups and function modules.
          We can put all the relevant function modules under one function group and all the global variables can be declared in this FG.
    FG Creation:
    1)     Function group can be created in SE80. There choose the 'Function Group' from the list of objects.
    2)    Then give a name for ur function group (starts with Y or Z) and press ENTER.
    3)   The click 'YES' in the create object dialog box and give a short desc. for this FG and save.
    Function Module:
                 A function module is the last of the four main ABAP/4 modularization units. It is very similar to an external subroutine in these ways:
    Both exist within an external program.
    Both enable parameters to be passed and returned.
    Parameters can be passed by value, by value and result, or by reference.
    The major differences between function modules and external subroutines are the following:
    Function modules have a special screen used for defining parameters-parameters are not defined via ABAP/4 statements.
    tables work areas are not shared between the function module and the calling program.
    Different syntax is used to call a function module than to call a subroutine.
    Leaving a function module is accomplished via the raise statement instead of check, exit, or stop.
    A function module name has a practical minimum length of three characters and a maximum length of 30 characters. Customer function modules must begin with Y_ or Z_. The name of each function module is unique within the entire R/3 system.
    Defining Data within a Function Module
    Data definitions within function modules are similar to those of subroutines.
    Within a function module, use the data statement to define local variables that are reinitialized each time the function module is called. Use the statics statement to define local variables that are allocated the first time the function module is called. The value of a static variable is remembered between calls.
    Define parameters within the function module interface to create local definitions of variables that are passed into the function module and returned from it (see the next section).
    You cannot use the local statement within a function module. Instead, globalized interface parameters serve the same purpose. See the following section on defining global data to learn about local and global interface parameters.
    Defining the Function Module Interface
    To pass parameters to a function module, you must define a function module interface. The function module interface is the description of the parameters that are passed to and received from the function module. It is also simply known as the interface. In the remainder of this chapter, I will refer to the function module interface simply as the interface.
    To define parameters, you must go to one of two parameter definition screens:
    1) Import/Export Parameter Interface
    2) Table Parameters/Exceptions Interface
    Then in the FM interface screen, give the following
    1) Import parameters
    2) Export parameters
    3) Changing parameters
    Then give
    1) Define internal table parameters
    2) Document exceptions
    You enter the name of the parameter in the first column and the attributes of the parameter in the remaining columns. Enter one parameter per row.
    Import parameters are variables or field strings that contain values passed into the function module from the calling program. These values originate outside of the function module and they are imported into it.
    Export parameters are variables or field strings that contain values returned from the function module. These values originate within the function module and they are exported out of it.
    Changing parameters are variables or field strings that contain values that are passed into the function module, changed by the code within the function module, and then returned. These values originate outside the function module. They are passed into it, changed, and passed back.
    Table parameters are internal tables that are passed to the function module, changed within it, and returned. The internal tables must be defined in the calling program.
    An exception is a name for an error that occurs within a function module. Exceptions are described in detail in the following section.
    Syntax for the call function Statement
    The following is the syntax for the call function statement.
    call function 'F'
        [exporting   p1 = v1 ... ]
        [importing   p2 = v2 ... ]
        [changing    p3 = v3 ... ]
        [tables      p4 = it ... ]
        [exceptions  x1 = n [others = n]].
    where:
    F is the function module name.
    p1 through p4 are parameter names defined in the function module interface.
    v1 through v3 are variable or field string names defined within the calling program.
    it is an internal table defined within the calling program.
    n is any integer literal; n cannot be a variable.
    x1 is an exception name raised within the function module.
    The following points apply:
    All additions are optional.
    call function is a single statement. Do not place periods or commas after parameters or exception names.
    The function module name must be coded in uppercase. If it is coded in lowercase, the function will not be found and a short dump will result.
    Use the call function statement to transfer control to a function module and specify parameters. Figure 19.9 illustrates how parameters are passed to and received from the function module.
    sample FM
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
      I_CALLBACK_PROGRAM                = ' '
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
      IT_FIELDCAT                       =
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        t_outtab                          =
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Example
    1  report ztx1905.
    2  parameters: op1 type i default 2,   "operand 1
    3              op2 type i default 3.   "operand 2
    4  data rslt type p decimals 2.        "result
    5
    6  call function 'Z_TX_DIV'
    7       exporting
    8            p1      = op1
    9            p2      = op2
    10      importing
    11           p3      = rslt.
    12
    13 write: / op1, '/', op2, '=', rslt.
    Regards,
    Shanthi.P
    Reward points if useful ****
    Edited by: shanthi ps on Jan 26, 2008 12:03 PM

  • Automatic generation of ABAP-classes from Function Groups?

    Hey there,
    is there a way of having (SE24)-ABAP-Classes generatetd outomaticaly by providing an existing function group?
    I think, the following mapping shold be possible::
    - the function group is the class
    - its function modules are public (static) methods
    - any form-routines are private methods
    -> I don't want to to that boring work myself, some tool should be able to do that just fine, right? So, is there such a tool?
    Thanks, regards
    Joachim

    Sorry, sounds like the only two people who answered are not aware of such a tool...
    There is one additional point, which I hadn't thought about initially. With ABAP OO you also have a much stricter syntax and many more statement variants that are obsolete and thus cannot be used. This is another hindrance for writing such a tool (but of course not impossible, I just kind of doubt that any reasonable programmer would write such a thing).
    Anyhow, I never understood why SAP is pushing OO so much (declaring all non-OO as obsolete), even going as far as implementing stricter syntax checks for OO. In my opinion a much better option would've been to implement some flag that switches on the more strict syntax checks, similarly to the Unicode check they've introduced. Coding in OO or non-OO, both have its use. Rules from SAP to code everything in OO even in cases where OO doesn't work seems straight silly as a general recommendation: E.g. if I have to code an RFC module, why would I want to bloat my code by introducing a class for implementing the functionality so that the RFC is just a wrapper around the class (unless the additional class gives me some real benefit)?
    As much as I appreciate using OO classes supplied by SAP, I often have difficulties seeing objects in the requirements that I have to code (which might of course just be a reflection of my programming skills). A class with just some static methods is often an indication of poor OO design, i.e. there is no reasonable/tangible object and all you have is a utility class with a collection of various methods. To me it's important that the code is well structured, doesn't have any side effects, etc. This can be achieved with non-OO coding as well as OO, but switching from non-OO to OO doesn't guarantee at all that the code is any better.
    In the end, if you just have a single function group, I'd recommend to do the translation manually and try to apply good OO design principles (instead of a straightforward 1-to-1 translation). E.g. for a class with just static methods (which I'd expect an automated translation would result in) one might want to take a peek at [singletons are evil|http://www.c2.com/cgi/wiki?SingletonsAreEvil] versus [singletons are good|http://www.c2.com/cgi/wiki?SingletonsAreGood]. I know it's silly advice if you're a seasoned OO programmer; but if not, I think your time is much better spent by thinking about the design and then applying it instead of using some automated tools where you'd later have to anyhow do some refactoring...

Maybe you are looking for

  • CME - Second Call Drop the first call

    Greetings, Anyone ever seen something like this? I get a call on my extension, and when I receive a call on another phone, the first call (in my Phone) drops.

  • Cannot open project - Newer Version of Premiere?

    I am attempting to open a Premiere project file that was sent to me. It was an After Effects project that has been converted to a Premiere project as I do not have After Effects. I cannot open it, as Premiere pops up with a box saying that the projec

  • What is Premiere Elements 9? | Learn Premiere Elements 9 | Adobe TV

    Video tutorial providing an introduction to Premiere Elements 9. http://adobe.ly/w4j2QR

  • How to Harvest OSB project into OER

    Hi All, I want harvest OSB11g project/services into OER 11.1.1.5.0. and these are installed on linux machine. Can you please provide me the steps to harvest the services from OSB to OER. Thanks in advance. Madhu

  • ALV WD no-sign?

    Hi all, Where can I set the no-sign option in ALV for Web Dynpro Abap? I've looked at the methods of cl_salv_wd_config_table and also tried search (Google and SDN) without sucsess. Any help is appreciated. Thanks in advance! Regards, Charles