Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

List of Questions on BAPI and OOPs

Former Member
0 Kudos
791

Hi All,

I am new to the OOPs and BAPI's.can any one gives me complete idea on below questions by providing good examples.

1) Importance of the class, Interface type, Object and Instance ?

2) Why we need oops concepts since we are using normal process successfully, i mean with out oops also ?

3) functionality of BAPI ?

4) Difference between COMMIT WORK and BAPI_TRANSACTION_COMMIT ?

5) Why COMMIT WORK wont useful for BAPI's ?

6) If you give me good source code to understand the concepts of class, Interface type, Object and Instance?

7) In real time situations, do we need to create classes or in SAP we will use only existed bapis?

😎 The process of creating customized BAPI's [entire scenario]

Since i asked lot of questions in one thread, i decided to give rewards even if you provide me solution for any of the above.

Thanks

Jaya

1 ACCEPTED SOLUTION

Former Member
0 Kudos
418

Hello Jaya,

since you are wondering in 2) whether you need object orientation at all if your system is working fine, then maybe you should stick with the saying "never change a running system". However, if you plan to develop new code then you could start off with OO. Check out the wikipedia entry at http://en.wikipedia.org/wiki/Object_orientation on that and I also recommend to read the book "ABAP Objects. ABAP-Programming in SAP NetWeaver". This may give you information regarding your questions 1) and 6).

To 7) Be aware that BAPIs and ABAP objects are different things. BAPIs are just standardized RFC function modules while ABAP Objects is a different kind of programming.

Best regards,

Björn

3 REPLIES 3

Former Member
0 Kudos
419

Hello Jaya,

since you are wondering in 2) whether you need object orientation at all if your system is working fine, then maybe you should stick with the saying "never change a running system". However, if you plan to develop new code then you could start off with OO. Check out the wikipedia entry at http://en.wikipedia.org/wiki/Object_orientation on that and I also recommend to read the book "ABAP Objects. ABAP-Programming in SAP NetWeaver". This may give you information regarding your questions 1) and 6).

To 7) Be aware that BAPIs and ABAP objects are different things. BAPIs are just standardized RFC function modules while ABAP Objects is a different kind of programming.

Best regards,

Björn

Former Member
0 Kudos
418

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.