Polymorphism vs interfaces

Hi,
I'm extending an interface that overrides a doStuff() method. When I call the method, the most specific method is not used. I've provided a code example. Do you know how I can achieve polymorphic behaviour using this kind of interface heirarchy?
public interface Stuff  {
  public void doStuff(Object o);
public interface FireGrainedStuff extends Stuff {
  public void doStuff(Integer i);
public class InterfaceTesting implements FireGrainedStuff {
  public static void main(String[] args) {
    InterfaceTesting tester = new InterfaceTesting();
    tester.runTest();
  public void runTest() {
    InterfaceTesting test1 = new InterfaceTesting();
    testIt(test1,new Object());
    testIt(test1,new Integer(0));
    Stuff test2 = new InterfaceTesting();
    testIt(test2,new Object());
    testIt(test2,new Integer(0));
    FireGrainedStuff test3 = new InterfaceTesting();
    testIt(test3,new Object());
    testIt(test3,new Integer(0));
  public void testIt(Stuff stuff, Object arg) {
    stuff.doStuff(arg);
  public void doStuff(Object o) {
    System.out.println("doStuff(Object o)");
  public void doStuff(Integer i) {
    System.out.println("doStuff(Integer i)");
// OUTPUT:
doStuff(Object o)
doStuff(Object o)
doStuff(Object o)
doStuff(Object o)
doStuff(Object o)
doStuff(Object o)

public void testIt(Stuff stuff, Object arg) {
stuff.doStuff(arg);
public void doStuff(Object o) {
System.out.println("doStuff(Object o)");
public void doStuff(Integer i) {
System.out.println("doStuff(Integer i)");
The problem is with your overloaded methods 'doStuff' in your InterfaceTesting class. Overloaded methods are not polymorphic. Which overloaded method gets called is determined by it's compile time types. Since the method 'testIt' is taking an argument of type Object, it's going to call the 'doStuff(Object o)' method .

Similar Messages

  • Polymorphism & local interfaces

    Hi,
    for the code snippet below assume that 'c' is a reference to a local interface.
    someMethod(Integer pk) {
    Customer c = custHome.findByPrimaryKey(pk);
    Object o = c;
    otherMethod(o);
    otherMethod(Object o) {
    System.out.println("object");
    otherMethod(Customer c) {
    System.out.println("customer");
    The output from the above is "object" using JBoss 3? So, can anyone answer why the otherMethod(Customer c) method isnt being called?
    thanks,
    Dean

    Overloading IMO is based on method signatures and type of references not the actual object that reference points to.
    Ashwani

  • Abstract Class & Interfaces

    Can anyone please tell me as to why we need both an abstract class & an interface? I was asked in an interview as to why we need 2 separate concepts when we can get the similar functionality of an interface by using an abstract class. I had just sited their differences like:
    1) An abstract class can have both abstract & normal methods & that we can specify different access specifiers for its class members.
    2) ABAP does not support Multiple inheritance but that we could simulate the same using interfaces concept in ABAP.
    But he wasnt satisfied with the answer. I guess he was expecting something from a practical point of view. I did try searching the old threads but there wasnt anything similar to this. Anyone please explain by citing a scenario as to why we would need 2 separate concepts & not just one .
    Thanks in advance

    Hi
    Abstract classes
    Abstract classes are normally used as an incomplete blueprint for concrete (that is, non-abstract) subclasses, for example to define a uniform interface.
    Classes with at least one abstract method are themselves abstract.
    Static methods and constructors cannot be abstract.
    You can specify the class of the instance to be created explicitly: CREATE OBJECT <RefToAbstractClass> TYPE <NonAbstractSubclassName>.
    Abstarct classes themselves can’t be instantiated ( althrough their subclasses can)
    Reference to abstract classes can refer to instance of subclass
    Abstract (instance) methods are difined in the class , but not implemented
    They must be redefined in subclasses
    CLASS LC1 DEFINAITION ABSTARCT
    PUBLIC SECTION
    METHODS ESTIMATE ABSTARCT IMPORTING…
    ENDCLASS.
    <b>Interfaces</b>
    Interfaces only describe the external point of contact of a class (protocols), they do not contain any implementation.
    Interfaces are usually defined by a user. The user describes in the interface which services (technical and semantic) it needs in order to carry out a task.
    The user never actually knows the providers of these services, but communicates with them through the interface.
    In this way the user is protected from actual implementations and can work in the same way with different classes/objects, as long as they provide the services required. This is known as polymorphism with interfaces.

  • Regarding (oops) Interface

    hi,
    could u plz tell me can we create instance for Interface,
    if it is possible how?

    Hi Rajesh,
    This program will show the use of interface reference variable and how it can be used to access the components of an interface in a class(implementing that interface). Use of interface reference variable paves the way for polymorphism via interface.
          INTERFACE lif_employee
    INTERFACE lif_employee.
      METHODS:
        add_employee
           IMPORTING im_no   TYPE i
                      im_name TYPE string
                      im_wage TYPE i.
    ENDINTERFACE.
    Super class LCL_CompanyEmployees
    CLASS lcl_company_employees DEFINITION.
      PUBLIC SECTION.
      INTERFACES lif_employee.
        TYPES:
          BEGIN OF t_employee,
            no  TYPE i,
            name TYPE string,
            wage TYPE i,
         END OF t_employee.
      Declare event. Note that declaration could also be placed in the
      interface
        EVENTS: employee_added_to_list
            EXPORTING value(ex_employee_name) TYPE string.
    CLASS-EVENTS: Events can also be defined as class-events
        METHODS:
          constructor,
          display_employee_list,
          display_no_of_employees,
        Declare event method
          on_employee_added_to_list FOR EVENT
          employee_added_to_list OF lcl_company_employees
             IMPORTING ex_employee_name sender.
      PRIVATE SECTION.
        CLASS-DATA: i_employee_list TYPE TABLE OF t_employee,
                    no_of_employees TYPE i.
    ENDCLASS.
    *-- CLASS LCL_CompanyEmployees IMPLEMENTATION
    CLASS lcl_company_employees IMPLEMENTATION.
      METHOD constructor.
        no_of_employees = no_of_employees + 1.
      ENDMETHOD.
    METHOD add_employee.
        METHOD lif_employee~add_employee.
      Adds a new employee to the list of employees
        DATA: l_employee TYPE t_employee.
        l_employee-no = im_no.
        l_employee-name = im_name.
        l_employee-wage = im_wage.
        APPEND l_employee TO i_employee_list.
      Raise event employee_added_to_list
        RAISE EVENT employee_added_to_list
           EXPORTING ex_employee_name =  l_employee-name.
      ENDMETHOD.
      METHOD display_employee_list.
      Displays all employees and there wage
        DATA: l_employee TYPE t_employee.
        WRITE: / 'List of Employees'.
        LOOP AT i_employee_list INTO l_employee.
          WRITE: / l_employee-no, l_employee-name, l_employee-wage.
        ENDLOOP.
      ENDMETHOD.
      METHOD display_no_of_employees.
      Displays total number of employees
        SKIP 2.
        WRITE: / 'Total number of employees:', no_of_employees.
      ENDMETHOD.
    METHOD on_employee_added_to_list.
      Event method
        WRITE: / 'Employee added to list', ex_employee_name.
      ENDMETHOD.
    ENDCLASS.
    Sub class LCL_BlueCollar_Employee
    CLASS lcl_bluecollar_employee DEFINITION
              INHERITING FROM lcl_company_employees.
      PUBLIC SECTION.
        METHODS:
            constructor
              IMPORTING im_no             TYPE i
                        im_name           TYPE string
                        im_hours          TYPE i
                        im_hourly_payment TYPE i,
            add_employee REDEFINITION.
    lif_employee~add_employee REDEFINITION..
      PRIVATE SECTION.
        DATA:no             TYPE i,
             name           TYPE string,
             hours          TYPE i,
             hourly_payment TYPE i.
    ENDCLASS.
    *---- CLASS LCL_BlueCollar_Employee IMPLEMENTATION
    CLASS lcl_bluecollar_employee IMPLEMENTATION.
      METHOD constructor.
      The superclass constructor method must be called from the subclass
      constructor method
        CALL METHOD super->constructor.
        no = im_no.
        name = im_name.
        hours = im_hours.
        hourly_payment = im_hourly_payment.
      ENDMETHOD.
    METHOD add_employee.
    METHOD lif_employee~add_employee.
      Calculate wage an call the superclass method add_employee to add
      the employee to the employee list
        DATA: l_wage TYPE i.
        l_wage = hours * hourly_payment.
       CALL METHOD super->add_employee
        CALL METHOD super->lif_employee~add_employee
          EXPORTING im_no = no
                    im_name = name
                    im_wage = l_wage.
      ENDMETHOD.
    ENDCLASS.
    Sub class LCL_WhiteCollar_Employee
    CLASS lcl_whitecollar_employee DEFINITION
        INHERITING FROM lcl_company_employees.
      PUBLIC SECTION.
        METHODS:
            constructor
              IMPORTING im_no                 TYPE i
                        im_name               TYPE string
                        im_monthly_salary     TYPE i
                        im_monthly_deductions TYPE i,
            add_employee REDEFINITION.
    lif_employee~add_employee REDEFINITION.
      PRIVATE SECTION.
        DATA:
          no                    TYPE i,
          name                  TYPE string,
          monthly_salary        TYPE i,
          monthly_deductions    TYPE i.
    ENDCLASS.
    *---- CLASS LCL_WhiteCollar_Employee IMPLEMENTATION
    CLASS lcl_whitecollar_employee IMPLEMENTATION.
      METHOD constructor.
      The superclass constructor method must be called from the subclass
      constructor method
        CALL METHOD super->constructor.
        no = im_no.
        name = im_name.
        monthly_salary = im_monthly_salary.
        monthly_deductions = im_monthly_deductions.
      ENDMETHOD.
    METHOD add_employee.
    METHOD lif_employee~add_employee.
      Calculate wage an call the superclass method add_employee to add
      the employee to the employee list
        DATA: l_wage TYPE i.
        l_wage = monthly_salary - monthly_deductions.
       CALL METHOD super->add_employee
          CALL METHOD super->lif_employee~add_employee
          EXPORTING im_no = no
                    im_name = name
                    im_wage = l_wage.
      ENDMETHOD.
    ENDCLASS.
    R E P O R T
    DATA:
    Object references
      o_bluecollar_employee1  TYPE REF TO lcl_bluecollar_employee,
      o_whitecollar_employee1 TYPE REF TO lcl_whitecollar_employee.
    START-OF-SELECTION.
    Create bluecollar employee obeject
      CREATE OBJECT o_bluecollar_employee1
          EXPORTING im_no  = 1
                    im_name  = 'Gylle Karen'
                    im_hours = 38
                    im_hourly_payment = 75.
    Register event for o_bluecollar_employee1
      SET HANDLER o_bluecollar_employee1->on_employee_added_to_list
         FOR o_bluecollar_employee1.
    Add bluecollar employee to employee list
    CALL METHOD o_bluecollar_employee1->add_employee
      CALL METHOD o_bluecollar_employee1->lif_employee~add_employee
          EXPORTING im_no  = 1
                    im_name  = 'Gylle Karen'
                    im_wage = 0.
    Create whitecollar employee obeject
      CREATE OBJECT o_whitecollar_employee1
          EXPORTING im_no  = 2
                    im_name  = 'John Dickens'
                    im_monthly_salary = 10000
                    im_monthly_deductions = 2500.
    Register event for o_whitecollar_employee1
      SET HANDLER o_whitecollar_employee1->on_employee_added_to_list
         FOR o_whitecollar_employee1.
    Add bluecollar employee to employee list
    CALL METHOD o_whitecollar_employee1->add_employee
      CALL METHOD o_whitecollar_employee1->lif_employee~add_employee
          EXPORTING im_no  = 1
                    im_name  = 'John Dickens'
                    im_wage = 0.
    Display employee list and number of employees.
    CALL METHOD o_whitecollar_employee1->display_employee_list.
    CALL METHOD o_whitecollar_employee1->display_no_of_employees.
    Reward Points, if useful.
    Regards,
    Manoj Kumar

  • Can anybody explain me what is interface

    hi gurus
    can anyone explain me what is interface
    tahnk you
    regards
    kals.

    hi
    Interfaces are independent structures that allow you to enhance the class-specific public points of contact by implementing them in classes.
    Interfaces can be defined globally in the R/3 repository or locally in ABAP program
    Can define exactly same components in Interfaces as in Classes
    Unlike classes, Interfaces do not have instances, instead they are implemented by classes
    Implemented using INTERFACES statement in the declaration part of the class
    INTERFACES statement must be included in the PUBLIC SECTION of the class
    Different classes that implement the same interface can all be addressed in the same way.
    Interface references allow users to address different classes in the same manner.
    Interfaces can also be nested.
          Interfaces are the basis for polymorphism in classes, because they allow a single interface method to behave differently in different classes.
    If an interface is implemented in the class, the interface components are added in the public section of the class.
    A component comp of an interface intf, implemented in a class, becomes a fully-fledged member of that class, with the name intf~comp.
    Classes that implement interfaces must implement all of their methods.
         METHOD intf~meth.
         ENDMETHOD.
    Interfaces allow you to use different classes in a uniform way (polymorphism).
    Interface References
    Creating Interface Reference Variables
          DATA obj TYPE REF TO intf.
    Using this reference variable, you can access any of the components defined in the interface
    Nested Interfaces
    Interface can include one or more interfaces as components, which can contain interfaces themselves.
    Compound Interface : It includes other interface as its component.
    Elementary Interface : It does not include any interface as a component.
    All interface components of a compound interface have the same level
    A component interface exists only once even if it is used once more as a component of another component interface.
    Aliases : It can be used to assign alias names to the components of component interfaces, thus making them visible within the interface definition.
                  ALIASES <alias name> FOR intf~comp.
    Where, intf  = interface name and comp = Component name
    Accessing Objects using Interface References
    It is also possible to directly generate an object to which the interface reference
          variable points initially. In this case, the TYPE addition of the statement CREATE OBJECT must be used to specify a class that implements the interface.               CREATE OBJECT iref TYPE class.
    If the interface intf contains an attribute attr and an instance method meth, you can address them as follows:
    Using the class reference variable:
    Accessing an attribute attr: cref->intf~attr
    Calling a method meth: CALL METHOD cref->intf~meth
    Using the interface reference variable:
    Accessing an attribute attr: iref->attr
    Calling a method meth: CALL METHOD iref->meth
    Accessing Static Components of Interfaces
    Use the name of the interface to access constants within an interface. 
    Accessing a constant const: intf=>const.
    To access the other static components of an interface, use an object reference or the class class that is implementing the interface. 
    Accessing a static attribute attr: class=>intf~attr.
    Calling a static method meth: CALL METHOD class=>intf~meth.

  • Diffrence between a Interface and a abstract class?

    Hi OO ABAP Gurus
    Please clear below point to me.
    Diffrence between a Interface and a abstract class?
    Many thanks
    Sandeep Sharma..

    Hi
    Abstract classes
    Abstract classes are normally used as an incomplete blueprint for concrete (that is, non-abstract) subclasses, for example to define a uniform interface.
    Classes with at least one abstract method are themselves abstract.
    Static methods and constructors cannot be abstract.
    You can specify the class of the instance to be created explicitly: CREATE OBJECT <RefToAbstractClass> TYPE <NonAbstractSubclassName>.
    Abstarct classes themselves can’t be instantiated ( althrough their subclasses can)
    Reference to abstract classes can refer to instance of subclass
    Abstract (instance) methods are difined in the class , but not implemented
    They must be redefined in subclasses
    CLASS LC1 DEFINAITION ABSTARCT
    PUBLIC SECTION
    METHODS ESTIMATE ABSTARCT IMPORTING…
    ENDCLASS.
    Interfaces
    Interfaces only describe the external point of contact of a class (protocols), they do not contain any implementation.
    Interfaces are usually defined by a user. The user describes in the interface which services (technical and semantic) it needs in order to carry out a task.
    The user never actually knows the providers of these services, but communicates with them through the interface.
    In this way the user is protected from actual implementations and can work in the same way with different classes/objects, as long as they provide the services required. This is known as polymorphism with interfaces.
    Interfaces features
    INTERFACE I_COUNTER.
    METHODS: SET_COUNTER IMPORTING VALUE(SET_VALUE) TYPE I,           INCREMENT_COUNTER, ENDINTERFACE.
    CLASS C_COUNTER1 DEFINITION.   PUBLIC SECTION.
        INTERFACES I_COUNTER.
      PRIVATE SECTION.
        DATA COUNT TYPE I.
    ENDCLASS.
    CLASS C_COUNTER1 IMPLEMENTATION.
      METHOD I_COUNTER~SET_COUNTER.
        COUNT = SET_VALUE.
      ENDMETHOD.
      METHOD I_COUNTER~INCREMENT_COUNTER.
        ADD 1 TO COUNT.
      ENDMETHOD.
    ENDCLASS.
    Refer
    https://forums.sdn.sap.com/click.jspa?searchID=10535251&messageID=2902116
    Regards
    Kiran

  • Abap Interface program

    Can any one tell me a short description about Abap interface program also the difference between inbound and outbound interfaces ??

    Hi
    Interfaces
    Interfaces only describe the external point of contact of a class (protocols), they do not contain any implementation.
    Interfaces are usually defined by a user. The user describes in the interface which services (technical and semantic) it needs in order to carry out a task.
    The user never actually knows the providers of these services, but communicates with them through the interface.
    In this way the user is protected from actual implementations and can work in the same way with different classes/objects, as long as they provide the services required. This is known as polymorphism with interfaces.
    Interfaces
    In ABAP interfaces are implemented in addition to, and independently of classes. An interface only has a declaration part,
    and do not have visibility sections. Components (Attributes, methods, constants, types) can be defined the same way as in classes.
    · Interfaces are listed in the definition part lof the class, and must always be in the PUBLIC SECTION.
    · Operations defined in the interface atre impemented as methods of the class. All methods of the interface
    must be present in the implementation part of the class.
    · Attributes, events, constants and types defined in the interface are automatically available to the class
    carrying out the implementation.
    · Interface components are addressed in the class by display.

  • In your experience

    I was going to post the link here but then I would be advertising and that is not my idea, so I decided to just post the content of the course.
    In your experience would you say that this is a good course for me to start with:? I do not have any back ground in programming but I am king to learn.
    In total this is a 5 day course based in London.
    Course Content
    Module 1 - Getting Started
    Origins of the language and its key features
    Describing the Java Runtime Environment and the components of the Java 2 Standard Edition (J2SE)
    Comparing local and distributed Java applications and associated security features
    Writing, compiling and running a simple Java application
    Using documentation for the J2SE class libraries
    Module 2 - Object-Oriented Programming
    Defining classes, objects, variables and methods
    Building an object and understanding object references and garbage collection
    Using constructor methods to initialise objects
    Using package and import statements to access the J2SE class libraries
    Applying access modifiers to object members
    Module 3 - Keywords and primitive types
    Recognizing Java Keywords
    Listing the eight primitive types
    Understanding conversion and casting of primitive types
    Recognizing and using Java operators
    Module 4 - Flow Control
    Iteration using for loops, while loops and do-while loops
    Building nested loops, and breaking out of a loop
    Using labels and the continue keyword
    Building alternative execution paths with a switch block
    Module 5 - Arrays
    Declaring, creating and initialising arrays of primitive types
    Building arrays of objects
    Building multi dimensional arrays
    Passing arguments into the main method of a command line application
    Building an application that uses arrays, method calls and iterative loops
    Module 6 - Object-Oriented design
    Describing the three pillars of object-oriented design (Inheritance, Polymorphism and Encapsulation)
    Inheritance and building a derived class
    Understanding a class hierarchy and the methods of the Object class
    Describing polymorphism and building an overriding method
    Enforcing polymorphism with interfaces and abstract classes
    Encapsulation and its advantages in producing maintainable code
    Module 7 - Further Class Features
    Building overloaded methods and constructors
    Declaring and using static variables and methods
    Declaring and using final classes, variables and methods
    Module 8 - Exceptions
    Defining exceptions and building code to handle a runtime exception
    Explaining the Exception class hierarchy and categories of exceptions
    Declaring methods that may throw exceptions
    Using the throw keyword forward an exception
    Building a user-defined Exception class
    Module 9 - Collections
    Categorising collections classes by the interfaces that they implement
    Using Sets, Lists and Maps to store collections of objects at runtime
    Building an iterator to access the objects in a Set
    Adding key - value pairs to a HashMap
    Using object reference casting when assigning references from a collection
    Module 10 - Building a Graphical User Interface (GUI)
    Describing the Swing package and its components
    Building an application window and adding components to the Content Pane
    Explaining layout managers and the rules by which they position components on a window
    Using BorderLayout, FlowLayout, GridLayout and GridBagLayout managers
    Building inner classes to handle events in a GUI , such as a menu selection
    Adding a user interface to the command line application built during previous modules
    Module 11 - Applets
    Comparing GUI applications to applets
    Explaining applet methods that are called by the browser
    Writing HTML code to display an applet within a web page
    Executing a Java 2 applet on any browser by automatically downloading the Java Runtime Environment
    Using the paint method to draw an image on a component
    Module 12 - Threads
    Creating threads to enable concurrent execution of multiple tasks
    Declaring synchronized code to prevent simultaneous access to a method by more than one thread
    Moving threads between states using the wait and notify methods
    Using a shared object to communicate between threads
    Module 13 - I/O Streams
    Interrogating the local file system
    Using Character Streams to read and write to a text file
    Understanding processing streams and linking them to sink streams
    Building byte streams to send and receive binary data
    Using object serialization to give persistence to objects
    Module 14 - Networking
    Distinguishing between Transmission Control Protocol (TCP) and User Datagram Protocol (UDP)
    Translating between character streams and byte streams
    Building a Server application that listens on a specified port
    Building a Client application that establishes a connection with the Server and sends some text
    Following by the second part :
    Course Content
    Module 1 - Java Database Connectivity (JDBC)
    Describing the JDBC architecture
    JDBC driver categories, including the JDBC-ODBC bridge and Type 4 drivers
    Establishing a database connection
    Creating and updating a database table
    Using batch updates and prepared statements
    Querying a database and extracting metadata
    Using record locking and committing or rolling back a transaction
    Handling SQL exceptions and obtaining the SQL state for single and chained exceptions
    Module 2- The Java API for XML Processing (JAXP)
    Explaining XML Document structure, namespaces and Document Type Definitions
    Parsing XML data with the Simple API for XML Parsing (SAX)
    Parsing XML data with the Document Object Model (DOM) and navigating through the DOM
    Writing code to read an XML file into a database table
    Reading a ResultSet from an SQL query into an XML DOM
    Transforming an XML document using an XSL stylesheet
    Module 3- Adding a Swing User Interface to the database application
    Defining Model-View-Controller architecture
    Using UML class diagrams to describe the types of objects in an application and their static relationships
    Building a GUI using ?drag and drop? and understanding the underlying code
    Using a TableModel object to parse and display XML data in a JTable
    Building a client-side Controller object to interact with the database
    Displaying input dialogs and message dialogs
    Module 4- Remote Method Invocation
    Describing the RMI architecture and the alternatives to RMI
    Listing the steps involved in developing applications using RMI
    Defining and implementing a remote interface
    Generating stubs, starting the registry and registering objects
    Looking up a remote object using the RMI protocol
    Dynamically loading and instantiating class files from a web server
    Implementing security with a policy file
    Creating worker threads for time-consuming tasks
    Module 5- Servlets and Web containers
    Explaining the purpose and structure of a Servlet, and deploying a Servlet in a Web Container
    Writing a Servlet that will return XML data from an SQL query sent over HTTP from a Web client.
    Adding code to enable the Servlet to be accessed from the Swing application client built during previous modules
    [ Note that, while Servlets are part of the Java 2 Enterprise Edition, this module may be useful to delegates who intend to deploy Java applications in a Web Container provided by their Internet Service Provider ]
    Many thanks for any comment reagarding my query.
    Kind Regards,

    There's no game development!

  • ABAP certification in SAP TechEd B'lore

    Hello Experts,
    I checked the SAP techEd site but they dont provide sufficient info on ABAP certification .or the syllabus for associate level ABAP certification exap .
    If anyone have detail info then plz reply me

    Hi,
    SAP Consultant Certification Development Consultant SAP NetWeaver -
    <b>ABAP Workbench (2003) Curriculum</b>
    Software components: SAP Web Application Server 6.20
    Certification duration: 3 hours
    Number of certification questions: 80 multiple choice questions
    Required certificates for participation in this certification test: None
    Please note that you are not allowed to use any reference materials during the certification test (no access to online documentation or to any SAP system). The certification test Development Consultant SAP NetWeaver - ABAP Workbench (2003) verifies the knowledge in the area of SAP NetWeaver for the consultant profile ABAP Workbench. This certificate proves that the candidate has a basic understanding within this consultant profile, and can implement this knowledge practically in projects.
    The certification test consists of questions from the areas specified below:
    Topic Areas
    <b>1. SAP Technologies (+)</b>
    SAP Systems
    Navigation (system handling)
    Technical setup of an SAP system
    System-wide concepts
    <b>
    2. ABAP Workbench Basics (++)</b>
    Data types and data objects
    Internal tables
    Data retrieval (authorization check)
    Subroutines
    The ABAP Runtime System
    Function groups and function modules
    Program calls and data transfer
    <b>3. ABAP Objects (++)</b>
    Classes and objects
    Inheritance
    Casting
    Interfaces
    Events
    Global classes and interfaces
    Exception handling
    Dynamic programming
    <b>4. ABAP Dictionary (++)</b>
    Database tables
    Performance for table access
    Consistency through input check (foreigh key dependency)
    Dependency of ABAP Dictionary objects
    Views
    Search help
    <b>5. Techniqes for List Generation (++)</b>
    Data output to lists
    Selection screen
    Logical database
    Program-specific data retrieval
    Data formatting and control level processing
    Storage of lists and background processing
    Interactive lists
    <b>6. Dialog Programming (++)</b>
    Screen (basics)
    User interface (GUI title, GUI status)
    Screen elements for output (text fields, status icons, and group boxes)
    Screen elements for input/output
    Subscreen and tabstrip control
    Table control
    Context menu
    Dialog programming lists
    <b>7. Database Changes (+)</b>
    Database updates with Open SQL
    LUWs and Client/Server Architecture
    SAP locking concept
    Organizing database changes
    Complex LUW processing
    Number assignment
    Change-document creation
    <b>8. Enhancements and Modifications (+)</b>
    Changes in SAP Standards
    Personalization
    Enhancements to Dictionary elements
    Enhancements using customer exits
    Business Transaction Events
    Business Add-Ins
    Modifications
    Weighting Key in the Test:
    + = 1 - 10%
    ++ = 11 - 20%
    +++ = over 20%
    SAP Consultant Certification
    Development Consultant SAP <b>NetWeaver</b> 2004 – Application Development Focus ABAP
    Software components: SAP Web Application Server 6.40
    Certification exam is included in course TAW12 and is also offered separately at many SAP locations.
    Certification ID (Booking code): C_TAW12_04
    Certification duration: 3 hours
    Number of certification questions: 80
    Required certificates for participation in this certification test: None
    Courses for certification preparation: TAW10 (ABAP Workbench Fundamentals); TAW12 (ABAP Workbench Concepts)
    Please note that you are not allowed to use any reference materials during the certification test (no access to online documentation or to any SAP system).
    The certification test Development Consultant SAP NetWeaver 2004– Application Development Focus ABAP verifies the knowledge in the area of the SAP NetWeaver for the consultant profile Application Development Focus ABAP. This certificate proves that the candidate has a basic understanding within this consultant profile, and can implement this knowledge practically in projects.
    The certification test consists of questions from the areas specified below:
    Topic Areas
    1.     SAP Technologies
    SAP systems (mySAP Business Suite and SAP NetWeaver)
    Technical structure of an SAP Web Application Server
    2.     ABAP Workbench Basics (++)
    Data types and data objects (declaration)
    Internal tables
    Data retrieval (authorization check)
    Subroutines
    Function groups and function modules
    Program calls and memory management
    3.     Advanced ABAP (++)
    ABAP runtime
    Data types and data objects (usage)
    Open SQL (high-performance programming)
    Dynamic programming
    4.     ABAP Objects (++)
    Classes and objects
    Inheritance
    Polymorphism (casting)
    Interfaces
    Events
    Global classes and interfaces
    Exception handling
    Shared objects
    5.     ABAP Dictionary (++)
    Database tables
    Performance for table accesses
    Consistency by means of input check (foreign key dependency)
    Dependency for ABAP Dictionary objects
    Views
    Search helps
    6.     List Creation Techniques (++)
    Data output in lists
    Selection screen
    Logical database
    Interactive lists
    List creation with the ALV grid control:
            - Simple lists 
            - Field catalog
            - Layout
            - Event handling
    7.     Dialog Programming (++)
    Screen (basics)
    Program interface (GUI title, GUI status)
    Screen elements for output (text fields, status icons, and group boxes)
    Screen elements for input/output
    Subscreen and tabstrip control
    Table control
    Context menu
    Lists in dialog programming
    8.     Database Changes
    Database updates with open SQL
    LUWs and client/server architecture
    SAP locking concept
    Organize database changes
    Complex LUW processing
    Number assignment
    Change document creation
    9.     Enhancements and Modifications
    Changes to the standard SAP system
    Personalization    
    Enhancements to ABAP Dictionary elements
    Enhancements via customer exits
    Business Transaction Events
    Business Add-Ins
    Modifications
    Amount of questions by topic (as percentage of test):
    +              = 1 - 10%
    ++            = 11 - 20%
    +++          = over 20%
    Reward points if useful
    vinay

  • Diffrence between N85-1 and N85-a

    is there any Hardware/Software Diffrence between N85-1 And N85-a ?

    Hi
    Abstract classes
    Abstract classes are normally used as an incomplete blueprint for concrete (that is, non-abstract) subclasses, for example to define a uniform interface.
    Classes with at least one abstract method are themselves abstract.
    Static methods and constructors cannot be abstract.
    You can specify the class of the instance to be created explicitly: CREATE OBJECT <RefToAbstractClass> TYPE <NonAbstractSubclassName>.
    Abstarct classes themselves can’t be instantiated ( althrough their subclasses can)
    Reference to abstract classes can refer to instance of subclass
    Abstract (instance) methods are difined in the class , but not implemented
    They must be redefined in subclasses
    CLASS LC1 DEFINAITION ABSTARCT
    PUBLIC SECTION
    METHODS ESTIMATE ABSTARCT IMPORTING…
    ENDCLASS.
    Interfaces
    Interfaces only describe the external point of contact of a class (protocols), they do not contain any implementation.
    Interfaces are usually defined by a user. The user describes in the interface which services (technical and semantic) it needs in order to carry out a task.
    The user never actually knows the providers of these services, but communicates with them through the interface.
    In this way the user is protected from actual implementations and can work in the same way with different classes/objects, as long as they provide the services required. This is known as polymorphism with interfaces.
    Interfaces features
    INTERFACE I_COUNTER.
    METHODS: SET_COUNTER IMPORTING VALUE(SET_VALUE) TYPE I,           INCREMENT_COUNTER, ENDINTERFACE.
    CLASS C_COUNTER1 DEFINITION.   PUBLIC SECTION.
        INTERFACES I_COUNTER.
      PRIVATE SECTION.
        DATA COUNT TYPE I.
    ENDCLASS.
    CLASS C_COUNTER1 IMPLEMENTATION.
      METHOD I_COUNTER~SET_COUNTER.
        COUNT = SET_VALUE.
      ENDMETHOD.
      METHOD I_COUNTER~INCREMENT_COUNTER.
        ADD 1 TO COUNT.
      ENDMETHOD.
    ENDCLASS.
    Refer
    https://forums.sdn.sap.com/click.jspa?searchID=10535251&messageID=2902116
    Regards
    Kiran

  • About modularization techniques

    hi,,
       can anybody send me the details about modularization techniques ?
       mainly i want differences between INCLUDES and FUNCTION MODULES.
                                                         MACROS and SUBROUTINES.

    Hi
    Purpose of modularization is: 1) Organizing your ABAP Code 2) Limit maintenance cost by coding every thing only once and making your ABAP code easier to understand.
    Modularization techniques:
    1) Organizing your ABAP code can be done by using INCLUDE reports and local MACRO's (DEFINE statement). Typical examples can be found in Module Pools and Function Groups with TOP-includes and special includes for PBO events, PAI events et cetera. You can discuss if using subroutines, functions or methods is also part of this type of modularization technique. At this moment, most ABAP programmers use subroutines partly as a means to create some sort of main line in their program, thus limiting large chunks of ABAP code. Regarding MACRO's there are some special problems, especially that they don't improve readability of ABAP coding, and you can not debug them.
    2)Here, we are talkin about ABAP PROCEDURES: a) Subroutines, b) Functions and c) Methods
    - 2a) Subroutines: can be used locally and globally (external subroutine calls). Subroutines have a formal interface ( USING, CHANGING, TABLES parameters). The interface parameters can be passed BY VALUE or BY REFERENCE. Data that is defined within a subroutine (FROM ... ENDFORM.) is local: lifetime and visibility is limited to the moment the subroutine is called. External Subroutines are subroutines that are called from another program. Typical example can be found in the way SAPscript and SMARTforms printprograms are called by RSNAST00. External Subroutines can be grouped into Subroutine Pools.
    - 2b) Functions: are part of function groups. They are designed for global use and have a unique name. Function Modules also have a formal interface using IMPORTING, EXPORTING, CHANGING and TABLES parameters. The interface parameters can be passed BY VALUE or BY REFERENCE. Specific EXCEPTIONS can be defined for error handling. A function module can also have local data.
    In theory, a function module can only use data a)from the interface parameters, b) defined locally in the function module and c) defined globally in the function group. However, it is possible to see global data from calling programs using field-symbols.
    Remote Function Modules are function modules that can be called from other SAP or NON-SAP systems. BAPI's are examples of RFC-enabled function modules.
    Function Groups and Function Modules are maintained using transaction SE37 (or SE80).
    - 2c) Methods: are part of CLASSES. Here we are talking about ABAP Objects, supporting inheritance, instantiation, encapsulation, polymorphism, events, Interfaces, visibility sections (PUBLIC, PROTECTED, PRIVATE) and lifetime options STATIC and INSTANCE.
    Classes can be defined locally or globally: a) Local Classes are classes, defined as part of an ABAP program. They can be used only within this program. b) The functionality of Global Classes is identical, but these classes are maintained using the Class Builder (SE24 or SE80).
    The name of a method is not unique; you always need the name of the object to create the unique name. As a result, several classes will have exactly the same method name.
    Methods also have a formal interface using IMPORTING, EXPORTING, CHANGING and RETURNING parameters. The interface parameters can be passed BY VALUE or BY REFERENCE. Specific EXCEPTIONS can be defined for error handling. A method can also have local data.
    In general, using classes is considered a much better alternative to using subroutines and function modules, especially with regards to maintenance costs. Actually, you do not need subroutines anymore. Function Modules are only needed is some cases, for example as RFC's because the classes don't support remote calls.
    One limitation of ABAP Classes is that they do not support dynpro's. This means that you always need a report/module pool/function group if you want to create screens.
    Within methods, several types of obsolete ABAP statements are not allowed like: ON CHANGE OF, TABLES and OCCURS.
    Consider that new tools and options like Web Dynpro, Unit Testing, Shared Objects, Exception Classes can only be understood when having the knowledge of ABAP OO. If you are debugging new SAP transactions, you'll see that they are also programmed using ABAP Objects.
    Processing blocks that are called from ABAP programs:
       1. Subroutines
       2. Function modules
       3. Methods
          Procedures
          Procedures contain a set of statements, and are called from other ABAP programs.
          The processing blocks that you call from ABAP programs are called procedures
          You define procedures in ABAP programs. When the program is generated, they remain as standalone modules. You can call procedures in the program in which they are defined, or from external programs. Procedures have an interface for passing data, and can also contain local data.
          ABAP contains the following kinds of procedures:
    Subroutines
    Subroutines are principally for local modularization, that is, they are generally called from the program in which they are defined. You can use subroutines to write functions that are used repeatedly within a program. You can define subroutines in any ABAP program.
    Function Modules
    Function modules are for global modularization, that is, they are always called from a different program. Function modules contain functions that are used in the same form by many different programs. They are important in the R/3 System for encapsulating processing logic and making it reusable. Function modules must be defined in a function group, and can be called from any program.
    Methods
    Methods describe the functions and behavior of classes and their instances in ABAP Objects. Methods must be defined in classes. When you call them, you must observe certain special rules of object-oriented programming.
    Subroutines
    Subroutines are procedures that you can define in any ABAP program and also call from any program. Subroutines are normally called internally, that is, they contain sections of code or algorithms that are used frequently locally. If you want a function to be reusable throughout the system, use a function module.
    subroutine is a block of code introduced by FORM and concluded by ENDFORM.
    FORM [USING ... [)] ... ] [CHANGING... [)] ... ].
    ENDFORM.
    subroutines cannot be nested. You should therefore place your subroutine definitions at the end of the program
    Calling Subroutines
    PERFORM... .
    Subroutines can call other subroutines (nested calls) and may also call themselves (recursive calls). Once a subroutine has finished running, the calling program carries on processing after the PERFORM statement. You can use the USING and CHANGING additions to supply values to the parameter interface of the subroutine.
    Function Modules
    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.
    Unlike subroutines, you do not define function modules in the source code of your program. Instead, you use the Function Builder. The actual ABAP interface definition remains hidden from the programmer. You can define the input parameters of a function module as optional. You can also assign default values to them. Function modules also support exception handling. This allows you to catch certain errors while the function module is running.
    Function groups are containers for function modules. You cannot execute a function group. When you call an function module, the system loads the whole of its function group into the internal session of the calling program (if it has not already been loaded).
    This is used by the system to create the components of the group (main program and corresponding include programs). When you create a function group or function module in the Function Builder , the main program and include programs are generated automatically.
    The main program SAPL contains nothing but the INCLUDE statements for the following include programs:
    LTOP. This contains the FUNCTION-POOL statement (equivalent for a function group of the REPORT or PROGRAM statement) and global data declarations for the entire function group.
    LUXX. This contains further INCLUDE statements for the include programs
    LU01, LU02, ... These includes contain the actual function modules.
    The include programs LF01, LF02, ... can contain the coding of subroutines that can be called with internal subroutine calls from all function modules of the group.
    All of the function modules in a function group can access the global data of the group. For this reason, you should place all function modules that use the same data in a single function group.
    Function modules can have the following interface parameters:
    Import parameters. These must be supplied with data when you call the function module, unless they are flagged as optional. You cannot change them in the function module.
    Export parameters. These pass data from the function module back to the calling program. Export parameters are always optional. You do not have to receive them in your program.
    Changing parameters. These must be supplied with data when you call the function module, unless they are flagged as optional. They can be changed in the function module. The changed values are then returned to the calling program.
    Tables parameters. You use these to pass internal tables. They are treated like CHANGING parameters. However, you can also pass internal tables with other parameters if you specify the parameter type appropriately.
    You can specify the types of the interface parameters, either by referring to ABAP Dictionary types or elementary ABAP types. When you call a function module, you must ensure that the actual parameter and the interface parameters are compatible.
    Interface parameters are, by default, passed by value. However, they can also be passed by reference. Tables parameters can only be passed by reference. You can assign default values to optional importing and changing parameters. If an optional parameter is not passed in a function module call, it either has an initial value, or is set to the default value.
    Exceptions are used to handle errors that occur in function modules. The calling program checks whether any errors have occurred and then takes action accordingly.
    Calling Function Modules in ABAP
    To call a function module, use the CALL FUNCTION statement:
    CALL FUNCTION [EXCEPTIONS e1 = r 1.... e n = r n ].
    You can specify the name of the function module either as a literal or a variable. Each interface parameter is explicitly assigned to an actual parameter . You can assign a return value to each exception . The assignment always takes the form = . The equals sign is not an assignment operator in this context.
    After EXPORTING, you must supply all non-optional import parameters with values appropriate to their type. You can supply values to optional import parameters if you wish.
    After IMPORTING, you can receive the export parameters from the function module by assigning them to variables of the appropriate type.
    After CHANGING or TABLES, you must supply values to all of the non-optional changing or tables parameters. When the function module has finished running, the changed values are passed back to the actual parameters. You can supply values to optional changing or tables parameters if you wish.
    You can use the EXCEPTIONS option to handle the exceptions of the function module. If an exception is raised while the function module is running, the system terminates the function module and does not pass any values from the function module to the program, except those that were passed by reference. If is specified in the EXCEPTION option, the calling program handles the exception by assigning to SY-SUBRC. must be a numeric literal.
    If you specify of ERROR_MESSAGE in the exception list you can influence the message handling of function modules. Normally, you should only call messages in function modules using the MESSAGE ... RAISING statement. With ERROR_MESSAGE you can force the system to treat messages that are called without the RAISING option in a function module as follows:
    Messages of classes S, I, and W are ignored (but written to the log in a background job).
    Messages of classes E and A stop the function module as if the exception ERROR_MESSAGE had occurred (SY-SUBRC is set to ).
    If you specify OTHERS after EXCEPTIONS, the system assigns a single return code to all other exceptions that you have not specified explicitly in the list.
    You can use the same number for several exceptions.
    You can trigger exceptions in the function module using either the RAISE or the MESSAGE ... RAISING statement. If the calling program handles the exception, both statements return control to the program. The MESSAGE ..... RAISING statement does not display a message in this case. Instead, it sets the following system fields:
       1. Message class ® SY-MSGID
       2. Message type ® SY-MSGTY
       3. Message number ® SY-MSGNO
       4. SY-MSGV1 to SY-MSGV4 (contents of fields to , included in a message).
          You can use the system fields to trigger the message from the calling program.
    Raising Exceptions
    There are two ABAP statements for raising exceptions. They can only be used in function modules:
    RAISE .
    and
    MESSAGE..... RAISING .
    The effect of these statements depends on whether the calling program handles the exception or not. If the name of the exception or OTHERS occurs in the EXCEPTIONS addition of the CALL FUNCTION statement, the exception is handled by the calling program.
    If the calling program does not handle the exception
    The RAISE statement terminates the program and switches to debugging mode.
    The MESSAGE ..... RAISING statement display the specified message. How the processing continues depends on the message type.
    If the calling program handles the exception, both statements return control to the program. No values are transferred. The MESSAGE ..... RAISING statement does not display a message. Instead, it fills the system fields SY-MSGID, SY-MSGTY, SY-MSGNO, and SY-MSGV1 to SY-MSGV4.
    Remote Function Modules
    To implement a remote function module in ABAP, perform the following steps:
    1. Register the module as remotely callable in the RFC server system.
    In the function module Administration screen (transaction code SE37), set the field Can be called via REMOTE CALL. Registering a module as remote causes an RFC stub to be generated for it.
    Asynchronous remote function calls (aRFCs) are similar to transactional RFCs, in that the user does not have to wait for their completion before continuing the calling dialog. There are three characteristics, however, that distinguish asynchronous RFCs from transactional RFCs:
    When the caller starts an asynchronous RFC, the called server must be available to accept the request.
          The parameters of asynchronous RFCs are not logged to the database, but sent directly to the server.
    Asynchronous RFCs allow the user to carry on an interactive dialog with the remote system.
    The calling program can receive results from the asynchronous RFC.
    You can use asynchronous remote function calls whenever you need to establish communication with a remote system, but do not want to wait for the function’s result before continuing processing. Asynchronous RFCs can also be sent to the same system. In this case, the system opens a new session (or window) and allows you to switch back and forth between the calling dialog and the called session.
    To start a remote function call asynchronously, use the following syntax:
    CALL FUNCTION RemoteFunction STARTING NEW TASK taskname
    Destination ...
    EXPORTING...
    TABLES ...
    EXCEPTIONS...
    The following calling parameters are available:
    TABLES
    passes references to internal tables. All table parameters of the function module must contain values.
    EXPORTING
    passes values of fields and field strings from the calling program to the function module. In the function module, the correponding formal parameters are defined as import parameters.
    EXCEPTIONS
    see Using Pre-Defined Exceptions for RFC
    RECEIVE RESULTS FROM FUNCTION func is used within a FORM routine to receive the results of an asynchronous remote function call. The following receiving parameters are available:
       1. IMPORTING
       2. TABLES
       3. EXCEPTIONS
    The addition KEEPING TASK prevents an asynchronous connection from being closed after receiving the results of the processing. The relevant remote context (roll area) is kept for re-use until the caller terminates the connection.
    Call a transaction asynchronally and display it in an amodal window:
    DATA: MSG_TEXT(80) TYPE C. "Message text
    Asynchronous call to transaction SM59 ->
    Create a new session
    CALL FUNCTION ‘ABAP4_CALL_TRANSACTION’ STARTING NEW TASK ‘TEST’
    DESTINATION ‘NONE’
    EXPORTING
    TCODE = ‘SM59’
    EXCEPTIONS
    COMMUNICATION_FAILURE = 1 MESSAGE MSG_TEXT
    SYSTEM_FAILURE = 2 MESSAGE MSG_TEXT
    IF SY-SUBRC NE 0.
    WRITE: MSG_TEXT.
    ELSE.
    WRITE: ‘O.K.’
    ENDIF.
    You must not use IMPORTING when calling aRFCs.
    Transactional Remote Function Calls
        RfcInstallTransactionControlinstalls four functions to control transactional behaviour.
        RFC_ON_CHECK_TIDis called when a local transaction is starting.
        RfcCreateTransID Get a unique transaction-ID for calling an
        ABAP function module using the transactional RFC Interface
        RfcIndirectCall Call an ABAP function module using the
        transactional RFC Interface
        RFC_ON_COMMIT is called when a local transaction ends.
        RFC_ON_CONFIRM_TID is called when a local transaction is
        completed.
        RFC_ON_ROLLBACK is call
    ed when a local transaction ends with
    failure.
    RFC_ONCALL
    INCLUDE AND MACROS:
    When you modularize source code, you place a sequence of ABAP statements in a module. Then, instead of placing all of the statements in your main program, you just call the module.
    Include programs are global R/3 Repository objects. They are solely for modularizing source code, and have no parameter interface.
    They have the following functions:
    Library:Include programs allow you to use the same source code in different programs. For example, this can be useful if you have lengthy data declarations that you want to use in different programs. 
    Order. Include programs allow you to manage complex programs in an orderly way. Function groups and module pools use include programs to store parts of the program that belong together. The ABAP Workbench supports you extensively when you create such complex programs by creating the include programs automatically and by assigning them unique names.
    Creating Your Own Include Programs
    If you create an include program yourself, you must assign it the type I in its program attributes.
    An include program cannot run independently, but must be built into other programs. Include programs can contain other includes.
    The only restrictions for writing the source code of include programs are:
    Include programs cannot call themselves.
    Include programs must contain complete statements.
    The INCLUDE statement has the same effect as copying the source code of the include program into the program. In the syntax check, the contents of the include program are also analyzed. Include programs are not loaded at runtime, but are expanded when the program is generated. Once the program has been generated, the load version contains static versions of all of its includes. If you subsequently change an include program, the programs that use it are automatically regenerated.
    ***INCLUDE STARTTXT.
    WRITE: / 'Program started by', SY-UNAME,/ 'on host', SY-HOST, 'date:', SY-DATUM, 'time:', SY-UZEIT.ULINE.
    We can then include this program in any other ABAP program to display a standard list header.
    PROGRAM SAPMZTST.INCLUDE STARTTXT.
    This could produce the following output:
    Program started by KELLERH
    on host ds0025 date: 03/19/1998 time: 09:00:39
    Macros
    If you want to reuse the same set of statements more than once in a program, you can include them in a macro. For example, this can be useful for long calculations or complex WRITE statements. You can only use a macro within the program in which it is defined, and it can only be called in lines of the program following its definition.
    The following statement block defines a macro :
    DEFINE .
    END-OF-DEFINITION.
    Macros do not belong to the definition part of the program. This means that the DEFINE...END-OF-DEFINITION block is not interpreted before the processing blocks in the program. At the same time, however, macros are not operational statements that are executed within a processing block at runtime. When the program is generated, macro definitions are not taken into account at the point at which they are defined
    A macro definition inserts a form of shortcut at any point in a program and can be used at any subsequent point in the program. As the programmer, you must ensure that the macro definition occurs in the program before the macro itself is used. Particular care is required if you use both macros and include programs, since not all include programs are included in the syntax check (exception: TOP include).
    To use a macro, use the following form:
    When the program is generated, the system replaces by the defined statements and each placeholder &i by the parameter
    . You can use macros within macros. However, a macro cannot call itself.
    DATA: RESULT TYPE I,N1 TYPE I VALUE 5,N2 TYPE I VALUE 6.
    DEFINE OPERATION. RESULT = &1 &2 &3.OUTPUT &1 &2 &3 RESULT.END-OF-DEFINITION.
    DEFINE OUTPUT. WRITE: / 'The result of &1 &2 &3 is', &4.END-OF-DEFINITION.
    OPERATION 4 + 3.OPERATION 2 ** 7.OPERATION N2 - N1.
    The produces the following output:
    The result of 4 + 3 is 7
    The result of 2 ** 7 is 128
    The result of N2 - N1 is 1
    Inserting the macro changes nothing in the generated form of the program.
    Check this link
    http://www.sapbrainsonline.com/FAQs/TECHNICAL/SAP_ABAP_MODULARIZATION_FAQ.html
    http://help.sap.com/saphelp_40b/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_40b/helpdata/en/9f/db970e35c111d1829f0000e829fbfe/content.htm
    Regards
    Pavan
    Message was edited by:
            Pavan praveen
    Message was edited by:
            Pavan praveen

  • Interfaces, Abstract Classes & Polymorphism

    I have a friend taking a Java course as part of a larger degree program, and she's asked for some help with an assignment. The assignment is as follows:
    This assignment is to write a simple encryption/decryption application.  There will be a single application
    that the user can use to encrypt or decrypt a phrase passed in on the command line, with the user deciding
    which encryption/decryption scheme to use.
    The first scheme is to add 1 to each character that is in the phrase, the other is to subtract 1 from each
    character that is in the phrase.
    To encrypt, you must be able to use the follwing syntax:
    java Crypto encrypt Additive "hello"
    Output:
    "hello" encrypts to: "ifmmmp"
    To decrypt:
    java ca.bcit.cst.comp2256.a###### decrypt Additive "ifmmp"
    Output:
    "ifmmp" decrypts to: "hello"
    Use Additive or Subtractive as the arguments to choose which encryption/decryption to
    use. The problem is, I'm not entirely sure how to use abstract classes and interfaces to do what is being asked. I'm pretty sure I could do the whole program in a single for-loop, but apparently her teacher doesn't want people coming up with their own solutions for the problem. I don't need any code for how to do it, per se, I'm just wondering how one would structure a program like that to include interfaces, polymorphism and abstract classes.
    Anyone have any ideas?

    with the user deciding which encryption/decryption scheme to use.This is the key sentence. encryption/decryption can be done using multiple schemes. The contract for any given scheme can be defined using
    public String encrypt(String input);
    public String decrypt(String input);There can be multiple implementations for these methods, one set for each scheme.
    The contract therefore becomes the interface and each implementation is a concrete implementation of this interface.
    The problem doesn't delve deep into the kind of schemes available. If it does and there is a significant overlap between 2 schemes, an abstract class that takes care of the shared logic among 2 schemes comes into picture.
    Hope this helps!

  • Returning a remote interface as a polymorphic form of its superinterface.

    Hi all
    I have a remote interface 'remoteinterface1'
    of a statless session enterprise java bean extending an interface 'BusinessInterface' that has some business methods.
    Can a business method 'getObj()' of the bean return a polymorphic form of the above remote interface as 'BusinessInterface' i.e.
    public BusinessInterface getObj()
    //some conditional check is done here; if true
    return remoteinterface1;
    Does doing as above violate any EJB specifications. If so what could be the alternative.
    Any input at the earliest is highly appreciated.
    Thanks.

    Hello,
    Hi
    Thanks for the quick reply.
    I guess I might be asking the same question but just
    wanted to confirm again by expressing one more doubt:
    If the remote interface is casted to Business
    Interface;
    Later when I check if the business interface is an
    instanceof the remoteinterface, will it be actual
    remote interface i.e. since we are casting to
    business interface(a simple interface and thus not an
    RMI aware object), would the remote interface loose
    any RMI features and thus violate EJB
    specifications.You don't have to worry at all if you access a remote object (in an RMI or EJB context) through a particular interface. You just have to make sure that the interface follows the RMI rules.
    This could be very useful if you want to create a number of different "views" for a remote object.
    Consider for example the following:
    class SomeRemoteObject implements A, B, ... {
       public void doSomething1() throws RemoteException {
       public void doSomething2() throws RemoteException {
    interface A {
       public void doSomething1() throws RemoteException;
    interface B {
       public void doSomething2() throws RemoteException;
    interface RemoteInterfaceOfSomeRemoteObject extends A, B, ... {
    }Interfaces A and B follow the RMI regulations. In this case you could access the remote object through A which disables access to doSomething2() which in turn is only accessible through B. Ofcourse the remote interface should contain the methods that you want to access remote for example by extending A and B.
    public A getAnAObject() {
    A anAObject = getAnAObject();
    anAObject.doSomething1();
    System.out.println(anAObject instanceof RemoteInterfaceOfSomeRemoteObject); // true
    System.out.println(anAObject instanceof B); // true
    System.out.println(anAObject instanceof java.rmi.Remote); // trueThere are indeed subtle differences in setting up the remote system (EJB or plain RMI) but the same principles always apply.
    Hope it helps.
    >
    Thanks in advance.

  • General questions on IDOCs and IDOCs for 2 Accounting Interface BAPIs

    This post involves several questions pertaining to the topic of IDOC creation. I downloaded a couple of PDFs and tried googling for material on that, but things are far from being clear in my mind.
    I tried to put my questions in some order, so we can follow a line of reasoning. Here we go, then:
    I have one code where I there are calls to 2 BAPIs:
    - BAPI_ACC_ACT_POSTINGS_REVERSE and
    - BAPI_ACC_GL_POSTING_REV_POST
    I am supposed to prepare/create an IDOC to perform the activities these BAPIs are responsible for, for the sole purpose of providing us much more details on the activities being executed in the system - this is one of the IDOC's features, if I got it right, its highly detailed logging of everything that is going on behind.
    Now, the 1st question arises:
    From the material I read, I understood that IDOCs are nothing more than data containers, whose sole purpose is to provide a means of communication between two different systems/parties - one of them would usually be SAP. If this is right, than what sort of IDOC would be this one I am supposed to build - if there's not going to be any inter-system communication ? Doesn't it sound strange that pure "data containers" can work as "logging functions" ? Please share some light here.
    The 2nd question - after I understand what an IDOC really is - is
    then connected to the job I have to do. I found 2 IDOCs which I think have the proper/correspondent basic types for the 2 aforementioned BAPIs. They are, respectively:
    - ACC_DOCUMENT_REVERSE01 and
    - ACC_GL_POSTING_REVERSE01
    Getting back to my understanding of IDOCs, I got that every IDOC is generally made of one control record, data record(s), and status record(s). 3rd question: Where do the segments fit in ? Are the segments definitions of the Data Records ? And why is it that some IDOC types have header segments only and others doesn't have one ? (header segments are not the same as control records, right ?)
    Finally, what is the general process flow for creating/preparing an IDOC ? I looked over a couple of forum posts about this but some of them differ one from another in the order of the steps, some don't mention this or that step, so I am still confused.
    4th and last question: what comes first ? The definition of a partner, the bonding of a message type with an IDOC basic type, definitions of the inbound/outbound interfaces ?
    Any help here would be highly appreciated.
    Thanks in advance,
    Avraham

    Hi Jaya,
    Answer 1. Class is a template for creating objects. Object can also be called as instance.
    Interfaces allow you to use different classes in a uniform way (polymorphism).
    Answer 2. Normal abap is a procedural programming where as by using abap objects we can achieve object oriented programing.
    Answer 6. Source code:
    In below code i have created a interface and a class which is implementing the interface. I have declared a reference variable of type interface and created a object. Then i have called a method.
    REPORT  ZABAPOBJECTS_INTERF.
          INTERFACE I1
    INTERFACE I1.
      METHODS METH1.
    ENDINTERFACE.                    "I1
          CLASS C1 DEFINITION
    CLASS C1 DEFINITION.
      PUBLIC SECTION.
        METHODS: METH2.
        INTERFACES: I1.
    ENDCLASS.                    "C1 DEFINITION
          CLASS C1 IMPLEMENTATION
    CLASS C1 IMPLEMENTATION.
      METHOD I1~METH1.
        WRITE: / 'This is a method one'.
      ENDMETHOD.                                                "I1~METH1
      METHOD METH2.
        WRITE: / 'This is a method two'.
      ENDMETHOD.                                                "METH2
    ENDCLASS.                    "C1 IMPLEMENTATION
    START-OF-SELECTION.
      DATA : REF1 TYPE REF TO I1.
      CREATE OBJECT REF1 TYPE C1.
      CALL METHOD REF1->METH1.
    Question 7: Yes we need to create a class but most probably we use the existing classes.
    Regarding BAPi's go through the below links,
    http://www.sapgenie.com/abap/bapi/example.htm
    http://www.sapdevelopment.co.uk/bapirfc/bapirfchome.htm
    Regards,
    Azaz Ali.

  • Concept of Abstraction and Polymorphism

    Hi friends,
    I'm just new to Java.I studied a little bit of C, I'm currently studing VB and Java.
    There are one or two concepts in Java that are very hard to grasp for me.
    The first is abstraction and the second is polymorphism.
    Can anybody outline to me in simple words(use simple example if needed)what those 2 concepts are all about?
    Thanks a lot
    Marco

    In your example, you could make Vehicle an abstract
    class. You can't simply have a vehicle, but you can
    have a car which IS a vehicle. In your abstract class
    Vehicle, you might define an abstract method public
    int getSeats() (you want it to be abstract because it
    changes from one type of vehicle to the next). So the
    class Car extends Vehicle, overrides the method
    getSeats() and returns 5. The class Ute extends
    Vehicle, overrides the method getSeats() and returns 2
    (you might make a SuperCabUte that extends Ute and
    returns 5, or whatever).Radish is right,
    Think of it as modelling of real life. You would generalise the description of your car as a Vehicle (abstraction, which can be implemented as an interface in Java) where in fact you own a car
    Similarly you can have an inteface called RealEstate where in fact you own a TwoStoreyHouse ( a class that implements the RealEstate interface)
    the interface can describe the general 'characterstics' of real estate properties ie land size, council rates etc.
    HTH...hey....

Maybe you are looking for

  • Applications folder missing

    Hello all, Kind of freaking out here...I recently downloaded a trial version of Episode Pro to try out with FCP. I didn't work to my liking. I decided to uninstall it, because there was an uninstall option in the finder window with the trial applicat

  • OIM 11.1.1.3.0 install

    Hello, We installed, not configured 11.1.1.2.0 and patched with 11.1.1.3.0. Now trying to use the config.sh script to configure. We're only installing OID. We're at the part where we need to define a database schema, and we'd like to create a new one

  • How to unload a NIB loaded from IB

    Hi Unfortunately I have to split one of my initial posts and raise this question again since no one replied. I'm loading a NIB via IB in my project (iphone project) which uses a UITabBarController. I need to unload NIBs as the user navigates to a new

  • Calculate no of saturdays in a year

    Hi, I'm using oracle 10.2.0.1.0 Is it possible to get the number of saturdays in a year , with a single sql? Say, i want to find the no of saturdays in 2012, with single sql i have to get as 52. Thanks

  • UK user on BT Hub3-ipad wifi problem-Help!

    Since upgrading to OSX 10.8.1 I am unable to connect my ipad2 to wifi using BTHUB3 (UK user). Have tried all the obvious things but cannot get this to work. I am told this is a glitch on apple software and an upgrade is due Sept 2012. Any ideas? Thx