Skip to Content
author's profile photo Former Member
Former Member

Class implementation for interface

Hello,

I am a beginner in ABAP Objects.

In the coding of method if_swf_ifs_workitem_exit~event_raised of class CL_SWF_UTL_EXIT_NEW

There is the instruction follow :

*Get the workflow container

irh_container ?= im_workitem_context-> get_wf_container()

Im_workitem_context is interface type "IF_WAPI_WORKITEM_CONTEXT"

If I execute in debug mode I see the implemtation class of this interface (im_workitem_context) is "CL_SWF_RUN_WORKITEM_CONTEXT"

But where this information of implementation is defined ? (I saw nothing)

Regards

Christine

Edited by: chris_75 on Sep 7, 2010 4:22 PM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 07, 2010 at 02:24 PM

    This message was moderated.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 08, 2010 at 04:16 AM

    Hello Christine

    The first response to you thread is just nonsense or the replier neither read nor understood your question.

    For me Interface programming represents the highest degree of object-oriented programming (of which I am still far away from).

    In order to understand interface and how they are used you need to study the basics of OO-programming.

    I try to give you a simple example based on the BAdI technology within SAP.

    BAdIs are the most modern version of User-Exits and are usually represented by an interface which has to be implemented.

    Implementing simply means you create one (or more) classes which include this interface.

    Let's have a look at filter-dependent BAdIs. For each filter value (e.g. countries, DE, EN, US, etc.) you create a separate BAdI implementing class.

    During runtime the system determines based on the filter value which of the classes has to be instantiated.

    The fact that the calling program object determines at runtime which interface implementing class will be instantiated and, therefore, its specific coding being executed makes the programming highly flexible and extremly powerful.

    The same principle is used in case of your workflow related classes.

    Regards

    Uwe

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 13, 2010 at 12:09 PM

    Interfaces allow to implement highly scalable object oriented applications.

    Interface is a kind of a template for a real class which forces this class to implement methods defined in an interface.

    The main characteristics of an interfaces are:

    - they DO NOT contain any implementations (so there is nothing like INTERFACE ... IMPLEMENTATION - they have only DEFINITIONS - implementations are within classes)

    - they have only PUBLIC sections.

    Why we need an interface. The answer is simple:

    We want to handle some objects uniformly from one application compotent, whereas these objects may behave differently inside.

    Example:

    Let's say we need to build a sorting program for numbers.

    The program would have an interface variable L_RIF_SORTER of an interface LIF_SORTER. LIF_SORTER has a method definition SORT with an C_TAB changing parameter.

    Sorting application would call the sorting algorithm as follows:

    L_RIF_SORTER->SORT( CHANGING c_tab = l_tab ).

    Now is the main point:

    We want to have 2 kinds of sorting algorithms implemented, let's say BUBBLE SORT and QUICK SORT.

    To do so, we implement 2 classes: LCL_BUBBLE_SORT and LCL_QUICK_SORT.

    Both classes implement interface using the statment INTERFACES in a public section.

    The user would have to choose the algorithm from an input field. Depending on the content of this field the sorting application would instantiate one class or the other using the statement:

    CREATE OBJECT l_rif_sorter TYPE (variable_with_class_name).

    THis is the point where ABAP gets to know the real object and its type behind the interface.

    This approach is generally called the STRATEGY PATTERN. See Wikipedia for this.

    I hope I answered your question.

    Regards,

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.