BAdI implementation
Ensure you activate the BAdI if you have not done already.
In your package in ADT, find the enhancement spot ZES_DEMO_ABAP_CALCULATOR. Right-click it and select New BAdI Enhancement Implementation.
Follow the New BAdI Enhancement Implementation wizard:
Add a suitable target package.
Enter the name ZEI_DEMO_ABAP_CALCULATOR and a description.
Ensure the enhancement spot ZES_DEMO_ABAP_CALCULATOR is included in the Enhancement Spot input field.
After creation, the BAdI Enhancement Implementation screen will appear.
Click the Add BAdI Implementation button.
In the Add BAdI Implementation pop-up, enter the following:
BAdI Definition: ZBADI_DEMO_ABAP_CALCULATOR
BAdI Implementation Name: ZBADI_IMPL_DEMO_ABAP_CALC_SUB
In the BAdI Implementation Details section on the right, choose the Implementing Class link.
Follow the New ABAP Class wizard:
Enter the name ZCL_DEMO_ABAP_CALCULATOR_SUBTR and a description.
Ensure the interface ZIF_DEMO_ABAP_CALCULATOR is added to the Interfaces list.
Add the following code and activate the class:
CLASS zcl_demo_abap_calculator_subtr DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
INTERFACES if_badi_interface .
INTERFACES zif_demo_abap_calculator .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_demo_abap_calculator_subtr IMPLEMENTATION.
METHOD zif_demo_abap_calculator~calculate.
result = |{ num1 - num2 }|.
ENDMETHOD.
ENDCLASS.
Serkan AKKAVAK
Computer Engineer BSc
Head of SAP & Software Department
Contact : serkurumsal@yandex.com

0 Comments