You are on page 1of 72

inShare

creatign a custom badi


This question is Assumed Answered.

mohammad afzal
Oct 8, 2007 3:52 PM
hai freinds i want to create a custom badi, i am doing through se18 and giving zdemo and create
but it gives error that create option is possible for enhancment spots only can any one help me
how to create the custom badi
regards
afzal

2168 Views

Topics: abap

Average User Rating


(0 ratings)

Re: creatign a custom badi

Murali Poli Oct 8, 2007 3:58 PM (in response to mohammad afzal)


Business Add-Ins
Overview
BAdi Definition
BAdi Implementation
Calling BAdi
Filter Dependent Badi

New SAP enhancement technique


To accommodate user requirements not available / too specific to be included in the SAP
standard Program
Based on ABAP Objects It has Interfaces & Methods
Guaranteed upward compatibility of all Business Add-In interfaces
Release upgrades do not affect enhancement calls from within the standard software nor
do they affect the validity of call interfaces

Though different enhancement technique, BAdi has following distinct features


-Uses Object oriented approach
-Two parts - Definition and its Implementation - definition can either be SAP provided or
user may also create it
-no longer assumes a two-system infrastructure (SAP and customers)
-allows multiple levels of software development (by SAP, partners, and customers, and as
country versions, industry solutions, and the like)
-Can have multiple representations specific one will be executed based on some criteria
(filter)
-No SSCR registration

Application Programmer defines an interface for the Business Add-Ins


Enhancement management takes this interface & generates an adapter class for
implementing it, thus opening path for implementation
As per need, BAdi is suitably implemented
Developer then creates an instance of the adapter class in the application program and
calls the corresponding method at the appropriate time

Application program simply calls the adapter class methods; it does not know which
implementations are actually being called
Adapter class methods generated by add-in management decide which implementation is
to be called

Look for BAdi in IMG and in component hierarchy


Create own implementation of the add-in (complete coding for Methods) and activate
Enhancement's active components are called at runtime.

BAdi Definition

To include Business Add-Ins in the program


- Define an interface for the enhancement in the SAP menu under Tools-> ABAP
Workbench -> Utilities -> Business Add-Ins (transaction SE18)
-Call the interface at the appropriate point in application program
-Customers can then select the add-in and implement it according to their needs

Lets plan a simple task:


We want to convert strings in your application program is a specific way through
Business Add-Ins technique
As the application developer, first task is to define an enhancement consisting of an
interface & a method with a changing parameter to transfer value

Choose Tools ->ABAP Workbench -> Utilities -> Business Add-Ins (transaction SE18)
from the SAP menu
Create a new Business Add-In containing a maximum of 20 characters and move to
Interface Tab

Name of the interface is proposed by the system but may be changed


Save and double-click on the interface name to add a method

System branches to the Class Builder


Assign a method to the interface (default is Instance Method)
Add a parameter
Save and Activate
Definition screen(SE18) will now contain the method assigned to the interface
Documentation may be created to describe the intended functionality of this Add-Ins

BAdi Implementation

ABAP Workbench ->Utilities -> Business Add-Ins (transaction SE19)


Find the suitable Business Add-Ins present in system (Use IMG or Component hierarchy)
Use Add-Ins Documentation to understand functionality & to decide
Implement the Add-Ins
-a class is created with the same interface
-Finalize coding for the method
Implementations are discrete transport objects and lie within the namespace of the person
or organization implementing them

Work on Simple Badi project Continued


Already structure of the interface defined

In order to create an implementation for the text conversion example, the add-in (in this
case, the interface's method) needs to be filled with logic that converts the string. This
logic will be run through every time the add-in is called from the application program

Choose ABAP Workbench ->Utilities -> Business Add-Ins (transaction SE19)


Create a new implementation and select the appropriate definition in the dialog box
Add a short text and move to Interface tab
Save
Double-click the method name when the system will take you to the code window for the
method

Insert the desired source code for the implementation between the method
if_ex_businessaddin~method. and endmethod. statements automatically provided to you
by the system.
Save and return to the Change Implementation screen
On Activation, this implementation may be executed from the application program

Sample code to call Add-In from ABAP Program


To call static method of a global class directly, class definition load statement is
needed
Instance of the Adapter class is created and its method is executed

If enhancement needs to be different based on some parameter (e.g. country-specific or


company-code specific), separate implementation of the same Add-In can be created and
activated
At run time, the specific implementation will be execute
Possible through Filter-Dependent Badi

How it works
-Switch on Filter-dependency while defining the interface
-Select a suitable filter element
-All methods created in the interface will have filter 'FLT_VAL' as one import parameter
-Application program provides the filter value to the enhancement method
-The method then selects the active implementation for that value

What qualifies as a Filter

A Data element
Underlying domain may contain a maximum of 30 characters and must be of Character
type
The data element must
-Either have a search help with a search help parameter of the same type as the data
element and this parameter must serve as both the import and export parameter or
-the element's domain must have fixed domain values or a value table containing a
column with the same type as the data element
Custom data element with the criteria may also be used

Implementing a Filter-Dependent Business Add-In

Implement the Add-In for each relevant filter value


However, multiple filter values may use the same implementation
Enter a characteristic filter value for the implementation

Calling a Filter-Dependent Business Add-In

Same as before
Pass the filter value as export parameter to the method

BAdi some useful information

There can be more than one implementations of the same BADI definition, and in that
case only the active implementations will be executed
You can activate or de-activate any of the implementations after creation
Enhancement, interface, and associated classes generated all lie in the appropriate
application development namespace
Business Add-In implementations lie in the respective namespaces of the people who
created them
Changes made to the interface and changes made to the Business-Add-In definition are
always incompatible
-If implementations already exist for a Business-Add-In definition, they are invalidated if
you make changes to the interface. This means that their syntax is no longer correct. No
statements can be given on the runtime behavior. Avoid making changes to the interface
or the Business-Add-In definition after the transport has taken place.
-If changes to the interface are inevitable, navigate to the Class Builder for all
implementing classes and clean up the method includes of these classes (Utilities > Clean
up > Method includes)

Please give me reward point If it is useful

Thanks

Murali Poli
o Alert Moderator
o Like (0)

Re: creatign a custom badi

Aneesh Nandi Oct 8, 2007 4:09 PM (in response to mohammad afzal)


Afzal,

Check this link to create your own BADI.

BADI

Regards
Aneesh.
o Alert Moderator
o Like (0)

Re: creatign a custom badi

mohammad afzal Oct 9, 2007 6:07 AM (in response to mohammad afzal)


hii

ABAP Development
Previous post Next post

Custom BADI to replace User/Customer-exits


Posted by Bharat Vaddi in ABAP Development on Apr 30, 2012 3:36:12 PM
inShare

I have decided to write this blog after I saw there are some old-school user- exits still being used
while enhancing standard SAP functionalities with some customer specific requirements. The
idea behind this blog is to avoid keeping so many IF conditions inside the user-exits for calling
different requirements based on certain conditions. Instead, we can create our own BADI
definition with required filter combination and also we can create multiple implementations
based on different filter combination. So that it will be easy to separate the implementations and
maintenance will be easy if any problem occurs in any of the implementations. The defined
BADI can be called from user-exit by passing runtime filter values, so that system determines the
corresponding implementation for execution.

Introduction: The common meaning extracted from this saying is that too many people
working on a single task tend to make a mess of it. Lets think of situation where too many
developers working on a single piece of ABAP code. What will happen in that case??? Yes... it
will go for a big mess. This issue is especially difficult to deal with when there are multiple
functional requirements leveraging the same custom code object, form-based user-exit, or
function-based user-exit.

While current releases of SAP have good control of doing enhancements and customizations via
BADIs, Implicit and explicit enhancement points, there still exists many user-exits (Form
based / Function based) For customer specific requirements especially in case of IDOC
extensions.

Standard SAP solution for latest IDOCs: In case of latest IDOCs for few cases SAP
provided BADI definitions (With / without filters) for making different implementations specific
to different customer specific requirements. For example in case of IDOC
SHP_OBDLV_CONFIRM_DECENTRAL04 SAP provided BADI SMOD_V50B0001.
But still there are many IDOCS available without BADI functionality for making IDOC
extensions.

Note: Please note that this blog provides a simple roadmap of how to handle such situations to
use BADI functionality instead of using user exits. I am not trying to rule out the possibility of
doing it through Standard BADIS (If any during the same process), if they are available please

use them. In this blog I am using IDOC example since at many places for standard IDOCs
still SAP is using Function based user exits for customer specific requirements.

Requirement: So lets say multiple developers were creating different integrations based on the
shipment inbound IDOC. Each integration requires a separate set of custom functionality and
therefore, its own IDOC extension.
The problem is SAP has provided only one customer exit for doing this functionality and all
developers needed to be developing in it at the same time.

How to solve: I decided to create a custom BADI definition with attributes multiple-use, filtered
and create the implementations for each different requirement and use the filters to separate the
implementations. Actually you can implement your own BADI almost anywhere you need
alternate logic execution.

As an example i have demonstrated here how to replace the customer-exit


EXIT_SAPLV55K_020 with BADI. This particular exit gets called during inbound shipment
IDOC processing (IDOC_INPUT_SHPMNT) to modify the IDOC data record before shipment
processing.So, I have created below steps for achieving the same.

1.

Use SE18 transaction to create new enhancement spot definition. In the below example
the name is given as Z_EXIT_SAPLV55K_020since this enhancement spot will be used in
customer exit function EXIT_SAPLV55K_020.

2.

3.

Choose BADI definition for Technology

Now create a new BADI definition and specify that new BADI definition will be multiple
uses.

4.

Create new filter and specify filter combination. In this example we are using BADI
definition to modify IDOC shipment data.Each integration has its
own control record and out of that Message type, Message code, Message function, IDOC
Type and extension will be always unique. So it is good to
define the filter combination accordingly to separate the implementations for different
requirements.

5.

Create the BADI interface that will be inherited by each implementing class. Define the
method and maintain the parameters exactly similar to
customer-exit function, since the BADI we are creating is the replication of customer-exit
function.

Here is the function interface for EXIT_SAPLV55K_020.

The same parameters (data) are being passed via the interface method as well.

6.

Create the BADI Implementation with required filters and add the code to the method just
like you would in customer-exit function.

7.

As a final step, the BADI has to be called from the customer-exit. Define the global
BADI object with reference to BADI definition. The idea behind
defining global BADI object is to prevent instantiations unnecessarily inside IDOC data
loop.

5027 Views
Average User Rating
(5 ratings)
inShare
Comments

7 Comments

Tajuddeen Shaik Apr 30, 2012 5:13 PM


well done.. very nice post..
Like (0)

Bjorn-Henrik Zink May 3, 2012 8:28 PM

Hi Bharat,

great topic and good blog. I had forgotten about the article that Kesavadas, in the
comment below, rightfully refers to.

Thanks!
Like (0)

Kesavadas Thekkillath May 3, 2012 12:52 PM


Good Effort. Similar article was posted few years ago
http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d0456c54-0901-0010f0b3-cd765fb99702?QuickLink=index&overridelayout=true.

It mentions the advantages little bit more precisely


Like (1)

Bharat Vaddi May 6, 2012 5:39 PM


Thanks Bjorn-Henrik and kesavadas for your valuable feedback.

Sorry... I havent read the article which kesavadas was mentioned before posting my article.
It was very good article which explained very clearly about the advantage and how to
implement a custom BADI inside the Enhancement.

But I think my article will give some clear picture on separating BADI implementations in
case of IDOC extensions with proper filter combination

Thanks!
Like (0)

Kesavadas Thekkillath May 7, 2012 8:24 AM (in response to Bharat Vaddi)


No need to apologize. It's your effort & it's good.
Like (1)

Andrea Olivieri Jun 13, 2012 10:06 AM


Hi Bharat,
thank you for sharing.

I'd like to mention also the following blog:


http://scn.sap.com/community/abap/application-development/blog/2010/01/12/bestpractice-for-a-sap-ecc-consolidation-project-filter-dependent-badi-to-organize-the-userexits-and-enhancements

Regards,
Andrea

Like (1)

Bharat Vaddi Jul 10, 2012 2:39 PM


Thanks Andrea for your valuable feedback.

Creation of Custom Kernel BADI and Calling it in a Custom Program


created by Abyson Joseph on Sep 26, 2013 11:41 AM, last modified by Abyson
Joseph on Apr 23, 2014 10:57 AM
Version 7
inShare
Author: Abyson Joseph Chavara
Created on : 26.09.2013

The BADI(Business Add-in's) is an object-oriented enhancement option. The BADI defines an


interface that can be implemented by BADI-implementations that are transport objects of their
own. The new BADI or Kernel BADI is fully integrated into the Enhancement Framework.
Within the Enhancement Framework a BADI is an enhancement option or an anchor point for an
object plug-in.

Kernel BAdI's Features

Are integrated directly in the ABAP Language/Runtime

Improved filter support allows non-character filter types and complex filter
conditions

Enable reusable implementation instances (Stateful BAdI)

Control of the lifetime of implementations (BAdI-context)

Allow for inheritance of implementations

Can be switched by the Switch Framework

In this document, I have demonstrated the various steps for creating a Kernel BADI and calling it
in our own Custom program.

1. First create a Enhancement spot from SE18. Kernel Badi's belong to an enhancement spot.
Enhancement spots carry information about the positions at which enhancement options were
created. One enhancement spot can manage several enhancement options of a Repository
object. Conversely, several enhancement spots can be assigned to one enhancement option.

Enter the description and if you want you can assign the new enhancement spot to a composite
enhancement spot. Composite enhancement spots are used for the semantic grouping of simple
enhancement spots. A composite enhancement spot contains either one or more simple
enhancement spots and/or one or more composite enhancement spots of the relevant type. You
can use composite enhancement spots to combine simple enhancement spots into meaningful
units.

2. On creating the Enhancement spot, you will be directed to Enhancement Spot Editor. Now we
need to create a new BADI Definition.

3. Click on the create BADI button.

4. You will find certain options for the BADI definitions as below.

Usability - Multiple use - that is, there can be several active implementations

Limited Filter Use This makes the BADI Filter-dependent - that is, you apply a
filter value to each method called (for example, a country). A different (active)
implementation is then called for each value. Possible filter values are
characterized by the filter type.

Instance Generation Mode - This property controls the instantiation of the


object plug-ins during execution of the statement GET BADI.
The first two specifications define context-free BAdIs.
Newly Created Instantiation - New object plug-ins are created at each
execution of the statement GET BADI.
Reusing Instantiation - An object plug-in that was used once in the current internal
mode is reused, if it is required more than once.
Context-Dependent Instantiation - A context must be specified for GET BADI.
This context controls the instantiation. Only one object plug-in is created for each
context and implementing class. Each time there is another GET BADI with the
same context, it is reused. A context is an instance of a class that implements the
tag interface if_badi_context. The specification takes place in the form of a
reference to such an instance.

Fallback Class - Fallback class for a BADI is used if there is no active BADI
implementation. This means: The GET BADI command returns a handle to an
instance of the fallback class and the respective CALL BADI calls the methods of
the fallback class instance. As soon as there is an active BADI implementation, the
fallback class is not used any longer at runtime.

5. Now we need to add an interface to the BADI. Expand the Node of BADI definition
name and double click on node Interface. You can either add existing interface or
will be prompted to create.

6. On clicking Yes, you will be navigated to the below screen, where you can add a
method to the new interface.

Save, activate and comeback to the BADI definition screen and activate the
Enhancement Spot.

7. Next we need to implement the Enhancement spot and BADI. Right click on the
BADI definition and select Create BADI Implementation.

8. First the system will ask for enhancement implementation name. Please enter a
name and description.

9. Next it will ask for BADI Implementation name and Class name for implementing
BADI. Enter the names and click ok.

10. Next we have to implement the interface method. Expand the BADI Definition
name and double click on BADI implementation.

11. You will be directed to the enhancement implementation screen, shown below.
Double click on the Interface method and you will be prompted to create
implementation for the method.

12. On clicking yes, you will be navigated to editor for the method. Add the following code for
showing a message or anything as per your requirement. Save it and activate.

So the BADI definition and implementation part is complete.

Next we will see how we can call this Kernel BADI in our Custom program.

13. Create or open an existing program in SE38. Point to the line where you need to add
enhancement option. Right click and select Create Option.

14. Give an Enhancement point or section name and Enhancement spot implementation name.
Here I have opted an Enhancement point and have entered Enhancement spot implementation
name as ZENH_IMP_TEST (which we have created before).

A new line will be added to the existing code as shown below.

15. Then add the below code which is shown in the red box below.

Apart from Classic BADIs which are been called by Proxy class cl_exithandler, Kernel BADIs
are called directly with the reference to the BADI definition via GET BADI and CALL BADI
statements. That is one of the reasons why Kernel BADI is faster than classic BADI. Also in
Classic BADI, while we call it via cl_exithandler, we use the reference to the interface rather
than BADI definition

16. Now activate the program and execute it. When the cursor reaches the enhancement point,
where the BADI is called it will trigger all the active implementations of that BADI. Here we
have only one implementation and that will be triggered, which shows the below message as we
have written in the BADI implementation.

If the program fails to trigger the BADI implementation, please recheck whether everything
associated with it is Activated after the creation.

Thank You.
3574 Views Topics: abap
Average User Rating
(26 ratings)
inShare
Comments

6 Comments

Sameej T.K. Feb 22, 2014 7:44 AM


Very informative blog. Just one question though - I didn't understand why did you assign
an enhancement spot implementation to the enhancement point in step 14. Enhancement
points can be used to plug-in source code at the position in the future state and directly
assigning an implementation doesn't make much sense.

14. Give an Enhancement point or section name and Enhancement spot implementation name.
Here I have opted an Enhancement point and have entered Enhancement spot implementation
name as ZENH_IMP_TEST (which we have created before).

Like (0)

Abyson Joseph Feb 23, 2014 10:33 AM (in response to Sameej T.K.)
To call a Kernel BADI in a custom program we don't need any enhancement
options, as we can just write the code anywhere. Just meant to show reader the

creation of enh option and a point in a program. While creating an option either
you could use an existing enh spot imp or can create a new one there. Rather than
explaining the topic in an atmosphere of real business scenario, I focused on
giving the reader an understanding in the concepts.
Like (0)

abilash n Apr 24, 2014 1:15 PM


Hi Abyson,

can you please tell me what is the diff between kernel badi and normal badi
implementation. As you have implemented in normal way.
I know that kernel badi is faster than normal classical badi. but i never understood the
kernel badi. if you dont mind can you please reply to this or create new blog on kernel
badi,,,,
Like (0)

Abyson Joseph Apr 24, 2014 1:35 PM (in response to abilash n)


Hi Abilash,
Hope you will find the answer by checking my document Is Kernel BADI 'really'
faster than Classic BADI ?

Thanks and Regards,


Abyson Joseph
Like (0)

abilash n Apr 26, 2014 6:07 AM (in response to Abyson Joseph)


Thanks Abyson for sharing the blog. Now i got some good idea on it. If
possible please share some more info on the kernel and classic badi.
Another question - As there are limitations in customer exit so sap came
up with badi's previously. And what made sap to move to new badis even
after classic badis(apart from fast).

Thanks for your feedback.


Like (0)

HariKrishna Sana Apr 26, 2014 11:53 AM


Hi Abyson,

Good document with proper explanation. :-)


Like (0)

Delete Document
Are you sure you want to delete this document?

How to Implement a BADI in SAP ABAP with Tutorial


Aug 6th, in Articles, Enhancement & User Exit, SAP ABAP, by Raj

Check this Article to know how to implement a Business Add-ins with a Example.

Author : Raj
Author's Website | Articles from Raj

Raj (Raju Borda) is an Application Developer focusing on Custom Development - particularly in


the areas of ABAP ,WD4A , JAVA , APO , Enterprise services , Mobile applications and PI
Developer/consultant . He is also certified in ABAP , PI and insurance domain. Facebook
The Requirement is to put a information message while creating a material if Material Group is
A05 and Division is: 02.
(Why cant we use field exit ?? : As it needs two information ( Material group and Division ) for
the material also user wants information message while saving the material. this cant be
achieved using field exit ).

Step 1:
How to find appropriate BADI for this requirement??
Put the break- point into Class CL_EXITHANDLERs GET_INSTANCE method.
Go to transaction code MM01 , create a material and try to save it. it stops at many location with
different values of EXIT_NAME. (After checking into Se18 we got the
BADI_MATERIAL_CHECK which can be use for our requirement.

It has a method CHECK_DATA which is called before saving the material.

It also has WMARA table as input data (Material Group and Division comes in
MARA table).

Step 2:
Go to Transaction code SE18.
Open BADI : BADI_MATERIAL_CHECK.
Go to menu option Implementation Create.

Step 3:
Give the implementation name as ZMM_MAT_CHECK.

Step 4:

Double click on the method CHECK_DATA.If you notice the input parameters we have many
data related to batch , material and storage location etc..
For our requirement we need material group and devision Which exist in WMARA.Put the
below code inside the method then activate the class and method.
if WMARA-MATKL eq A05 and WMARA-SPART eq 02.
message Material creation for this Group should be avoided for animal products!! TYPE I.
endif.
This code is just checks the material group and division.

Step 5:
Go back and Activate the implementation.

Step 6:
So now its the time to Disco !!!!!!!Upsssss Sorry its the time to test this BADI.
For this go to transaction MM01 and try to create a material.
(if you are confused use material name as CH004 ,
Industry sector as Animal Health and
Material Type as Beverages )
Click on the ENTER Button and from the view select BASIC DATA 1.

Related Posts

Function Module EXIT in SAP ABAP with Tutorial

Screen EXIT in SAP ABAP with Tutorial

User EXITs in SAP ABAP with Tutorial

Field exit in sap abap with tutorial

Enhancement in SAP ( how to find , work and


implement ??? )

Like this post? Share it!

ADVERTISE HERE
User Comments

1.
uma gupta
October 7, 2010

hi dude
u ease my proble..

Reply

2.
Yogesh Patil
October 18, 2010

Hi Friends,
I have total 4.5 Years of Exp. in SAP-ABAP, I gone through lot of documents but the way
these document and designed and presented on this portal are amazingcomments in
between like Brett Lee Bounser and Its a time to Disco
I mean to say apart from work there is something different which I liked most
No doubts about Document they are really very well documented and User friendlybut
to Present each and every thing you should have proper wayI appreciate this way of
publishing document
Thanks a lot& I appreciate UR effortsGood Job Done Keep it up!!!
Thanks & Regards,
Yogesh Patil
Reply

3.
asha
November 19, 2010

really presented wellin an understanding way..:-P


Reply

Elmira
August 12, 2011

Infrotmiaon is power and now Im a !@#$ing dictator.


Reply

4.
rakesh
November 29, 2010

hi
i am rakesh the way of your presention is very good
superb keep it up guyes
Reply

5.
BAdi Beginner

January 18, 2011

Like the way you presented. Light and Easy!


Reply

6.
Kalyan
April 18, 2011

This was really helpfull and damn good presentation.


Reply

7.
sai
June 5, 2011

at Last i found the good concept in this


tahking you

Reply

8.
Rajiv Das
June 11, 2011

Awesome Presentation.I can see you in front of me, as u teaching in a light mode,..
Reply

9.
akein
June 22, 2011

Priceleesss!!!
Reply

10.
Nooruddin
June 22, 2011

This was really helpfull and Priceleesss!!!

Thank you very much.

Reply

11.
kevin
June 23, 2011

it s good to understanding the BADI, awesome


Reply

12.
venky
July 21, 2011

Good job done!!


Reply

13.
sanju
July 25, 2011

Hi Dear,
Can u help me out to know how to know its edit implementation of badi or create
implementation. And again within dat which radio button to choose with sm examples.

Thanks
Sanju
Reply

Raj
July 25, 2011

Hi Sanju ,
Please find my comments below:
how to know its edit implementation of badi or create implementation
BADI is something is provided by SAP standard team what we do is we create an
implementation for it.
You cant edit the standard BADI.What we do is we create an implementation for
it and we modify the created
implementation.
And again within dat which radio button to choose with sm examples.
Its not clear what you want to ask.may be you are asking for.Can you put some
light on it.?
thanks
Raj
SAP IGnite.
Reply

14.
venu
July 26, 2011

Good
Reply

15.
Oka
July 27, 2011

Nice tutorial
Thanks
oka
Reply

16.
Arumugam
August 4, 2011

Thank You very much.


Whenever I use BADI, surely I will remember you.

Reply

17.
Thanks
September 23, 2011

my badi from you,thanks


Reply

18.
Abhinesh Sinha
January 31, 2012

Hi,
It seems as somebody is teaching infront of me. It is presented in a very easy and
understandable way. It attracts the Reader attention.
Thanks for your kind support.

Reply

19.
ramya
February 15, 2012

hi raj,
am a hr abaper i got a requirement to set a default value for the field( id number) in
infotype 185 and subtype 02, i already created a classic badi zhrpadooinfty so using
this i need to set the default value, i asked my team leader he asked me to do using
implict enhancement so i am unable to do please help me on this.
thanks & regards
ramya
Reply

Raj
February 15, 2012

Hi Ramya,
If your question is how to implement the implicit Enhancement :
check out : How to implement Implicit Enhancement
If the code which you have placed in the BADI is not working thn and thn follow
your leads method.

Please paste the code which you are trying with program name so that i can check
it out in my system.
thanks & Regards,
SAP Ignite
~Raj
Reply

20.
ramya
February 16, 2012

Hi Raj,
i have return the below code in my badi (before_ouput
method) *************Setting default value for field ID number in IT 185***********
**************
DATA: i0185 TYPE p0185.
if ipsyst-ioper = INS and innnn-infty = 0185.
CALL METHOD CL_HR_PNNNN_TYPE_CAST=>PRELP_TO_PNNNN
EXPORTING
PRELP = innnn
IMPORTING
PNNNN = i0185.
MOVE PANNOTAVBL to i0185-icnum.
CALL METHOD CL_HR_PNNNN_TYPE_CAST=>PNNNN_TO_PRELP
EXPORTING
PNNNN = i0185
IMPORTING
PRELP = innnn.
endif.
for my classic badi the definition name is HRPAD00INFTY

so this what i have used can you help me on this,


Thanks & Regards
V.Ramya

Reply

21.
Chetan
March 16, 2012

Great help! Thanks.


Reply

22.
sharmistha
April 10, 2012

hii raj,
can u plz explain me why we chose badi_material_check.
i m new in badi.

and ur badi material helps me a lot.


if u have more material on badi plz send me on <><><>
thanks,
sharmistha.
Reply

Raj
April 11, 2012

Hi Sharmistha,
As i mentioned in the post. the BADI BADI_MATERIAL_CHECKs Check_data
method is triggered
during creation of the material .
we want when use is creating a material validation is done so the triggered timing
is perfect.
Also whatever data we want to validate it contains the the importing parameter of
the badi so
it can be used.
NOTE : there might be more thn one BADI who fulfill ur requirement ( triggering
time , proper importing data )
You can use any badi at that time,no restriction on it as such.
Please get back if i am not clear .
Thanks
RAJ
SAP IGnite.
Reply

sharmistha
April 11, 2012

yes i got it..


thanks 4 ur reply..
Sharmistha
Reply

23.
sharmistha
April 11, 2012

Hii,
when i create implementation through se18 ,i got the method
method IF_EX_BADI_MATERIAL_CHECK~CHECK_MASS_MARC_DATA.
which is diffrent from ur method method
IF_EX_BADI_MATERIAL_CHECK~CHECK_DATA.
and when i write the code inside the method like
method IF_EX_BADI_MATERIAL_CHECK~CHECK_MASS_MARC_DATA.
if WMARA-MATKL eq A05 and WMARA-SPART eq 02.
message Material creation for this Group should be avoided for animal products!!

TYPE I.
endif.
endmethod.
it shows a error Field WMARA-MATKL is unknown. It is neither in one of the
specified
tables nor defined by a DATA statement . . . . . . . . . .
what to do?
plz help
sharmistha
Reply

Raj
April 11, 2012

Hi
its very basic thing.all the bad might not have same importing parameters.
WMARA Is available in my badi .please check the signature of thwarting badi
which you are trying to use.it might not contain WMARA as its importing
parameter.
There might be different parameter which contains the data.
Thanks
Raj
SAP IGnite
Reply

24.
sharmistha
April 11, 2012

i just copy paste ur badi which u post ..but it shows the same error..and the badi have a
importing parameter wmara,which i check on double clicking on check_data
also tell me plz why ur method is different from my method like
method di IF_EX_BADI_MATERIAL_CHECK~CHECK_MASS_MARC_DATA.
which is diffrent from ur method method
IF_EX_BADI_MATERIAL_CHECK~CHECK_DATA.
i work on ecc 6.0.
thanks .
sharmistha
Reply

25.
Harikrishna
August 3, 2012

Hi Experts,
My requirement is, while creating a service using tcode ML81N, If the reference number
already exists means, then one error message has to be displayed.

Is there any BADI or User Exit available for this., please let me know.
Thanks in Advance.
Harikrishna

Reply

26.
Tab
September 13, 2012

Dear raj,
Thanks for the wonderful go thru of BADI implimentation, but I just wonder how and
where is the method CHECK_DATA being called when creating a material. I mean there
must be a call to the implemented method also during the flow of the transaction.
Reply

Raj
September 15, 2012

Hello Tab,
As i explained the BADI is a hook. Standard SAP creates it and place it in the
code.
That code contains call to the appropriate method ( like CHECK_DATA )
so in implementation phase you just need to implement it using Se19 ,
As the code is already placed to make a call it will trigger your implication
automatically.
Thanks
~Raj
Reply

27.
Harshal
September 29, 2012

Thanks a ton Raj..


Your posts are really helpful to beginner..
Thanks again for your help.
Reply

28.
Rekha

October 18, 2012

Hi Raj,
I have seen so many articals and explanation in net regarding BAdi, Userexits , but u r
amazing yar, realing Happy & thanks a lot for u r effort.
Thaks,
By
Rekha.:-?
Reply

29.
Prem
July 10, 2014

Raj
You Explained these stuff in simple language that everyone can understand ..Thanks for
sharing this good work
Prem
Reply

30.
moshe
July 30, 2014

Thanks RAj, very clear explanation.


CL_EXITHANDLER is very powerfull. thanks for sharing it with us
Moshe

Calling the custom badi from executable program


08:02 // ARUN RAJ

Hello Friends,

I have created a custom Badi definition ,interface, methods,class in the Enhancement Spot,
i need to call the custom badi in the executable program.
my problem is: while getting the instance of the interface by using
CALL METHOD cl_exithandler=>get_instance
here it goes to dump since there ie no entry in the table sxs_attr what can i do for that.
Thanks in advance.
Arun.

Das knnte Sie auch interessieren


Import Support Packages and note 1540729 Import Support Packages and note
1540729 ...more Mercure "Sweet Summer" Angebot Gnnen Sie sich diesen
Sommer einen Aufenthalt mit 100 % Vergngen zu 40 % Rabatt! ...more
Enhancement to 2LIS_13_VDKON Enhancement to 2LIS_13_VDKON ...more Dump in
report RDSWP_REP_SERV_DESK_SE: Timestream... Dump in report
RDSWP_REP_SERV_DESK_SE: Timestream generation error ...more Error while tranport Error while tranport ...more 500 in 5 Minuten Haben Sie 5 Minuten Zeit fr
500 Gewinn? ...more
advertise here

powered by plista

Jul 08 11

Re: Calling the custom badi from executable program


15:55 // rajbarath rengaraj

let me know ur mail id . I will forward you the right document with a sample program which
explains the one that you are trying .
Find some extract from the document below. This will explain how to handle
CALL METHOD CL_EXITHANDLER=>get_instance
RB.
***********************

REPORT YSPFLIBADI NO STANDARD PAGE HEADING.


*& UI
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
PARAMETERS : P_CARRID TYPE SPFLI-CARRID.
SELECTION-SCREEN END OF BLOCK B1.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
PARAMETERS : R1 RADIOBUTTON GROUP RAD,
R2 RADIOBUTTON GROUP RAD,
R3 RADIOBUTTON GROUP RAD.
SELECTION-SCREEN END OF BLOCK B2.
*& DATA DECLARATION
DATA : INSTANCE TYPE REF TO YIF_EX_C_SPFLI_BADI.
DATA : P_CONNID TYPE SPFLI-CONNID,
WA1 TYPE ZSPFLI_STR.
*& INTERNAL TABLE DECLARATION
DATA : JTAB TYPE ZSPFLI_ITAB.
&----

*&APPLICATION LOGIC
&----

*& EVENTS

INITIALIZATION.
CALL METHOD CL_EXITHANDLER=>get_instance
CHANGING
INSTANCE = INSTANCE.
IF INSTANCE IS INITIAL.
MESSAGE E112(0) WITH 'ERROR IN BADI'.
ENDIF.
AT SELECTION-SCREEN.
IF ( R1 NE 'X' ) AND ( R2 NE 'X' ) AND ( R3 NE 'X').
MESSAGE E111(0) WITH 'INVALID SELECTION'.
ENDIF.
START-OF-SELECTION.
IF R1 EQ 'X'.
CALL METHOD INSTANCE->GET_CONNID
EXPORTING CARRID = P_CARRID
IMPORTING CONNID = P_CONNID.
IF NOT P_CONNID IS INITIAL.
WRITE : /20 'CONNID = ', P_CONNID .
ENDIF.
ELSEIF R2 EQ 'X'.

CALL METHOD INSTANCE->GET_SINGLE_RECORD


EXPORTING CARRID = P_CARRID
IMPORTING WA = WA1.
IF NOT WA1 IS INITIAL.
WRITE : /2 'CONNID' .
WRITE : / WA1-CARRID,WA1-CONNID,WA1-CITYFROM,WA1-CITYTO.
ENDIF.
ELSE.
CALL METHOD INSTANCE->GET_MULTIPLE_RECORDS
EXPORTING CARRID = P_CARRID
IMPORTING ITAB = JTAB.
IF NOT JTAB IS INITIAL.
DATA : WA2 LIKE LINE OF JTAB.
ULINE AT :/2(52).
WRITE : /2 'CARRID' COLOR COL_POSITIVE ,
9 'CONNID' COLOR COL_NEGATIVE,
18 'CITYFROM' COLOR COL_GROUP,
38 'CITYTO' COLOR COL_HEADING.
ULINE AT :/2(52).
LOOP AT JTAB INTO WA2.
WRITE : / WA2-CARRID UNDER 'CARRID',
WA2-CONNID UNDER 'CONNID',

WA2-CITYFROM UNDER 'CITYFROM',


WA2-CITYTO UNDER 'CITYTO'.
ULINE AT :/2(52).
ENDLOOP.
ENDIF.
ENDIF.
Dec 08 04

Re: Calling the custom badi from executable program


07:18 // Deepa Manian

hi raj...
im having the same problem , my badi oriented data not available in table SXS_ATTR .
it shows a dump error as :
Short text
Exception condition "DATA_INCONS_IN_EXIT_MANAGEM" raised.
What happened?
The current ABAP/4 program encountered an unexpected
situation.
Error analysis
A RAISE statement in the program "CL_EXITHANDLER================CP" raised
the
exception
condition "DATA_INCONS_IN_EXIT_MANAGEM".
Since the exception was not intercepted by a superior

program, processing was terminated.


Short description of exception condition:
For detailed documentation of the exception condition, use
Transaction SE37 (Function Library). You can take the called
function module from the display of active calls.
Trigger Location of Runtime Error
Program

CL_EXITHANDLER================CP

Include

CL_EXITHANDLER================CM001

Row

155

Module type
Module Name

(METHOD)
GET_INSTANCE

Plz give me the solution ya . or else sent some document to my id get from my business card .
Thanks & Regards
Deepa.
Dec 08 18

Re: Calling the custom badi from executable program


07:33 // sree hari

Please send Badi Material to this mail id


Thanks in Advance

You might also like