Differences between Package & procedure/function

hi everybody,
can anyone tell me why we need to go for functions eventhough we are having procedures and why we need to go for packages eventhough we are having procedures&functions
Best Regards,
bobby

Hi,
We have to go for functions though we have procedures, because in cases we have to return the values to a select statement.
ex: select abc from dual;
where abc is a function which will return a value to the select statement on computing the result.
And also functions must and should return a value.
We use packages though we have both procedures and functions
1) Overloading : Use the same subprogram name for multiple times by changing the parameters
2) Security : We can declare any of the subprograms as private with in package. so that the subprogram can't accessed outside of this package. And the functions and procedures with in packages are more secured than outside ones because they have to call by package name.
ex: there a procedure abc with in xyz package
you have call it by xyz.abc
3) Reduce Network traffic : when you call procedure/function with in a package entire body will store in RAM. so further if u want use other subprograms with in the package it will take directly from RAM, no need to go to the database again.
4) Ease of maintainable : We can easily maintain.

Similar Messages

  • Re: DIfference between Schemas, PCRS' FUnctions and Operations

    Dear SAPExperts,
    Can anybody pls tell me what is difference between Schemas, PCRS' Functions and Operations.
    Thanx in advance
    Regards
    Aniruddha

    Hi Aniruddha
    When the payroll driver is executed (for ex: PC00_M40_CALC for INDIA is executed) the schema IN00 (standard schema) is executed and it calls certain functions (functions may use Rules. Rules contain Operation) and also subschemas.
    Functions could be of four types
    1. Performing some payroll computations (E.g. INEPF function calculates the PF amount of an employee during payroll run)
    2. Calling rules (E.g. P0045 function calls a rule INLN to compute the loan details of a personnel number).
    3. Getting data from Infotypes (E.g. P0581 will get the data from Infotype-581 for payroll processing).
    4. For some decisions. (E.g. IF & ENDIF function is used to execute as per the true and false decisions) etc.
    When the PY is executed SAP uses lot of Internal Tables to store data and also provides data to other internal tables.
    The read and change access to Internal Tables is enabled using functions that are executed in a personnel calculation schema and using operations that are executed in personnel calculation rules.
    The following is just an attempt to provide some info on how Functions are processed during the PY Run. For ex: (functionality of subschema XIN0 and INBD)
    1. INITIALIZATION OF PAYROLL: When the Payroll is executed first the subschema XIN0 is called,   This subschema comprises the following main steps:
    I.     Specify program type (payroll or evaluation)
    II.     Set switch for database updates (YES/NO) all database updates are controlled via this switch (otherwise simulation)
    III.     Only infotypes from the HR master record which apply to the selected personnel number are read.
    IV.     All Time Management infotypes are imported.
    V.     Specify check against control record PA03 (test or live).
    2. READ BASIC DATA: Once the Initialization of Payroll is successful, the subschema INBD is called. This subschema reads the Basic data of an employee who is there in the Payroll execution. Basic Data includes, determining Employee Name, Reading Work Center/Basic Pay Data, Setting Financial Year Dates and Allowance Grouping Tables, Reading Previous Employment Tax Details, Reading Housing (HRA/CLA/COA), Reading Exemptions, Reading Income from Other Sources, Reading Section 80 Deductions, Reading Investment Details (Sec 88), Reading Provident Fund Contributions, Reading Other Statutory Deductions, Reading Car and Conveyance, Reading Long Term Reimbursements, Read ID Details. Function GON checks whether all the master data has been imported, no further processing of schema will occur unless certain data is present.
    The Subschema INBD calls the following functions in order to read the Basic Data:
    ENAME :
    Function ENAME reads the last valid name of the employee in the payroll period. The formatting used for the country in question is used when displaying this name.
    WPBP
    If an employee receives a pay increase within a payroll period, the Basic Pay infotype (0008) is changed and delimited as of a specific date. Two data records exist for one payroll period.
    During payroll, the system writes the Basic Pay wage type to the results table with two different indicators. These split indicators are a link to the WPBP table that contains the relevant values. The system takes into consideration both data records for the corresponding partial periods when calculating remuneration.
    ININI
    P0580
    P0581
    P0582
    P0584
    P0585
    P0586
    P0587
    P0588
    P0583
    P0590
    P185I
    GON :
                    Function GON checks whether all the master data has been imported. No further processing of the schema will occur unless certain data is present. Checking procedures vary from country to country. There must always, however, be a work center (P007).
    [Def. of Functions, Rules and Operations (copied from Raju's answer)
    Schema is a collection of functions
    A Rule is a collection of operations.
    An operation is a very basic piece of logic that is used, mostly, to manipulate wage types
    Best Regards
    Reddy

  • Quality management( difference between sampling procedure & sample drawing)

    Hi Experts,
    I am very new to quality management module & working in united states. i am trying to find difference between sampling procedure & sample drawing procedure.
    I see that sample drawing procedure is assigned to Inspection Plan & sampling procedure is assigned to characteristics, But i don't know the difference between these two, Please help me.
    Regards,
    Seshu

    Hi,
    SAMPLING PROCEDURE :
    A procedure that contains the rules for determining the sample size for an inspection. The sampling procedure also specifies the type of valuation to use for results recording (attributive, variable, or manual).
    Use
    You assign a sampling procedure to each characteristic in an inspection plan to calculate the sample size.
    Integration
    In a sampling procedure, you must activate the function for inspection points based on a sample-drawing procedure if you assigned a sampling procedure and a sample-drawing procedure to an inspection plan at the characteristic and header levels respectively.
    SAMPLE DRAWING PROCEDURE:
    Definition
    A master data object in which you plan the drawing of physical samples. In the sample-drawing procedure, you specify:
    Which categories of physical samples must be drawn
    How many physical samples must drawn
    The size of each physical sample
    Whether the drawing of physical samples must be confirmed
    Use
    The system uses the information in the sample-drawing procedure together with the information in the inspection plan to calculate the physical sample sizes, and to create physical-sample records when an inspection lot is created.
    Structure
    A sample-drawing procedure contains the following types of information:
    Header data
    The sample drawing header contains the following information fields and control indicators:
    Key that identifies the sample-drawing procedure
    Short text description for the sample-drawing procedure
    Authorization group that limits the access to the sample-drawing procedure
    Text for matchcode searches
    Long text indicator
    Indicator for calculating the number of physical samples on the basis of number of containers in the inspection lot (as opposed to the base unit of measure)
    Confirmation indicator to activate or deactivate the confirmation requirement
    Lock indicator to prevent the sample-drawing procedure from being used
    Usage indicator that shows whether the sample-drawing procedure is currently used in an inspection plan
    Sample-drawing item(s)
    A sample-drawing item contains specific instructions for creating physical samples with respect to a specific inspection lot container type and specific partial-sample numbers in the inspection plan. In a sample-drawing item, you can also specify:
    Which categories of physical samples you want to create (primary samples, pooled samples, and reserve samples)
    The physical sample container you use to draw each category of physical sample
    A factor to increase the quantity of physical samples to be created (for example, if you need to carry out more than one inspection)
    The number of physical samples to be created (fixed number or variable number based on a sampling scheme)
    Integration
    The sample-drawing procedure interacts with the following planning objects:
    Inspection plan
    You assign a sample-drawing procedure to an inspection plan to activate the functions for sample management.
    Sampling scheme (optional)
    If you want the system to determine the number of physical samples automatically on the basis of a sampling scheme, you can reference sampling schemes in a sample-drawing procedure.
    Hope it helps...
    Regards,
    Priyanka.P
    AWARD IF HELPFULL

  • Encryption of pl/sql package/procedures/function code

    Is it possible to make the code inside a package/procedure/function un readable to other users.
    As is some of the api package body code in portal ?
    thanks in anticipation.
    SD,

    PL/SQL Wrap Utilityhttp://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/c_wrap.htm#LNPLS016
    Note, however that you cannot revert back to original un-wrapped code from a code that has been wrapped. You would need access to the original source files to get the original source code.

  • What is the difference between subroutine and function module?

    What is the difference between subroutine and function module?

    Hi,
    they can both return values.
    FMs are mainly used when a routine is to be performed by many programs.
    Subroutines (forms) are generally only executed within one program.
    You can perform routines from other programs, but it's not often done.
    both forms and FMs are reusable modularization units.
    To distinguish we generally say that forms are used for internal modularization and
    FMs are used for external modularization.
    To decide on which to implement, consider whether you need the content to be used just for a limited program
    or wheteher it can be called from many independent programs.
    For the first purpose it is better to implement a form whereas for the second we implement an FM.
    However, ABAP does not isolate the usage context.
    That is; you can call a form from another program within whose code the form is not actually implemented.
    However, this requires attention since the form may utilize global variables.
    The same issue holds for FMs.
    FMs are encapsulated in function groups and function groups may have global variables that can be globally
    used by all FMs inside it.
    Thanks,
    Reward If Helpful.

  • What is the difference between the normal function module and bapi function

    hi,
    what is the difference between the normal function module and bapi function module.

    Hi
    BAPI stands for Business API(Application Program Interface).
    A BAPI is remotely enabled function module ie it can be invoked from remote programs like standalone JAVA programs, web interface etc..
    You can make your function module remotely enabled in attributes of Function module but
    A BAPI are standard SAP function modules provided by SAP for remote access. Also they are part of Businees Objest Repository(BOR).
    BAPI are RFC enabled function modules. the difference between RFc and BAPI are business objects. You create business objects and those are then registered in your BOR (Business Object Repository) which can be accessed outside the SAP system by using some other applications (Non-SAP) such as VB or JAVA. in this case u only specify the business object and its method from external system in BAPI there is no direct system call. while RFC are direct system call Some BAPIs provide basic functions and can be used for most SAP business object types. These BAPIs should be implemented the same for all business object types. Standardized BAPIs are easier to use and prevent users having to deal with a number of different BAPIs. Whenever possible, a standardized BAPI must be used in preference to an individual BAPI.
    Regards
    Anji

  • Package/procedure/function calls done with in a package

    Hi Experts,
    Can anybody suggest me the table/ a query to find the package/procedure/function calls (with in the same db or remote) done with in a package.
    It would be great if we can provide a tree like structure of the objects being called/used.
    btw.. dba_dependencies will provide me the info about the global procedures only not the local ones used with in the package body.
    Appreciate your time..
    Thanks
    Manju

    manjukn wrote:
    Hi Experts,
    Can anybody suggest me the table/ a query to find the package/procedure/function calls (with in the same db or remote) done with in a package.
    It would be great if we can provide a tree like structure of the objects being called/used.
    btw.. dba_dependencies will provide me the info about the global procedures only not the local ones used with in the package body.
    Appreciate your time..What database version do you have?
    11g I think provides some sort of fine grained dependency information which can detail packages, but prior to 11g you can only get dependencies on the database objects themselves of which functions/procedures within a package are not, as the package itself is the object.
    I don't think there's any easy way to find out from any tables or views and I think third party tools would have to parse the code to determine such things themselves, so that may be one of your only options.

  • How can I create packages procedure & function in user-define Library

    hi.
    i am already created packages procedure & function in database and use so on.
    now i would like to create these in library file.
    please anyone give me example of any procedure or function to store in library.
    thanks
    Ali

    <FONT FACE="Arial" size=2 color="2D0000">> please send me one simple example for create library
    then create any function in library.
    2nd is any package can be create in library or not??
    Thanks S.K
    AliHave you checked the link?
    A simple example is provided.
    I think What I understood from your post is that, you want to put function/ Proc and want to call that as Library ..
    Which is not  possible.
    For exampel an external routine is a third-generation language procedure stored in a
    dynamic link library (DLL), registered with PL/SQL, and called by the DBA to perform
    special-purpose processing.
    In Unix a dynamic link library is known as a shared object (so).
    At run time, PL/SQL loads the library dynamically, then calls the routine as if it were a
    PL/SQL subprogram. To safeguard our database, the routine runs in a separate address
    space, but it participates fully in the current transaction. Furthermore, the routine can
    make a call back to the database to perform SQL operations.
    To identify a DLL we have to use CREATE LIBRARY command.
    The CREATE LIBRARY command is used to create a schema object, library, which
    represents an operating-system shared library, from which SQL and PL/SQL can call
    external third-generation-language (3GL) functions and procedures.
    Learn something more on External Procedures
    -SK
    </FONT>

  • Package,procedure,functions

    Iam having one requirement. i.e. i want know which package,procedure,function is calling....?
    for ex:
    procedure a
    -- p1
    call_procedure_b;
    -- p2
    call_procedure_c;
    at p1,p2 i want to know which is being called?
    is there any possibiliyt like that?
    can anybody help me on this?

    user632359 wrote:
    can u please provide me with an example?Here's some code someone posted a while back (can't remember who), but I saved it for a rainy day...
    create or replace procedure who_called_me( owner      out varchar2,
                             name       out varchar2,
                             lineno     out number,
                             caller_t   out varchar2 )
    as
        call_stack  varchar2(4096) default dbms_utility.format_call_stack;
        n           number;
        found_stack BOOLEAN default FALSE;
        line        varchar2(255);
        cnt         number := 0;
    begin
        loop
            n := instr( call_stack, chr(10) );
            exit when ( cnt = 3 or n is NULL or n = 0 );
            line := substr( call_stack, 1, n-1 );
            call_stack := substr( call_stack, n+1 );
            if ( NOT found_stack ) then
                if ( line like '%handle%number%name%' ) then
                    found_stack := TRUE;
                end if;
            else
                cnt := cnt + 1;
                -- cnt = 1 is ME
                -- cnt = 2 is MY Caller
                -- cnt = 3 is Their Caller
                if ( cnt = 3 ) then
                    lineno := to_number(substr( line, 13, 6 ));
                    line   := substr( line, 21 );
                    if ( line like 'pr%' ) then
                        n := length( 'procedure ' );
                    elsif ( line like 'fun%' ) then
                        n := length( 'function ' );
                    elsif ( line like 'package body%' ) then
                        n := length( 'package body ' );
                    elsif ( line like 'pack%' ) then
                        n := length( 'package ' );
                    elsif ( line like 'anonymous%' ) then
                        n := length( 'anonymous block ' );
                    else
                        n := null;
                    end if;
                    if ( n is not null ) then
                       caller_t := ltrim(rtrim(upper(substr( line, 1, n-1 ))));
                    else
                       caller_t := 'TRIGGER';
                    end if;
                    line := substr( line, nvl(n,1) );
                    n := instr( line, '.' );
                    owner := ltrim(rtrim(substr( line, 1, n-1 )));
                    name  := ltrim(rtrim(substr( line, n+1 )));
                end if;
            end if;
        end loop;
    end;
    create or replace function who_am_i return varchar2
    is
        l_owner        varchar2(30);
        l_name      varchar2(30);
        l_lineno    number;
        l_type      varchar2(30);
    begin
       who_called_me( l_owner, l_name, l_lineno, l_type );
       return l_owner || '.' || l_name;
    end;
    /

  • Idea for package/procedure/function distribution ??

    Hi all
    We have multilple databases (10.2.0.3). And we have a lot of "utility" packages for both appl. util and for DBA utils.
    We have created a XXXUTIL schema on each database.
    How do we keep those schemas in sync automatically - apart from doing export/import? We will name on "master" and all other should be in sync with this one schema (packages/procedures/functions/views)
    Is there a smarter way of doing this, a pull or push replication solotiuon. We are on the 10g Enterprise verison.
    Ideas appreciated
    best regards
    Mette

    Hi,
    As you said you got a lot of utility Packages, I think you can directly compile those scripts one you changed in the master DB, there won't be any thing to Sync the Procedures from One DB to another DB.
    If it is a data then, you might gone for DB Link, Streams etc., for replicating the data.
    In order to automate your need to write a script for logging into DB and running set of scripts and disconnecting - a shell script.
    Just think is that your requirement.!!
    Pavan Kumar N

  • Difference between Territory Team Functions and Opportunity Team Functions?

    Hi,
    What is the difference between Territory team functions and Opportunity team functions? and how can we add values to the LOV of territory team functions?
    Scenario:
    Need to assign Territory Team on a territory with functions therefore when the territory is assigned to an opportunity and the team members of that territory displays in Opportunity Team, the functions LOV should AUTO POPULATES .
    Please find attached files for reference.
    Your help in this regards will be highly appreciated.
    Thank you.

    Hi,
    What is the difference between Territory team functions and Opportunity team functions? and how can we add values to the LOV of territory team functions?
    Scenario:
    Need to assign Territory Team on a territory with functions therefore when the territory is assigned to an opportunity and the team members of that territory displays in Opportunity Team, the functions LOV should AUTO POPULATES .
    Please find attached files for reference.
    Your help in this regards will be highly appreciated.
    Thank you.

  • What is difference between tax procedure and pricing procedure?

    Dear Gurus,
    Would you please let me know the difference between tax procedure and pricing procedure?
    Why it is necessary to maintain them separately?
    Thanks in advance,
    Ranjan

    Hi
    Tax procedure settings
    OBBG - Assign Country to calculation procedure.
    OBCO - Specify structure for Tax Jurisdiction code. For country like U.S.A.
    LG -> character length of first level of hierarchy within your tax jurisdiction code structure.
    LG -> Second level of hierarchy as above.
    LG -> Third level of hierarchy as above.
    LG -> Fourth level of hierarchy as above.
    TX -> Tick if you want the system to determine taxes on a line by line basis instead of determining them on a cumulative basis
               per tax jurisdiction code.
    OBCP - Define Tax Jurisdiction code
    Dil -> Tick if you do not want tax amounts included in the based amount used for calculating cash discounts.
    Txl -> Tick if you want the cash discount amount deducted from the base amount that is used to calculate taxes.
    FTXP - Define Taxes on Sales/Purchases Code.
    OBCL - Allow Tax codes for non-taxable transactions.
    In MM module, pricing procedure is used during RFQ and PO creation. Total value of material based on all addition and subtraction like discount, surcharge, tax, freight, etc. In this we are defining pricing procedure and linking to vendor and purchase department through the virtual schemas. 
    Following steps for pricing procedure as,
    1. Define conditions.
    2. Define pricing procedure.
    3. Define virtual purchase organization and vendor.
    4. Info Record.
    Regards,
    Raman

  • Difference between Tax Procedure and Pricing Procedure

    What is the major difference between tax procedure and pricing procedure. Can any one explain in detail.

    Procedures are used, for example, in the following applications:
    Pricing in sales and distribution
    Applying overhead in Product Costing (costing sheets) and for CO internal orders
    Calculating accrued costs in Profitability Analysis
    Output control (printed confirmations, EDI messages, electronic mail)
    Account determination
    Calculating taxes on sales/purchases
    Calculating accruals in Cost Center Accounting
    Pricing for resource planning

  • Difference between Sampling Procedure and Sample-drawing procedure

    Friends,
    I am new to QM and started learning QM Module. My doubt is what is the difference between Sampling Procedure and Sample-drawing procedure?
    The reason for my doubt is, we can determine the sample quantity with Sampling procedure itself. then what is the need of sample-drawing procedure?
    Also describe primary, pooled and reserved samples.
    Regards,
    IMIMINT

    Hi,
    Sampling Procedure 
    Definition
    A procedure that contains the rules for determining the sample size for an inspection. The sampling procedure also specifies the type of valuation to use for results recording (attributive, variable, or manual).
    Use
    You assign a sampling procedure to each characteristic in an inspection plan to calculate the sample size.
    Sample-Drawing Procedure 
    Definition
    A master data object in which you plan the drawing of physical samples. In the sample-drawing procedure, you specify:
    Which categories of physical samples must be drawn
    How many physical samples must drawn
    The size of each physical sample
    Whether the drawing of physical samples must be confirmed
    Use
    The system uses the information in the sample-drawing procedure together with the information in the inspection plan to calculate the physical sample sizes, and to create physical-sample records when an inspection lot is created.
    Primary Sample : It is the sample drawn from the lot directly.
    Pooled Sample : It is the sample whcih is combination of 2 or more primary samples.i.e. primary sample sfrom say 3 differetn drums is mixed and tested.
    Reserved Sample :sample which is preserved for the testing in future.
    or in other words
    Primary samples (1st stage)
    Physical samples drawn directly from a material or batch that will be inspected or used to create pooled samples.
    Pooled samples (2nd stage)
    Physical samples to be created by mixing the contents of two or more primary samples from the same material or batch.
    Reserve samples
    Primary physical samples drawn from a material or batch reserved for future inspection.
    Vishal
    Edited by: VISHAL JONNALWAR on Feb 4, 2010 6:43 AM

  • Difference between Guided Procedures and Business Workflow?

    Hi,
    I'm new to workflows, so this question could be easy or absurd.
    Is there a difference between Guided Procedures and Business Workflows? Or is this
    the same thing with two names?
    If it is different, when do I use which of them?
    Could both use UWL?
    Thanks a lot
    greetz
    chris

    Workflow is a technology used to support business processes. You can make workflows without thinking/doing business processes. When you do business processes you will always wind up using workflow technology. All business process execution tools should by principle use a workflow engine at least SAP ones do. Not sure about others like Oracle BPEL tools for example.
    SAP tools like GP and BPM/XI use either Netweaver Java or Abap workflow embedding the technical aspects of workflow design and runtime into the Netweaver stack simplifying the business user experience as it relates to designing and running business processes. But designing and running workflows using workflow tools directly still is very muc an IT challenge.

Maybe you are looking for

  • Magnified photos are out of focus

    When I magnify a photo in iphoto11 it is out of focus. How can I fix this?

  • ESS iView Errors?

    I got this error for every ESS iView: The initial exception that caused the request to fail, was:    java.lang.NullPointerException     at com.sap.pcuigp.tracking.BTrackingComp.isValuePackSystem(BTrackingComp.java:290)     at com.sap.pcuigp.tracking.

  • How can i download the new Mac OS X version 10.6.8?

    how can i download the new Mac OS X version 10.6.8 so i can install the latest iTunes on to my 2007/08 mac desktop?

  • Arch Linux Pumpkin Carving!

    After seeing Best Halloween Pumpkin Carvings from Ghost1227's blog, it inspired me to do a unique pumpkin carving this year. Looking through the archive of awesome pumpkin carvings, of course I didn't see Arch Linux (but there was Tux fortunately). S

  • Question re Photoshop Elements upgrade

    I have upgraded Photoshop Elements from v10 to v11 (without deleting v10).  However, v11 can't 'see' my catalogue.  How do I fix this?