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

Custamize badi

Former Member
0 Likes
532

Hi All,

I have one doubt - Suppose I ahve created one customize BADI inse 18 and implement in SE19.But how can I use it in standard transaction or any other transaction.

Could you please guide me.

Thanks in advance...

Amar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
505

Hi

If you've created a custom BADI, the system has generated the interface, in the program where u need to use the BADI, u need to define a variable like the interface.

DATA: MY_BADI TYPE REF TO <Z interface>.

Then u need to place in a strategic point of the program the calls of the methods of your BADI:

CALL METHOD MY_BADY->MY_METHOD

Now before calling a method of the BADI u need to make sure the BADI is implemented and the instance is created, u need to use the method GET_INSTANCE of class CL_EXITHANDLER to do it:

CALL METHOD CL_EXITHANDLER=>GET_INSTANCE
      EXPORTING
        EXIT_NAME              = <BADI name>
        NULL_INSTANCE_ACCEPTED = NULL_INSTANCE_ACCEPTED
      IMPORTING
        ACT_IMP_EXISTING       = ACT_IMP_EXISTING
      CHANGING
        INSTANCE               = MY_BADI
      EXCEPTIONS
        OTHERS                 = 1.

Max

Hi All,

I have one doubt - Suppose I ahve created one customize BADI inse 18 and implement in SE19.But how can I use it in standard transaction or any other transaction.

Could you please guide me.

Thanks in advance...

Amar

2 REPLIES 2
Read only

former_member376453
Contributor
0 Likes
505

Any BADI, should get triggered by the class, CL_EXITHANDLER and method get_instance. Here exit name should be your BADi name.


 CALL METHOD cl_exithandler=>get_class_name_by_interface
    EXPORTING
      instance                      = instance
    IMPORTING
      class_name                    = class_name
    CHANGING
      exit_name                     =  Should be your BADI Name
    EXCEPTIONS
      no_reference                  = 1
      no_interface_reference        = 2
      no_exit_interface             = 3
      data_incons_in_exit_managem   = 4
      class_not_implement_interface = 5
      OTHERS                        = 6.

Kuntal

Read only

Former Member
0 Likes
506

Hi

If you've created a custom BADI, the system has generated the interface, in the program where u need to use the BADI, u need to define a variable like the interface.

DATA: MY_BADI TYPE REF TO <Z interface>.

Then u need to place in a strategic point of the program the calls of the methods of your BADI:

CALL METHOD MY_BADY->MY_METHOD

Now before calling a method of the BADI u need to make sure the BADI is implemented and the instance is created, u need to use the method GET_INSTANCE of class CL_EXITHANDLER to do it:

CALL METHOD CL_EXITHANDLER=>GET_INSTANCE
      EXPORTING
        EXIT_NAME              = <BADI name>
        NULL_INSTANCE_ACCEPTED = NULL_INSTANCE_ACCEPTED
      IMPORTING
        ACT_IMP_EXISTING       = ACT_IMP_EXISTING
      CHANGING
        INSTANCE               = MY_BADI
      EXCEPTIONS
        OTHERS                 = 1.

Max