Application Development and Automation 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: 
Read only

simple badi application program problem pls solve

Former Member
0 Likes
695

i am new to badi, so gurus please help me in this regard.

in a badi application program

eg: i am giving some lines of the application codewhich i find difficult to understand.

-


class cl_exithandler definition load.

data: exit type ref to zif_ex_badi_07. "zif_ex_badi_07 is the interface created during badi definition

start-of-selection.

call method cl_exithandler => get_instance

changing

instance = exit.

call method exit -> summation " summation is the method name in the badi interface.

exporting

- - - - - - - -


-


questions

1) why are we using the class cl_exithandler here?does it store all the badi so it is used ?

what is the exact use of interface here.?

2) why do we need to create interface reference variables?

2)why are we using cl_exithandler => get_instance and passing the interface reference variable in changing parameter?

while badi creation (se18) and implementation we get an adapter class (system generated) and also an interface name. then we specify the method parameters and the code. upto this it is clear. but please solve my questions regarding the application program.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
671

Hi,

What are you writting you Application program for, is it to find the BADI for the Transactions?

Here are my answers:

1) why are we using the class cl_exithandler here?does it store all the badi so it is used ?
what is the exact use of interface here.?

First thing this is all OO Programming. cl_exithandler Interface does not store any BADIs in it,

In fact as per OO defination class is just a structure and can not store anything.

Method get_instance gets called whenever we perform any transaction to find and trigger the BADI.

so you can say that this method has a code which finds BADI.

2) why do we need to create *interface reference variables*?

To use the interface methods and variables.

3)why are we using cl_exithandler => get_instance and passing 
the interface reference variable in changing parameter?

To get the BADi Name and call BADI.

I think you will have more questions, but try understand it conceptually before writting

it any application program/s.

Hope this helps!

Regards

Shital

4 REPLIES 4
Read only

Former Member
0 Likes
671

In order to use the active badi implemetation in you application program you have to create the reference variable and pass it to cl_exithandler => get_instance. This will check that whether an active implemetation is present or not. If it is present then you will call the method summation.

Read only

Former Member
0 Likes
672

Hi,

What are you writting you Application program for, is it to find the BADI for the Transactions?

Here are my answers:

1) why are we using the class cl_exithandler here?does it store all the badi so it is used ?
what is the exact use of interface here.?

First thing this is all OO Programming. cl_exithandler Interface does not store any BADIs in it,

In fact as per OO defination class is just a structure and can not store anything.

Method get_instance gets called whenever we perform any transaction to find and trigger the BADI.

so you can say that this method has a code which finds BADI.

2) why do we need to create *interface reference variables*?

To use the interface methods and variables.

3)why are we using cl_exithandler => get_instance and passing 
the interface reference variable in changing parameter?

To get the BADi Name and call BADI.

I think you will have more questions, but try understand it conceptually before writting

it any application program/s.

Hope this helps!

Regards

Shital

Read only

Former Member
0 Likes
671

thanx buddy for ur timely response, but i still have some doubts. plz help.

in the sap definition its given that

" by INSTANTIATING the adapter class in the application program, the corresponding methods can be used.": what is meant by instantiating? plz explain with an example. thanks in advance. pls give me a link for the OO abap.

Read only

0 Likes
671

Hi,

Please read the following link.

[http://help.sap.com/saphelp_erp60_sp/helpdata/EN/ce/b518b6513611d194a50000e8353423/content.htm]