7210973 custom developed badi

Upload: moonchandu

Post on 10-Apr-2018

229 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/8/2019 7210973 Custom Developed BADI

    1/21

  • 8/8/2019 7210973 Custom Developed BADI

    2/21

  • 8/8/2019 7210973 Custom Developed BADI

    3/21

  • 8/8/2019 7210973 Custom Developed BADI

    4/21

    A BADI class ZCL_EX_DELTA_7_0_DEMO1 is created automatically.

  • 8/8/2019 7210973 Custom Developed BADI

    5/21

  • 8/8/2019 7210973 Custom Developed BADI

    6/21

  • 8/8/2019 7210973 Custom Developed BADI

    7/21

  • 8/8/2019 7210973 Custom Developed BADI

    8/21

  • 8/8/2019 7210973 Custom Developed BADI

    9/21

  • 8/8/2019 7210973 Custom Developed BADI

    10/21

  • 8/8/2019 7210973 Custom Developed BADI

    11/21

  • 8/8/2019 7210973 Custom Developed BADI

    12/21

  • 8/8/2019 7210973 Custom Developed BADI

    13/21

    Defining BAdIs Attributes

    When a BAdI is created, BADI class gets automatically created withthe suffix CL_EX_ after the first character of the BAdI name.

    Package : Specifies the Package in which this BAdI resides.

    Multiple use : With this option you can have multipleimplementations for the same BAdI

    Filter-Dependent : Business Add-Ins may be implemented

    depending on a specific filter value (example, country-specificversions: Distinct implementations of the BAdI can be created foreach country). A filter type must be entered when defining yourenhancement (a country or industry sector, for example). Allmethods created in the enhancement's interface have filter value'FLT_VAL' as their import parameter. The method then selects theactive implementation based on the data provided in the filter

    value

  • 8/8/2019 7210973 Custom Developed BADI

    14/21

    Defining BAdIs - Interface

    An interface is created automatically with the suffix IF_EX_ after thefirst character of the BAdI name

    When you double click the interface ZIF_EX_DELTA_7_0_DEMO1 you will

    be taken into the class builder where you can define the methods,parameters and exceptions for that interface

  • 8/8/2019 7210973 Custom Developed BADI

    15/21

    Defining BAdIs Interface methods

    Specify the methods in the Class Builder for the interface

    Instance methods can access all of the attributes of a class, and cantrigger all of the events of the class

    Static methods can only access static attributes and trigger static events

    Click on the Parameters button to specify any Import/Export parametersfor the method

  • 8/8/2019 7210973 Custom Developed BADI

    16/21

    Defining BAdIs Interface methods - parameters

    The Import/Export parameters for the method are specified in the

    Parameters section

    The type specifies whether the parameter is an Importing, Exporting,

    Changing or Returning parameter.

    Check the Optional field if it is not a mandatory parameter

    The type, default value and description of the parameter can be specified

  • 8/8/2019 7210973 Custom Developed BADI

    17/21

    Defining BAdIs Exceptions

    You can specify any exceptions in the Exceptions section.

    For class based exceptions, check the checkbox Exception Classes.

  • 8/8/2019 7210973 Custom Developed BADI

    18/21

    BADI Implementation

    To create an implementation, proceed as follows:

    ChooseABAP Workbench -> Utilities -> Business Add-Ins (transaction

    SE19) from the SAP menu

    Enter a name for the implementation and choose Create.

    Enter the name of the BAdI you want to create an implementation for

    in the dialog box that appears.

  • 8/8/2019 7210973 Custom Developed BADI

    19/21

    BAdI Implementation

    During implementation creation, a class for implementing the

    enhancement's interface is also created

    Navigate to the Class Builder by double-clicking the method.

  • 8/8/2019 7210973 Custom Developed BADI

    20/21

    Insert the source code between the method and endmethod statements

    and activated.

    Exception handling for the method can be handled in this section.

    Implementing BAdIs: Method implementation

  • 8/8/2019 7210973 Custom Developed BADI

    21/21

    Using a BAdI

    When a BAdI is created, the enhancement manager automaticallygenerates a class that implement the interface

    In order to be able to call static methods, you must declare thecorresponding class in ABAP Objects using the class definition loadstatement

    In the example having created a BAdI for division, you can program thecall for the BAdI in the following manner:

    Create an Interface Reference Variable in the programL_BADI_INSTANCE

    Perform the statement call method cl_exithandler using the BAdIand the interface reference variable.

    Call method DIVIDE_NUMBERS using the interface reference variableL_BADI_INSTANCE.