Sei sulla pagina 1di 9

6/6/2019 Classic BADI with Single Use(Single Implementation) – SAPCODES

SAPCODES

ABAP OO-ABAP ENHANCEMENTS RFC & BAPI ALE-IDOC USEFUL PROGRAMS WEBDYNPRO

FPM WORKFLOW HANA ODATA-UI5 BASIS JOBS POSTS

CLASSIC BADI WITH SINGLE USE(SINGLE IMPLEMENTATION)


 November 20, 2015  Leave a comment
Search … 

 Scenario: Creation of Classic BADI de nition with single use and creation of
BADI implementation and calling the BADI implementation from program.

The current SAP system release is 605.

RECENT POSTS

UI5 App Table with


JSON Data Model-2
UI5 App Table with
JSON Data Model
UI5 APP- Simple Form
Step1. Go to TCODE- SE18. with JSON Data Model
Prepaid & Postpaid
Payment Group in Hybris
Billing
CI Partner Settlement
CRM – Partner Product
Settlement Rule
CRM
Step2. Select radio button BADI Name and provide a BADI de nition name and Standard/Revenue Sharing
click on Create button. Product
CRM Product Hierarchy
It gives a error message as ‘Create operation is only possible for enhancement
& Category
spots’.

As SAP provided a new concept of BADI as Kernal BADI, the classical BADI is
Enter your email address
restricted but 

still there is a way to go ahead in the system to create it. Follow

https://sapcodes.com/2015/11/20/classic-badi-with-single-usesingle-implementation/ 1/10
6/6/2019 Classic BADI with Single Use(Single Implementation) – SAPCODES

BLOG STATS

1,141,984 hits

RECENT COMMENTS

UI5 App Table


with J… on UI5
App Table with
JSON Data M…
Phani on oData
service which
Step3. Provide the BADI name and go to the menu Utilities and Click on Create
consumes R…
Classic BADI .
Anonymous on
Using Standard
Text in Adobe
F…

This site is maintained by


Siva Prasad . This site
sapcodes.com is not
a liated with SAP SE.

Step4. Provide a short description. In the properties section, the system


automatically generates a BADI Class based on the BADI name. In the TYPE
section, as the multiple use option is not selected, it means

 that it is a single use BADI.

Step5. Click on the Interface tab. The system also generate a Interface with no
method based on the BADI name.Now double click on the interface name
‘ZIF_EX_BADI_DEFN_DEMO1’.

https://sapcodes.com/2015/11/20/classic-badi-with-single-usesingle-implementation/ 2/10
6/6/2019 Classic BADI with Single Use(Single Implementation) – SAPCODES

Step6. It navigates to SE24 transaction. Now in the ‘METHODS’ tab, provide a


method name as ‘DISPLAY_MESSAGE’, select the level and provide the
description and activate the interface. At last  Click on the BACK button.

Step7. Now the method is added to the interface. Up to this point the BADI
de nition is created with interface containing an empty method.

Step8. Creating a BADI Implementation. Go to TCODE – SE19. Under the CREATE


Implementation Section, Select the Radio button classic badi and provide the
BADI de nition name created above and click on the Create Impl. button and it
‘ll show a popup screen . Provide the Implementation name as
‘ZBADI_IMPL_DEMO1’ and click on the continue button.

https://sapcodes.com/2015/11/20/classic-badi-with-single-usesingle-implementation/ 3/10
6/6/2019 Classic BADI with Single Use(Single Implementation) – SAPCODES

Step9.  Provide a implementation short text and click on the Interface Tab.

Step10. For this implementation the system automatically creates a


Implementing Class which implements the method ‘DISPLAY_MESSAGE’ of the
interface associated with BADI de nition.Now double click on the method
‘DISPLAY_MESSAGE’ to implement the method.

https://sapcodes.com/2015/11/20/classic-badi-with-single-usesingle-implementation/ 4/10
6/6/2019 Classic BADI with Single Use(Single Implementation) – SAPCODES

Step11. Provide some statement here and then click on the activate button and
at last click on the back button.Now up to this point we crated a BADI
implementation successfully.

Step12. Calling the BADI implementation form the program . Go to TCODE –


SE38 and create a report program.

Step13. Create a reference variable referring to the Interface name associated


with the BADI de nition.

Then call the static method GET_INSTANCE of the class CL_EXITHANDLER. Pass
the BADI de nition name and it ll return the object of the active  implementing
class to the reference variable. Activate the program and run it.

https://sapcodes.com/2015/11/20/classic-badi-with-single-usesingle-implementation/ 5/10
6/6/2019 Classic BADI with Single Use(Single Implementation) – SAPCODES

Step14. Now it calls the methods and display the output.

____________________________________________________________________________
___

Step15. Further scenarios. As the badi is a single use BADI let’s create another
implementation of it.

Go to TCODE- SE19 and in the Create Implementation Section provide the BADI
de nition name and click on the Create Impl. Button. In the popup screen
provide the Implementation name and click on teh continue button.

https://sapcodes.com/2015/11/20/classic-badi-with-single-usesingle-implementation/ 6/10
6/6/2019 Classic BADI with Single Use(Single Implementation) – SAPCODES

Step16. Provide a implementation short text and then click on  the interface
button.

Step17. Now for this implementation a new implementing class is generated


and the interface associated with the BADI de nition is implemented in this
class. Now double click on the method ‘DISPLAY_MESSAGE’

to implement it.

Step18. Provide some statement and activate the same . At last click on the
back button.

Step19.  Activate the BADI Implementation.

https://sapcodes.com/2015/11/20/classic-badi-with-single-usesingle-implementation/ 7/10
6/6/2019 Classic BADI with Single Use(Single Implementation) – SAPCODES

Step20. Run the report as per shown below.

Step21. Now for this the sy-subrc = 5 [Single_exit_multiple_active]. As our BADI


de nition is not a multiple use badi (single uses badi) and we have multiple
implementations of it.

Step22.The output is as follows.

https://sapcodes.com/2015/11/20/classic-badi-with-single-usesingle-implementation/ 8/10
6/6/2019 Classic BADI with Single Use(Single Implementation) – SAPCODES

Advertisements

REPORT THIS AD

REPORT THIS AD

Rate this:

            1 Vote

  
Related

https://sapcodes.com/2015/11/20/classic-badi-with-single-usesingle-implementation/ 9/10

Potrebbero piacerti anche