SlideShare a Scribd company logo
1 of 20
REPORT z_badi_calc_ab.
PARAMETERS : pctry TYPE land1,
paramet1 TYPE i,
paramet2 TYPE i.
DATA : resultadd TYPE i,
resultsub TYPE i,
objbadi TYPE REF TO z_badi_calc_ab. "Creating object to call BADI's implemented methods
GET BADI objbadi
FILTERS
z_country_filter = pctry. "Passing Filter values.
CALL BADI objbadi->;;addition
EXPORTING
param1 = paramet1
param2 = paramet2
CHANGING
RESULT = resultadd.
WRITE: / 'Add Result: ', resultadd.
CALL BADI objbadi->;;substraction
EXPORTING
param1 = paramet1
param2 = paramet2
CHANGING
RESULT = resultsub.
WRITE: / 'Substraction Result: ', resultsub.
The new Enhancement Framework and Kernel BADI
The BADI 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 is fully integrated into the Enhancement Framework.
BAdis are like predefined Enhancement options available in SAP which can then be Implemented by the Industries as per there
needs.
BAdis: Business Add Ins are Enhancements to the standard SAP code. These BAdi Enhancement can be done with the Interfaces
which contains various methods (standard or customized). This Interface name is generated automatically and can b e changed as
required.
After defining the Interfaces developer assign some methods as required to these interfaces. These methods can have
only Importing and Changing parameters Exporting Parameters are not allowed. Finally BAdi is Activated and ready to be used
in program.
For creating BAdi first we need to create Enhancement Spot. New BAdi can only be created inside SPOT.
Below figure shows how to create Enhancement SPOT (TCode-SE18)
New Enhancement SPOT is created.
Now we are creating new BAdi inside this created Enhancement SPOT
Click on Create BADI button.
Provide BAdi name and short description.
BAdi requires one Interface which will contains all methods.
Creating new Interface, just doule click on Interface link under the BAdi definition section.
Provide the Interface name to be created.
As soon as you will save Interface, it will open new screen to define methods inside this Interface.
All these methods can then be called using BAdi.
Create two different methods namely Addition and Subtraction and provide the parameter list for these methods created inside
Interfaces.
The parameters inside these Interface methods can only be Importing and Changing. Exporting parameters are not allowed in
Interface methods.
Two created methods are displayed inside Interfaces.
Two steps are already completed
1. Created new BAdi
2. Created Interface and added two methods as required.
Now need to create Enhancement Implementation so that methods created inside Interfaces can be called.
Enhancement Implementation required Class name.
Class name is required here because using this class only we will be able to use ethods.
A new BADI implementation will be created with name “Z_BADI_IMPL”.
Double click on Implementing Class then following screen with two Interface methods will get displayed.
Double click on any Interface method. Currently these methods are all blank and need to Implement to have custom logic inside
these methods.
Now to use this we have created new Report Program
ABAP statements GET BADI, CALL BADI are used to Access Badi Objects.
Filters:
Filters are mainly used as a condition to switch over different implementations methods. For example there is one
BAdi having Implementation for converting any amount to UD. Now there is one more new requirement to have
currency conversion to IN.
In this case we need to have different Implementation in BAdi which will be switched based on the input provided by
the user. This calling of Implementation is all dynamic and can only be determined by BAdi at runtime.
Now creating filters in BADI
Click on Activate.
Now Double click on Enhancement Implementation to open it.
Double Click on Filter and then click on EDIT button.
After this to add different Filter condition click on Combination button.
Now time to add filter condition in created Filters.
When click on Combination button following screen will be displayed.
Here double click on “????” to add new filter conditions.
Need to place value for these filters which will be used by BAdi to decide at runtime which method to call.
In our example we are making calculation based on Country so I have taken IN (India) and another filter will be US.
Two filters are created.
Activate the BADI.
Now to play with Filters we need to create another Implementation which will get called based on Country selected by User.
Need to create another Implementation which will calculate the result based on US country.
Every Implementation needs a class, if we provide same class name t hen this Implementation will inherit the methods of first
Implementation which will be useless.
Now we have two Enhancement Implementations, having different method implementations one for US and another for IN.
Double click on Enhancement
Now create new filter for this Implementation
For US we have added 100 more to both parameters.
Now filters are all ready to be used in Report program.
In above screen shot highlighted section shows how to use filters in program.

More Related Content

Similar to 377776000 call-badi-from-report

Birt (business intelligence and reporting tools)
Birt (business intelligence and reporting tools)Birt (business intelligence and reporting tools)
Birt (business intelligence and reporting tools)Dharmesh Kumar Sharma
 
PresentationCrystaljoiuouoouououoooiuiouiououoioiuoiuouo
PresentationCrystaljoiuouoouououoooiuiouiououoioiuoiuouoPresentationCrystaljoiuouoouououoooiuiouiououoioiuoiuouo
PresentationCrystaljoiuouoouououoooiuiouiououoioiuoiuouohrhedgewarhospital
 
Cis407 a ilab 3 web application development devry university
Cis407 a ilab 3 web application development devry universityCis407 a ilab 3 web application development devry university
Cis407 a ilab 3 web application development devry universitylhkslkdh89009
 
PT1420 Modules in Flowchart and Visual Basic .docx
PT1420 Modules in Flowchart and Visual Basic             .docxPT1420 Modules in Flowchart and Visual Basic             .docx
PT1420 Modules in Flowchart and Visual Basic .docxamrit47
 
PT1420 Decision Structures in Pseudocode and Visual Basic .docx
PT1420 Decision Structures in Pseudocode and Visual Basic .docxPT1420 Decision Structures in Pseudocode and Visual Basic .docx
PT1420 Decision Structures in Pseudocode and Visual Basic .docxamrit47
 
Sales force class-3
Sales force class-3Sales force class-3
Sales force class-3Amit Sharma
 
Executing tools-in-modelbuilder-tutorial
Executing tools-in-modelbuilder-tutorialExecuting tools-in-modelbuilder-tutorial
Executing tools-in-modelbuilder-tutorialaskar_gila
 
LearningMVCWithLINQToSQL
LearningMVCWithLINQToSQLLearningMVCWithLINQToSQL
LearningMVCWithLINQToSQLAkhil Mittal
 
Web services in asp.net
Web services in asp.netWeb services in asp.net
Web services in asp.netDharma Raju
 
Implementing the Adapter Design Pattern
Implementing the Adapter Design PatternImplementing the Adapter Design Pattern
Implementing the Adapter Design PatternProdigyView
 
Windows Communication Foundation (WCF) programming using Visual Studio
Windows Communication Foundation (WCF) programming using Visual StudioWindows Communication Foundation (WCF) programming using Visual Studio
Windows Communication Foundation (WCF) programming using Visual StudioDharma Raju
 
Tutorial 3 accessing the database
Tutorial 3 accessing the databaseTutorial 3 accessing the database
Tutorial 3 accessing the databasessa_joe
 
Installing community surveys in connections 5.5
Installing community surveys in connections 5.5Installing community surveys in connections 5.5
Installing community surveys in connections 5.5Roberto Boccadoro
 

Similar to 377776000 call-badi-from-report (20)

Birt (business intelligence and reporting tools)
Birt (business intelligence and reporting tools)Birt (business intelligence and reporting tools)
Birt (business intelligence and reporting tools)
 
PresentationCrystalReport.ppt
PresentationCrystalReport.pptPresentationCrystalReport.ppt
PresentationCrystalReport.ppt
 
PresentationCrystaljoiuouoouououoooiuiouiououoioiuoiuouo
PresentationCrystaljoiuouoouououoooiuiouiououoioiuoiuouoPresentationCrystaljoiuouoouououoooiuiouiououoioiuoiuouo
PresentationCrystaljoiuouoouououoooiuiouiououoioiuoiuouo
 
Cis407 a ilab 3 web application development devry university
Cis407 a ilab 3 web application development devry universityCis407 a ilab 3 web application development devry university
Cis407 a ilab 3 web application development devry university
 
PT1420 Modules in Flowchart and Visual Basic .docx
PT1420 Modules in Flowchart and Visual Basic             .docxPT1420 Modules in Flowchart and Visual Basic             .docx
PT1420 Modules in Flowchart and Visual Basic .docx
 
PT1420 Decision Structures in Pseudocode and Visual Basic .docx
PT1420 Decision Structures in Pseudocode and Visual Basic .docxPT1420 Decision Structures in Pseudocode and Visual Basic .docx
PT1420 Decision Structures in Pseudocode and Visual Basic .docx
 
Sales force class-3
Sales force class-3Sales force class-3
Sales force class-3
 
Intake 37 9
Intake 37 9Intake 37 9
Intake 37 9
 
Applications lab
Applications labApplications lab
Applications lab
 
Executing tools-in-modelbuilder-tutorial
Executing tools-in-modelbuilder-tutorialExecuting tools-in-modelbuilder-tutorial
Executing tools-in-modelbuilder-tutorial
 
LearningMVCWithLINQToSQL
LearningMVCWithLINQToSQLLearningMVCWithLINQToSQL
LearningMVCWithLINQToSQL
 
Web services in asp.net
Web services in asp.netWeb services in asp.net
Web services in asp.net
 
Intake 38 9
Intake 38 9Intake 38 9
Intake 38 9
 
Implementing the Adapter Design Pattern
Implementing the Adapter Design PatternImplementing the Adapter Design Pattern
Implementing the Adapter Design Pattern
 
Windows Communication Foundation (WCF) programming using Visual Studio
Windows Communication Foundation (WCF) programming using Visual StudioWindows Communication Foundation (WCF) programming using Visual Studio
Windows Communication Foundation (WCF) programming using Visual Studio
 
Security lab
Security labSecurity lab
Security lab
 
Tutorial 3 accessing the database
Tutorial 3 accessing the databaseTutorial 3 accessing the database
Tutorial 3 accessing the database
 
Applications lab
Applications lab Applications lab
Applications lab
 
Installing community surveys in connections 5.5
Installing community surveys in connections 5.5Installing community surveys in connections 5.5
Installing community surveys in connections 5.5
 
Gokul bok
Gokul bokGokul bok
Gokul bok
 

More from Faina Fridman

294151805 end-to-end-o data-service-sapui5-application
294151805 end-to-end-o data-service-sapui5-application294151805 end-to-end-o data-service-sapui5-application
294151805 end-to-end-o data-service-sapui5-applicationFaina Fridman
 
Alv report-tutorial-www.sapexpert.co .uk-
Alv report-tutorial-www.sapexpert.co .uk-Alv report-tutorial-www.sapexpert.co .uk-
Alv report-tutorial-www.sapexpert.co .uk-Faina Fridman
 
Abap objects in action
Abap objects in actionAbap objects in action
Abap objects in actionFaina Fridman
 
An easy reference for alv grid control (1)
An easy reference for alv grid control (1)An easy reference for alv grid control (1)
An easy reference for alv grid control (1)Faina Fridman
 
Javascript beginner-handbook
Javascript beginner-handbookJavascript beginner-handbook
Javascript beginner-handbookFaina Fridman
 
230394452 extending-extending-srm-web-dynpro-view srm-web-dynpro-view
230394452 extending-extending-srm-web-dynpro-view srm-web-dynpro-view230394452 extending-extending-srm-web-dynpro-view srm-web-dynpro-view
230394452 extending-extending-srm-web-dynpro-view srm-web-dynpro-viewFaina Fridman
 
Alv object model simple 2 d table - the basics
Alv object model   simple 2 d table - the basicsAlv object model   simple 2 d table - the basics
Alv object model simple 2 d table - the basicsFaina Fridman
 

More from Faina Fridman (11)

294151805 end-to-end-o data-service-sapui5-application
294151805 end-to-end-o data-service-sapui5-application294151805 end-to-end-o data-service-sapui5-application
294151805 end-to-end-o data-service-sapui5-application
 
Acro6 js guide
Acro6 js guideAcro6 js guide
Acro6 js guide
 
Bcsrvcommsx
BcsrvcommsxBcsrvcommsx
Bcsrvcommsx
 
Alv report-tutorial-www.sapexpert.co .uk-
Alv report-tutorial-www.sapexpert.co .uk-Alv report-tutorial-www.sapexpert.co .uk-
Alv report-tutorial-www.sapexpert.co .uk-
 
Bcsrvalv
BcsrvalvBcsrvalv
Bcsrvalv
 
Abap objects in action
Abap objects in actionAbap objects in action
Abap objects in action
 
An easy reference for alv grid control (1)
An easy reference for alv grid control (1)An easy reference for alv grid control (1)
An easy reference for alv grid control (1)
 
Javascript beginner-handbook
Javascript beginner-handbookJavascript beginner-handbook
Javascript beginner-handbook
 
230394452 extending-extending-srm-web-dynpro-view srm-web-dynpro-view
230394452 extending-extending-srm-web-dynpro-view srm-web-dynpro-view230394452 extending-extending-srm-web-dynpro-view srm-web-dynpro-view
230394452 extending-extending-srm-web-dynpro-view srm-web-dynpro-view
 
R3 tosrm attach
R3 tosrm attachR3 tosrm attach
R3 tosrm attach
 
Alv object model simple 2 d table - the basics
Alv object model   simple 2 d table - the basicsAlv object model   simple 2 d table - the basics
Alv object model simple 2 d table - the basics
 

Recently uploaded

Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxnada99848
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 

Recently uploaded (20)

Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
software engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptxsoftware engineering Chapter 5 System modeling.pptx
software engineering Chapter 5 System modeling.pptx
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 

377776000 call-badi-from-report

  • 1. REPORT z_badi_calc_ab. PARAMETERS : pctry TYPE land1, paramet1 TYPE i, paramet2 TYPE i. DATA : resultadd TYPE i, resultsub TYPE i, objbadi TYPE REF TO z_badi_calc_ab. "Creating object to call BADI's implemented methods GET BADI objbadi FILTERS z_country_filter = pctry. "Passing Filter values. CALL BADI objbadi->;;addition EXPORTING param1 = paramet1 param2 = paramet2 CHANGING RESULT = resultadd. WRITE: / 'Add Result: ', resultadd. CALL BADI objbadi->;;substraction EXPORTING param1 = paramet1 param2 = paramet2 CHANGING RESULT = resultsub. WRITE: / 'Substraction Result: ', resultsub. The new Enhancement Framework and Kernel BADI The BADI 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 is fully integrated into the Enhancement Framework. BAdis are like predefined Enhancement options available in SAP which can then be Implemented by the Industries as per there needs. BAdis: Business Add Ins are Enhancements to the standard SAP code. These BAdi Enhancement can be done with the Interfaces which contains various methods (standard or customized). This Interface name is generated automatically and can b e changed as required.
  • 2. After defining the Interfaces developer assign some methods as required to these interfaces. These methods can have only Importing and Changing parameters Exporting Parameters are not allowed. Finally BAdi is Activated and ready to be used in program. For creating BAdi first we need to create Enhancement Spot. New BAdi can only be created inside SPOT. Below figure shows how to create Enhancement SPOT (TCode-SE18) New Enhancement SPOT is created. Now we are creating new BAdi inside this created Enhancement SPOT Click on Create BADI button.
  • 3. Provide BAdi name and short description. BAdi requires one Interface which will contains all methods. Creating new Interface, just doule click on Interface link under the BAdi definition section.
  • 4. Provide the Interface name to be created.
  • 5. As soon as you will save Interface, it will open new screen to define methods inside this Interface. All these methods can then be called using BAdi.
  • 6. Create two different methods namely Addition and Subtraction and provide the parameter list for these methods created inside Interfaces. The parameters inside these Interface methods can only be Importing and Changing. Exporting parameters are not allowed in Interface methods.
  • 7. Two created methods are displayed inside Interfaces. Two steps are already completed 1. Created new BAdi 2. Created Interface and added two methods as required. Now need to create Enhancement Implementation so that methods created inside Interfaces can be called.
  • 8. Enhancement Implementation required Class name. Class name is required here because using this class only we will be able to use ethods.
  • 9. A new BADI implementation will be created with name “Z_BADI_IMPL”. Double click on Implementing Class then following screen with two Interface methods will get displayed.
  • 10. Double click on any Interface method. Currently these methods are all blank and need to Implement to have custom logic inside these methods.
  • 11. Now to use this we have created new Report Program
  • 12. ABAP statements GET BADI, CALL BADI are used to Access Badi Objects. Filters: Filters are mainly used as a condition to switch over different implementations methods. For example there is one BAdi having Implementation for converting any amount to UD. Now there is one more new requirement to have currency conversion to IN. In this case we need to have different Implementation in BAdi which will be switched based on the input provided by the user. This calling of Implementation is all dynamic and can only be determined by BAdi at runtime. Now creating filters in BADI
  • 13.
  • 14. Click on Activate. Now Double click on Enhancement Implementation to open it. Double Click on Filter and then click on EDIT button. After this to add different Filter condition click on Combination button. Now time to add filter condition in created Filters.
  • 15. When click on Combination button following screen will be displayed. Here double click on “????” to add new filter conditions. Need to place value for these filters which will be used by BAdi to decide at runtime which method to call. In our example we are making calculation based on Country so I have taken IN (India) and another filter will be US.
  • 16. Two filters are created. Activate the BADI. Now to play with Filters we need to create another Implementation which will get called based on Country selected by User. Need to create another Implementation which will calculate the result based on US country.
  • 17. Every Implementation needs a class, if we provide same class name t hen this Implementation will inherit the methods of first Implementation which will be useless. Now we have two Enhancement Implementations, having different method implementations one for US and another for IN.
  • 18. Double click on Enhancement Now create new filter for this Implementation
  • 19. For US we have added 100 more to both parameters. Now filters are all ready to be used in Report program.
  • 20. In above screen shot highlighted section shows how to use filters in program.