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

How to define, implement custom BADIs

Former Member
0 Likes
859

Can anybody tell me how to define, implement custom BADIs

Also, the procedure to find out these custom BADIs

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
746

YOu can do the implementations for the badis in se19 transaction.

YOu will find the badi definitions in se18 transaction.

You have to create implementation for a definition.

Give a z name for your implementation and also give the name of the badi definition for which you are doing the implementation.

Once you go into the se19 transcation, you can find different methods in that definition which can be redefined as per your requirement.

Regards,

Ravi

Can anybody tell me how to define, implement custom BADIs

Also, the procedure to find out these custom BADIs

4 REPLIES 4
Read only

Former Member
0 Likes
747

YOu can do the implementations for the badis in se19 transaction.

YOu will find the badi definitions in se18 transaction.

You have to create implementation for a definition.

Give a z name for your implementation and also give the name of the badi definition for which you are doing the implementation.

Once you go into the se19 transcation, you can find different methods in that definition which can be redefined as per your requirement.

Regards,

Ravi

Read only

former_member480923
Active Contributor
0 Likes
746

Hi,

Here are the steps:

1. Execute Business Add-In(BADI) transaction SE18

2. Enter BADI name i.e. HRPBSGB_HESA_NISR and press the display

button

3. Select menu option Implementation->Create

4. Give implementation a name such as Z_HRPBSGB_HESA_NISR

5. You can now make any changes you require to the BADI within this

implementation, for example choose the Interface tab

6. Double click on the method you want to change, you can now enter

any code you require.

7. Please note to find out what import and export parameters a

method has got return the original BADI definition

(i.e. HRPBSGB_HESA_NISR) and double click on the method name

for example within HRPBSGB_HESA_NISR contract is a method

8. When changes have been made activate the implementation

Thanks

Anirban M.

Read only

Former Member
0 Likes
746

You have create your own BADI in transaction SE18 with the name starting z* or y* . with relevant methods etc.

Implement the BADI in transaction SE19.

Important. use the following function modules to check whether the BADI is active or not in the program where you will call your BADI.

If you dont use this funcitonality then there is no point in writing your own badi.

CO_BADI_GET_BUSINESS_ADD_IN

OR

HR_GET_BUSINESS_ADD_IN

      • Reward if Helpful ****

Read only

Former Member
0 Likes
746

Hi Neela,

Go throught e following Steps for defining & Implement BADI

Goto Tcode SE18 for BADI Definition Creation.

give definition Name : ZBADI_CUST--> Press F5 button for Creating the Definition.

Give Description for the BADi Definition : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

In the Attributes tab you will find "TYPE" Tab

there you will check the Check Box as "Multiple" because this badi definition is active for multiple BADI Implementations

save & check the Badi Definition.

Click on "Interface" tab

Double Click on the Interface Name that is "ZIF_EX_BADI_CUST"

here the screen is take you to tcode SE24

here you will declare the methods

give method name as "GET_MATERIAL" as INSTANCE Level.

Click on Parameters Button just above your Method"GET_MATERIAL"

and Give Parameters as

P_MATNR IMPORT Type MATNR press enter

X_MARA CHANGING MARA press enter

save check and activate your badi Definition.

Note : you just declare the method in BADI Definition Section you will write the Method Implementation

in BADI IMPLEMENTATION Section.Because BADI's are pure Abstact class.

Goto Tcode SE19:

give Implementation name as : ZBADI_CUST_IMPL and press "F5" for Creation

it asks BADI Definition name as "ZBADI_CUST" just you create .

and press enter

and you give the BADI Implementation Description : XXXXXXXXXXXXXXXXXXXX

save this Implementation

click on the Interface tab and double click on the Implementation Class as "ZCL_IM_BADI_CUST_IMPL".

then you have the GET_MATERIAL Method . double click on the Method it opens the Code window for that method.

as looks like bellow.

method ZIF_EX_BADI_CUST~GET_METERIAL .

Here you will write the coding part.

if not p_matnr is initial.

select single * from mara

into x_mara

where matnr = p_matnr.

endif.

endmethod.

save,check & activate

come back and activate again.

then you need to use this badi in SE38 program.

go through the following Code

REPORT ZCUST_BADI1_IMPL_CALL.

TABLES : MARA.

*creatingthe BADI interface ref to following class

DATA : OBJ TYPE REF TO ZIF_EX_CUST_BADI1.

PARAMETERS : P_MATNR LIKE MARA-MATNR.

START-OF-SELECTION.

*passing the BADI interface ref var to following class method to get obj of BADI business add in class

CALL METHOD CL_EXITHANDLER=>GET_INSTANCE

  • EXPORTING

  • EXIT_NAME =

  • NULL_INSTANCE_ACCEPTED = SEEX_FALSE

  • IMPORTING

  • ACT_IMP_EXISTING =

CHANGING

INSTANCE = OBJ

  • EXCEPTIONS

  • NO_REFERENCE = 1

  • NO_INTERFACE_REFERENCE = 2

  • NO_EXIT_INTERFACE = 3

  • CLASS_NOT_IMPLEMENT_INTERFACE = 4

  • SINGLE_EXIT_MULTIPLY_ACTIVE = 5

  • CAST_ERROR = 6

  • EXIT_NOT_EXISTING = 7

  • DATA_INCONS_IN_EXIT_MANAGEM = 8

  • others = 9

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Regards

Sreeni