You are on page 1of 25

Classic BADI with Single Use(Single Implementation)

Scenario: Creation of Classic BADI definition with single use and creation of BADI
implementation and calling the BADI implementation from program.
The current SAP system release is 605.

Step1. Go to TCODE- SE18.

Step2. Select radio button BADI Name and provide a BADI definition name and click on
Create button.
It gives a error message as 'Create operation is only possible for enhancement spots'.
As SAP provided a new concept of BADI as Kernal BADI, the classical BADI is restricted
but
still there is a way to go ahead in the system to create it.

Step3. Provide the BADI name and go to the menu Utilities and Click on Create Classic
BADI .

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'.

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 definition 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
definition 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.

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
definition.Now double click on the method 'DISPLAY_MESSAGE' to implement the method.

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 definition.
Then call the static method GET_INSTANCE of the class CL_EXITHANDLER. Pass the
BADI definition name and it ll return the object of the active implementing class to the
reference variable. Activate the program and run it.

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 definition
name and click on the Create Impl. Button. In the popup screen provide the Implementation
name and click on teh continue button.

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 definition 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.

Step20. Run the report as per shown below.

Step21. Now for this the sy-subrc = 5 [Single_exit_multiple_active]. As our BADI definition is
not a multiple use badi (single uses badi) and we have multiple implementations of it.

Step22.The output is as follows.

XXXXXXXXXXXXXXXXXXXXXXXXX
Posted 20th October 2013 by S Prasad

View comments

TECHSAP

[visit www.marathustech.net for


classroom or online training or
contact +91 89708 40880]
Sidebar

Home

Topic Tutorials

FPM Tutorials

Topic Wise Questions for Interview?

SAP ABAP Short Questions for written interview

Need SAP Training?

Want to Call any URL from ABAP Program?

Calling Calculator in ABAP Program!

Reading program text pool!

How to create a Single Quote ?

Conversion: Raw to String

Conversions (2) : XSTRING to STRING

Conversions : XSTRING to STRING

Conversions : STRING to XSTRING


SAP Script Important Standard Programs!

How to use User Parameter ID ?

How to call Maintenance View Programatically?

How get to know SAP_JAVA engine is active or not?

How to Check Different Languages Installed in SAP System?

Maximum allowed sessions in SAP?

How to Create Number Range Object [Tx- SNRO]

Editable ALV with save functionality uisng OOABAP

Creating a dynamic variant for a report

Running background job by triggering an event

13.Smartfrom : How to debug a smartform?

12.Smartform : Passing data from driver program to Smartform interface

11.Smartform: Use of Copy Window in Smartform

Writing to or Reading from Application Server By ABAP Classes

Downloading File from SAP Appliciation Server Directory

Uploading File to SAP Appliciation Server Directory

Reading Data from SAP Application Server [ Tx- AL11 ]

Writing Data to SAP Application Server [ Tx- AL11 ]

10. Smartform :Designing a template in Smartform

9. Smartform : Designing a table in smartform

8. Smartform : Displaying address on a Smartform Window

7. Smartform : Displaying a logo on a Smartform Window

6.Smartfrom: How to call a Smartform progrmatically that works in development, quality & production?

5.Smartfrom : How to call a Smartform Progrmatically?

4.Smartform- Using Dynamic Text in window

3.Smartform- Using Standard Text in window

2.Smartform- Using Text module in window

1.Smartform - Using a text element in window

Benefits of use of text elements and its translation

Use of SAP OTR [OnlineText Repository] Text

Part4 : FPM OVP Application -Integrating Search UIBB and List UIBB: Displaying POPUP Screen

Part3 : FPM OVP Application -Integrating Search UIBB and List UIBB: Message Display

Part2 : FPM Integrating Search UIBB and List UIBB into FPM OVP Application : Link to action

Part1 : FPM Integrating Search UIBB and List UIBB into FPM OVP Application

Creating Range Table Type in Data Dictionary

Converting Script OTF data to PDF

Need to Convert Spool Request(Generated Background Job ) Into PDF!

Need to Convert Spool Request(OTF Script) Into PDF!

Tabbed Block at Selection-screen

qRFC with Outbound Queue & Inbound Queue between two different SAP systems - One LUW per mixed part of the
Queues

qRFC with Outbound Queue & Inbound Queue between two different SAP systems - One LUW per Queue Call

qRFC with Outbound Queue & Inbound Queue between two different SAP systems - One LUW for Multiple QUEUE Calls

Want to Call any URL from ABAP Program?


-----------------------------------------------------------------------------------------------------------------------------Code:
-------------------------------------------------------------------------------------------------------------CALL METHOD cl_gui_frontend_services=>execute
EXPORTING
* document
=
" Path+Name to Document
application
= 'www.google.com' " Path and Name of Application
* parameter
=
" Parameter for Application
* default_directory
=
" Default Directory
* maximized
=
" Show Window Maximized
* minimized
=
" Show Window Minimized
* synchronous
=
" When 'X': Runs the Application in Synchronous Mode
* operation
= 'OPEN' " Reserved: Verb fr ShellExecute
EXCEPTIONS
cntl_error
=1
error_no_gui
=2
bad_parameter
=3
file_not_found
=4
path_not_found
=5
file_extension_unknown = 6
error_execute_failed = 7
synchronous_failed
=8
not_supported_by_gui = 9
OTHERS
= 10.
IF sy-subrc <> 0.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
*
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.
-------------------------------------------------------------------------------------------------------------Step1. cl_gui_frontend_services=>execute method can be used to call any URL. It can
be used to call any webdynpro/fpm application from the program as every
webdynpro/fpm application have an uniuqe URL.

Step2. Here it calls the URL.

Step3. Still we can open any document by specifying the appropriate executable file,
location of the directory of the file and providing the file name.

Step4. Here is one example how we can open a PDF file by the method
cl_gui_frontend_services=>execute.

-----------------------------------------------------------------------------------------------------------------------------Posted 2 days ago by S Prasad

View comments

Loading

You might also like