Interfaces concept ...Urgent?
Hi all,
As we all know multiple inheritance cannot be achieved in ABAP classes, so we need to take INTERFACES approach, I am trying to do from the below mentioned code.
*& INTERFACE Stu_course
INTERFACE stu_course.
DATA : course_id.
METHODS: max_student,
add_student,
drop_student.
ENDINTERFACE.
*& Class cl_course
CLASS cl_course DEFINITION ABSTRACT.
PUBLIC SECTION.
INTERFACES stu_course.
PRIVATE SECTION.
DATA : count TYPE i.
ENDCLASS.
CLASS cl_course IMPLEMENTATION.
METHOD stu_course~add_student.
WRITE: / 'Student added'.
ENDMETHOD.
METHOD stu_course~drop_student.
WRITE: / 'Student Dropped'.
ENDMETHOD.
METHOD stu_course~max_student.
count = count + 1.
IF count GT 10.
write: / 'maximum number of student reached'.
ENDIF.
ENDMETHOD.
ENDCLASS.
*& Class cl_student
CLASS cl_student DEFINITION. "INHERITING FROM cl_university_member.(currently not mentioned)
PUBLIC SECTION.
DATA : student_id type i.
INTERFACES stu_course.
METHODS:register_course
IMPORTING course TYPE REF TO cl_course,
withdraw_course
IMPORTING course TYPE REF TO cl_course.
ENDCLASS.
CLASS cl_student IMPLEMENTATION.
METHOD register_course.
"Here i want to call the definition of method "add_student" of class cl_course without inheritance, so that i can achieve multiple inheritance."
ENDMETHOD.
ENDCLASS.
Class cl_student wants to inherit the definition of methods like add_student,drop_student from class cl_course.Is this posible n how?
Thanks n Regards
Rohit
hi rohit,
see below details regarding Intefaces,
Interface
Simple use of an interface
Theme This program will show simple use of an interface with its own data and methods and how it is implemented in a class. It will also show that there can be methods of same name for an interface and the class implementing the interface.
Program Desc This program contains an interface I1 with attribute : NUM an method : METH1.
This interface is implemented in a class : C1 which also has its own method METH1.
An object OREF is created from class C1 and both the methods METH1 , one for class and another for interface is called using the object.
Dump
report ysubdel .
interface i1.
data : num type i .
methods : meth1.
endinterface.
class c1 definition.
public section.
methods : meth1. class C1s own method
interfaces : i1.
endclass.
class c1 implementation.
method : meth1.
write:/5 'I am meth1 in c1'.
endmethod.
method i1~meth1.
write:/5 'I am meth1 from i1'.
endmethod.
endclass.
start-of-selection.
data : oref type ref to c1.
create object oref.
write:/5 oref->i1~num.
call method oref->meth1.
call method oref->i1~meth1.
Output 0
I am meth1 in c1
I am meth1 from i1
Interfaces can only be implemented in the public section of a class
Theme This program will show you that classes implementing an interface can only contain the features of the interface in its public section.
Program Description In this program, class C1 is trying to accommodate interface I1 in its PRIVATE SECTION.
This creates a compilation error, establishing the theme.
Dump report ysubdel .
interface i1.
methods : meth1.
endinterface.
class c1 definition.
protected section.
interfaces : i1.
endclass.
Output Compilation error with error message :-
INTERFACES may only be implemented in the public section.
A class with an interface should implement all the methods of that interface
Theme This program will show that a class containing an interface should implement all the methods of the interface in its implementation section.
Program Descrip Class C1 implements interface I1, which has got two methods , METH1 and METH2. But, in the IMPLEMENTATION section of class C1, only METH1 is implemented.
This program will create a compilation error, establishing the theme.
Dump
report ysubdel .
interface i1.
methods : meth1 ,
meth2 .
endinterface.
class c1 definition.
public section.
interfaces : i1.
endclass.
class c1 implementation.
method i1~meth1.
write:/5 'I am meth1 from i1'.
endmethod.
endclass.
start-of-selection.
data : oref type ref to c1.
create object oref.
call method oref->i1~meth1.
Output Compilation error with error message :-
Implementation missing for method I1~METH2
if helpful please reward the points,
Aruna
Similar Messages
-
Interfaces concept in web dynpro
Hi all
Can anyone tell me a way of approaching the interfaces concept in web dynpro?
Thanks n regards
chaitanyaHi,
Check this links and work on it.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/28113de9-0601-0010-71a3-c87806865f26?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d#13 [original link is broken]
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/webcontent/uuid/28113de9-0601-0010-71a3-c87806865f26?rid=/library/uuid/49f2ea90-0201-0010-ce8e-de18b94aee2d#12 [original link is broken]
http://help.sap.com/saphelp_nw70/helpdata/en/20/a5f7416e61212be10000000a155106/frameset.htm -
Brief conclusion of Boss class and there interface concept or basic programming architecture ?
I am new in this indesign development so i am studying the documentation provide by sdk till date i think lots of concept are clear to me but still while doing practicle implementation many concept intermixed in my mind .one of them is "command" .so please tell me in brief about it with practical example of creating new document having text frame in indesigen using it .also there are lots of question in my mind regarding interface and boss class anyone please share there knowledge regarding them in brief
Due to a copy/paste glitch, some necessary spaces have inadvertently been removed. If I could fix this, I would.
-
Attachment support thru Payables Open Interface(POI)-urgent pls..
All,
Version: 11.5.10.2
We have a requirement that we need to integrate a 3rd party application to push invoices to Oracle payables thru POI. From 3rd party appln there are chances that it may send a attachment (ex: supplier catalogue in pdf/file format along with invoice). When I gone thru the POI interface tables, I couldn't see any relavant attributes field to push an attachment. May I know if anyone come across this, if so kindly share your views/suggestion on this.
thanks
senAll,
I tested the attachment using the fnd_webattch.add_attachment API. I can successfully loaded the attachment to AP Payables using the invoice id as primary key. But when I try to open the attachment from UI, it opens a blank page!!
What i did was i kept a file in one of the location of my oracle apps server, then i gave the file location in the API as /home2/system1/orafin11i_H.txt. .
my api is like this
fnd_webattch.add_attachment(seq_num => v_seq_num,
category_id => v_category_id,
document_description => p_document_desc,
datatype_id => v_datatype_id,
text => NULL,
file_name =>'/home2/system1/orafin11i_H.txt',
url => NULL,
function_name => 'APXINWKB',
entity_name => v_entity_name,
pk1_value => to_char(p_entity_id),
pk2_value => NULL,
pk3_value => NULL,
pk4_value => NULL,
pk5_value => NULL,
media_id => v_media_id,
user_id => fnd_global.user_id);
anything i did wrong? pls let me know
thanks
sen
Edited by: Sen2008 on Feb 29, 2012 11:11 PM -
Class A{}
Interface I{}
public Class B
Public static void main ( String[] xx)
A a = new A();
I ii = a; // it doesn?t ..
I i = (I) a ; // it works WHY?
// why this code compiles ?newbie_007 wrote:
Class A{}
Interface I{}
public Class B
Public static void main ( String[] xx)
A a = new A();
I ii = a; // it doesn?t ..
I i = (I) a ; // it works WHY?
// why this code compiles ?public class B
public static void main ( String[] xx)
A a = new A();
A ii = a; // it doesn?t ..
I i = (I) a ; // it works WHY?
class A{}
interface I{}
but this compiles and I wonder too. But when I run it, it throus
Exception in thread "main" java.lang.ClassCastException: A cannot be cast to I
at B.main(B.java:15)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
interesting.
Edited by: Tiko_dev on Apr 30, 2009 7:11 AM -
Hi everyone !!!
Can anyone explain me what are the uses to the interface and why do we need to use interface.
I know one advantage is java doesn't support multiple inheritance so we need to use interface.
By using interface what can we do ? But i dont find advantages in that
can you explain me pls ....One of the most popular uses of interfaces comes out of the Collections frame works.
For example, java.util.List, java.util.Map, and java.util.Set.
ArrayList is an implementation of the the interface List. By abstracting ArrayList into the interface, I can now change what type of List I am working with, and my code doesn't care....
For example, I have a method that creates an ArrayList that contains all the users on the server at a particular time. As the coder, I know the method is going to create an ArrayList. Now I have a choice, I can make the method's return type an ArrayList, or I can use the interface name and return a List:
public ArrayList getCurrentUsers() {
ArrayList theList = new ArrayList();
return theList;
-or-
public List getCurrentUsers() {
List theList = new ArrayList();
return theList;
} Both codes would be functionally equivalent. Any code that calls the first method may (but does not need to) do this:
ArrayList currentUsers = getCurrentUsers();Whereas any code that runs the second method would need to do this:
List currentUsers = getCurrentUsers();What's the difference? Well, let's say you decide to change your method to use a LinkedList instead of an ArrayList. If you employed method 1, you now have to make sure you change all the code that accessed the method is changed as well. But, since LinkedList is another implementation of List, if you employ method 2, you can be sure that none of the code that uses your method will break, because they only work through an interface wich both ArrayList and LinkedList share in comon.
So Interfaces are great for defining how a class or object looks, but not necessarily how it works. If you use the List interface to look at ArrayList or LinkedList then both of these classes will look the same, they are both sure to have the same methods defined in the List interface. However, they both will act differently, based on the underlying implementation.
In general terms, it is a level of abstraction that allows the implementer be more flexible with what he is working on, by ensuring a common means of accessing the object, or a set of rules that users must use when accessing the object. In the mean time, the coder is free to make changes, switch implementations, without affecting others. -
Conditions during interface determination (urgent)
Hi all,
well i am using <b>conditions</b> during <b>Interface Determination</b> and according to the result of the condition a mapping program is triggered.
Now i am using <b>XPath.</b>
In my file i have a field called amount. The total of the amount field is stored in the trailer in a field called total.
Is there anyway that using XPath i can check if the sum of the amount field that r in the file is equal to the value in the total field?
a sample file would be as shown below ...
01xxxxxxxxxxxxxxxxxx -
header
02xxxxxxx10000xxxxxx ---
02xxxxxxx20000xxxxxx | body
02xxxxxxx10000xxxxxx ---
03xxx40000xxxxxxxxxx -
trailer
eg.
the sum of the amount field in the body (100002000010000) should be compared to that
in the trailer (40000) [the values in the amount field
will vary so does the total accordingly ]
can anybody suggect a solution ??
Regards,
ShabZHi Frank,
Would xpath functions work, eg. compare , sum etc ?
the twist in the scenario is that if the validations fail then a output say A has to be generated and if its a success a different one say B has to be generated. And accordingly are to be sent to two different folders (2 diff. Comm. Channels).
Thanks,
ShabZ -
Tree interface concept for hierarchical data creation/modification
I am designing an interface for hierarchical data creation and maintenance. The interface will have to provide all basic data modifications options:
edit an existing node, add new child/parent/sibling, as well as removing, sorting, dragging and dropping nodes around. Flex tree control is fully capable of all these functions while coding is not going to be a simple task. Has anyone worked on something like this? Any conceptual ideas?
ThanksWOW Odie! You're awesome !! It worked like a charm, I created a view as you suggested:
CREATE OR REPLACE FORCE VIEW "VIEW_TASKS_PROJECTS_TREE" ("ID", "PARENT_ID", "NODE_NAME") AS
SELECT to_char(id) as id
, null as parent_id
, project_name as node_name
FROM eba_task_projects
UNION ALL
SELECT to_char(id)
, to_char(project_id)
, task_name
FROM eba_task_tasks;
And then I created a new tree with the defaults and customized the Tree query a bit (just added the links really):
select case when connect_by_isleaf = 1 then 0
when level = 1 then 1
else -1
end as status,
level,
"NODE_NAME" as title,
null as icon,
"ID" as value,
null as tooltip,
'f?p=&APP_ID.:22:&SESSION.::NO::P22_ID,P22_PREV_PAGE:' || "ID" || ',3' as link
from "#OWNER#"."VIEW_TASKS_PROJECTS_TREE"
start with "PARENT_ID" is null
connect by prior "ID" = "PARENT_ID"
order siblings by "NODE_NAME"
Thanks man, you saved me a lot of time and headaches :) -
WIP Interface errors - Urgent help needed
I am using the WIP Mass load program to create DJs. The program completed successfully but for some order lines the DJs were not created. I receive the following error messages,
ORDER_NUMBER LINE NO. ERROR_MESSAGE
=========================================================================================================================
2005379022 4 Value for column ORGANIZATION_CODE is being ignored.
2005379022 4 Value for column WIP_ENTITY_ID is being ignored.
2005379022 4 Value for column DAILY_PRODUCTION_RATE is being ignored.
2005379022 4 Value for column LAST_UNIT_START_DATE is being ignored.
2005379022 4 Value for column FIRST_UNIT_COMPLETION_DATE is being ignored.
2005379022 5 Value for column ORGANIZATION_CODE is being ignored.
2005379022 5 Value for column WIP_ENTITY_ID is being ignored.
2005379022 5 Value for column DAILY_PRODUCTION_RATE is being ignored.
2005379022 5 Value for column LAST_UNIT_START_DATE is being ignored.
I went through the WIP API but still couldnt find the root cause of the messages. Records with similar values in the WIP Interface tables have completed successfully.
Appreciate if you can throw some light on this.All these errors are from WIP_JSI_VALIDATOR and WIP_JSI_DEFAULTER. You can search the package using these column and you can find the issue.
Thanks
Nagamohan -
Hi,
I saw this from a book but dont understand what it means:
public interface RemoteStudent extends Remote {
public abstract int getStudentID() throws remoteException;
What is the meaning of "abstract" word doing here ? Thanks.
KenHi,
Thanks for the explanation. This is the reason I come to New to java forums. The thing puzzles me is that an abstract class may has an abstract method. But, in this case, an abstract keyword is putting inside an interface.
1) So, my question is, in this case, I have no abstract class. I only see this interface with abstract keyword in it. So, if a class implements this interface, does this class needs to provide an implementation for this abstract method or not ?
2) What if, there are many abstracts methods in this interface, and there are bunch of classes implementing this interface. Does each class needs to give implementation of each abstract method ?
Thanks.
Lazy Ass Ken -
Hi all,
I have a doubt about the programming in webdynpro java interfaces . what is the main concept underlying in context of a particular view, why to use the follwing code for referring to context attribute
IPrivate<viewname>.I<NodeName> node = wdContext.node<NodeName>();
IPrivate<viewname>.I<NodeName>Element ele = node.create<NodeName>Element();
ele.set<Nodeattribute>("xxxxx");
node.addElement(ele);
Is the context is a Interface ?
please explain me the above code or any relavant documents for Interfaces implementation in webdynpro java
Total no of interfaces in webdynpro java list.
Thanks
prasadHi Prasad,
Web Dynpro controller has a data storage area known as the context. This is a hierarchical repository within which all runtime data used by the controller is stored..Context is not an interface in the code you are trying to set some value to the context attribute by getting that particulat context node reference.
Find the below links which explains you clearly about webdynpros and interface concept
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0ba2c45-0518-2a10-73be-9b785e10aef1?QuickLink=index&overridelayout=true
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a048387a-0901-0010-13ac-87f9eb649381?QuickLink=index&overridelayout=true
Hope it helps.....
Thanks,
Rahul.
Edited by: rahul.girmaji on Dec 12, 2011 6:45 PM -
Need case studies and sample code for all concept of ABAP
Hello,
Can anybody provide me the case studies and sample code for learning different concepts in ABAP programming like: module pool, ALV, interactive reports, BDC, Smart Form etc.? As I want to do some practical application by which i can learn more.
Thanks & Regards,
Vikram RawalIn this link You can find Step by Step Scren Shot document :
http://www.201interviewquestions.com/docs/User%20exits.ppt
http://erpgenie.com/abaptips/component/option,com_docman/task,doc_details/gid,27/
<b>
Reprots</b>
http://www.sapgenie.com/abap/reports.htm
http://www.allsaplinks.com/material.html
http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
<b>Dictionary</b>
http://sapabap.iespana.es/sapabap/manuales/learnabap/
http://help.sap.com/saphelp_nw2004s/helpdata/en/43/41341147041806e10000000a1553f6/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21eb6e446011d189700000e8322d00/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ea31446011d189700000e8322d00/frameset.htm
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCDWBDIC/BCDWBDIC.pdf
<b>ABAP objects</b>
Please check this online document (starting page 1291).
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf
Also check this links as well.
http://help.sap.com/saphelp_nw2004s/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
http://www.sapgenie.com/abap/OO/
http://www.futureobjects.de/content/intro_oo_e.html
http://www.sap-img.com/abap/business-add-in-you-need-to-understand-abap-oo-interface-concept.htm
/people/ravikumar.allampallam/blog/2005/02/11/abap-oo-in-action
<b>
SAPScripts</b>
http://esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf
http://esnips.com/doc/1e487f0c-8009-4ae1-9f9c-c07bd953dbfa/script-command.pdf
http://esnips.com/doc/64d4eccb-e09b-48e1-9be9-e2818d73f074/faqss.pdf
http://esnips.com/doc/cb7e39b4-3161-437f-bfc6-21e6a50e1b39/sscript.pdf
http://esnips.com/doc/fced4d36-ba52-4df9-ab35-b3d194830bbf/symbols-in-scripts.pdf
http://esnips.com/doc/b57e8989-ccf0-40d0-8992-8183be831030/sapscript-how-to-calculate-totals-and-subtotals.htm
SAP SCRIPT FIELDS
http://help.sap.com/saphelp_erp2005vp/helpdata/en/d1/8033ea454211d189710000e8322d00/content.htm
scripts easy material
http://www.allsaplinks.com/sap_script_made_easy.html
Check these step-by-step links
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/ccab6730-0501-0010-ee84-de050a6cc287
https://sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/8fd773b3-0301-0010-eabe-82149bcc292e
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/3c5d9ae3-0501-0010-0090-bdfb2d458985
<b>Smartforms material</b>
http://www.sap-basis-abap.com/sapsf001.htm
http://www.sap-press.com/downloads/h955_preview.pdf
http://www.ossincorp.com/Black_Box/Black_Box_2.htm
http://www.sap-img.com/smartforms/sap-smart-forms.htm
http://www.sap-img.com/smartforms/smartform-tutorial.htm
http://www.sapgenie.com/abap/smartforms.htm
How to trace smartform
http://help.sap.com/saphelp_47x200/helpdata/en/49/c3d8a4a05b11d5b6ef006094192fe3/frameset.htm
http://www.help.sap.com/bp_presmartformsv1500/DOCU/OVIEW_EN.PDF
http://www.sap-img.com/smartforms/smart-006.htm
http://www.sap-img.com/smartforms/smartforms-faq-part-two.htm
Re: Need FAQ's
check most imp link
http://www.sapbrain.com/ARTICLES/TECHNICAL/SMARTFORMS/smartforms.html
step by step good ex link is....
http://smoschid.tripod.com/How_to_do_things_in_SAP/How_To_Build_SMARTFORMS/How_To_Build_SMARTFORMS.html
<b>
BAPI</b>
http://help.sap.com/saphelp_46c/helpdata/en/9b/417f07ee2211d1ad14080009b0fb56/frameset.htm
http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
Checkout !!
http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
http://techrepublic.com.com/5100-6329-1051160.html#
http://www.sap-img.com/bapi.htm
http://www.sap-img.com/abap/bapi-conventions.htm
http://www.sappoint.com/abap/bapiintro.pdf
http://www.sapgenie.com/abap/bapi/example.htm
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE8/BCFESDE8.pdf
<b>List of all BAPIs</b>
http://www.planetsap.com/LIST_ALL_BAPIs.htm
http://www.sappoint.com/abap/bapiintro.pdf
http://www.sappoint.com/abap/bapiprg.pdf
http://www.sappoint.com/abap/bapiactx.pdf
http://www.sappoint.com/abap/bapilst.pdf
http://www.sappoint.com/abap/bapiexer.pdf
http://service.sap.com/ale
http://service.sap.com/bapi
http://www.planetsap.com/Bapi_main_page.htm
http://www.topxml.com/sap/sap_idoc_xml.asp
http://www.sapdevelopment.co.uk/
http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf
<b>ALV programs.</b>
http://www.geocities.com/mpioud/Abap_programs.html
. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
<b>ALV</b>
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - http://www.sapgenie.com/abap/reports.htm
http://www.allsaplinks.com/material.html
http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
<b>Top-of-page in ALV</b>
selection-screen and top-of-page in ALV
<b>ALV Group Heading</b>
http://www.sap-img.com/fu037.htm
<b>ALV</b>
http://www.geocities.com/mpioud/Abap_programs.html
<b>
RFC Destination</b>
Re: SM59
<b>
ALE/ IDOC</b>http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm
http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc
http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
http://www.sapgenie.com/sapedi/index.htm
http://www.sappoint.com/abap/ale.pdf
http://www.sappoint.com/abap/ale2.pdf
http://www.sapgenie.com/sapedi/idoc_abap.htm
http://www.allsaplinks.com/idoc_sample.html
http://www.sappoint.com/abap.html
http://www.netweaverguru.com/EDI/HTML/IDocBook.htm
http://www.sapgenie.com/sapedi/index.htm
http://www.allsaplinks.com/idoc_sample.html
<b>Table Control</b>
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/table%20control%20in%20abap.pdf
<b>
ABAP transactions</b>
http://www.easymarketplace.de/transactions-a-e.php?Area=4soi&name=volker&pw=vg&
Regards,
Priyanka. -
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 advanceHi
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 cant 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. -
I have difficulties in understanding why would I use an interface if I wanted to communicate between two (or more) classes.
Because the interface is by definition abstract, every class implementing the interface has to accept all of its methods (if not declaring itself abstract as well). I only mention this because I understand it, to get to what I don't:
Why would I want to communicate between classes with an interface, if I can do it without? Each class only shares the name of a method in an interface, nothing more. (Is this so?)
If I wanted to execute a series of commands (a method) from another class by calling a method implemented from an interface, how could I do this through an interface? It seems I cannot, while I thought this was the reason to implement interfaces in the first place.
Please clear my scrambled thoughts.Hi bec!
I have exactly the same problem understanding the
interface concept. I still don't get it from
DanPerkins' code example; if you remove the interface
definition, and the implements bit out of each of the
classes, the code still works. So what's the added
value of the interface. Also, code to turn the tv on
is not the same as to turn on the stereo, so there
isn't any code reuse either. Confused.You use interfaces to keep your classes from having intimate knowledge of each other. Say you're writing code to operate a register/scanner at a grocery store. Everytime your store gets a new kind of item in inventory, you don't want to have to update your class to handle the new item.
class Register {
double scan( Banana b ) {
return b.getPrice();
double scan( Rice r ) {
return r.getPrice();
// etc., etc.
}This approach means that Register is tied at the hip to every food item class in the store. Isn't it much nicer to write Register this way:
interface BuyableItem {
double getPrice();
class Banana implements BuyableItem {
double getPrice() {
return this.getWeight() * this.getUnitPrice();
class Rice implements BuyableItem {
double getPrice() {
return this.getCost();
class Register {
// Handle the item generically.
// This way if there's special logic to finding
// the price, like it's on special this week, or
// it's an item that gets priced by the pound,
// the Register class doesn't care. That implementation
// is left to the BuyableItem.
double scan( BuyableItem item ) {
return item.getPrice();
public static void main( String[] args ) {
// Refer to each food by interface
BuyableItem banana = new Banana();
BuyableItem rice = new Rice();
Register reg = new Register();
double totalCost = 0;
totalCost += reg.scan( banana );
totalCost += reg.scan( rice );
System.out.println( "Total cost is: " + totalCost );
}Interfaces become important when you maintain your code for a while and suddenly discover that you have to add support for a new object. -
Dear Experts.
I am new with WD ABAP. In this moment I am reading the documentation "NET310 ABAP Web Dynpro".
I never have understand the concept of Interface in Object-Oriented Programming (OOP).
Please anyone can help me to understandad this concept?
RegardsHi Carmen,
it is a huge subject itself to explain and i am afraid that it is not a right forum to discus.
To understand interface, you need to understand what is Polymorphism.
Polymorphism in a nutshell is that the objects receives same message definition but behaves in a different manner.
example calculate_fuel method in different classes has the same importing parameter and returning parameters but the calculations could be implemented differently in different classes.
Interface has only definitions, you need to implement them. in this way interface concept enables to achieve Polymorphism.
ABAP Objects does not support multiple inheritance. Therefore you can only have a single super-class. However a class can implement multiple interfaces to have kind of multiple inheritance.
Maybe you are looking for
-
Aperture 3.0.2 crashes at startup on Mac Book Pro with 10.6.3
Good mornig, Today I tried to start aperture since a long time because I could not use it for job because you could not trust it. Now is does not start anyway The Libary will not be loaded. I tried to change the modus to 32 Bit. Hold shift key, doubl
-
I'm trying to set up a leopard home server and have rebuilt it several times now trying toiget the mail service to work correctly. I will no doubt omit lots of necessary information but please bear with me I have a registered domain and a static ip.
-
http://www.oracle.com/technology/tech/php/htdocs/inst_php_apache_windows.html I have followed all these instructions, installed what was specified (including all versions needed). First problem I encountered was there were no oci8 title in phpinfo.ph
-
Weblogic managed servers connecting to the servers in different cluster
Hi All, We have a weired problem going on for a while. We have a cluster configuration with an admin server and two managed servers. We have the similar configuration in DEV, TEST and PROD. The problem is that
-
How to join each row with other in the same table without repeating, please help
Hi, I have a table say Adjustment having following data Emp_Id Adjustment_id Date 1000101 1000300 2014-02-12 00:00:00.000 1000101 1000301