0% found this document useful (0 votes)
12 views18 pages

Classic BAdI (09-04-2025)

The document outlines the steps to create multiple implementations of a Business Add-In (BADI) with a method to fetch data from different tables (MARA, VBAK, VBRK) and discusses the differences between user exits, customer exits, and BADIs. It also explains how to find standard BADIs and compares procedural programming with object-oriented programming. The instructions include navigating through various SAP transaction codes and implementing the logic for data retrieval.

Uploaded by

rtsharath4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views18 pages

Classic BAdI (09-04-2025)

The document outlines the steps to create multiple implementations of a Business Add-In (BADI) with a method to fetch data from different tables (MARA, VBAK, VBRK) and discusses the differences between user exits, customer exits, and BADIs. It also explains how to find standard BADIs and compares procedural programming with object-oriented programming. The instructions include navigating through various SAP transaction codes and implementing the logic for data retrieval.

Uploaded by

rtsharath4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

DATE: 09/04/2025

1. Create multiple implementation BADI with get_data method.


Invoke the method at report level using a proxy class and
check the order of implementation execution. (Use same
method for all implementations)
 In first implementation, fetch material data (MARA).
 In second implementation, fetch sales order data (VBAK).
 In third implementation, fetch billing data (VBRK).
2. Create filter BADI?
3. How to find Standard BADI’s? (Try to Explore)
4. Difference between user exit, customer exit and BADI?
5. Difference between procedure oriented and object oriented?

============================================
=========================

1. Create multiple implementation BADI with get_data method.


Invoke the method at report level using a proxy class and
check the order of implementation execution. (Use same
method for all implementations)
 In first implementation, fetch material data (MARA).

Step 1: Navigate to se18.


Step 2: select the radio button badi name. Give name for that after
that go to utilities create classic badi.

Step 3: select the second option in properties tab type. ( Multiple


use )

Step 4: in the interfaces tab. Double click on interface name.


Step 5: give the methos name. Provide the method name, level,
description.

Step 6: Navigate to se19 and click on create.


Step 7: Give the implementation name it will open implementation.
There provide the description.
Step 8: go to interfaces tab and double click on class name.
method ZIF_EX_SHAR_CUSTOM_BADI~DISPLAYTABLERECORDS.

WRITE: 'records of mara'.


select from mara
FIELDS matnr,
mtart,
matkl,
mbrsh
INTO TABLE @DATA(lt_mara) UP TO 20 ROWS.

LOOP AT lt_mara INTO DATA(ls_mara).


write: / ls_mara-matnr,
ls_mara-mtart ,
ls_mara-matkl,
ls_mara-mbrsh.
ENDLOOP.
endmethod.

 In third implementation, fetch billing data (VBRK).


go back to se19. Give the same definition in classical badi and
implement another one. And double click on name of implementing
class.
Step 2: double click on method name and write the logic.

method ZIF_EX_SHAR_CUSTOM_BADI~DISPLAYTABLERECORDS.

SKIP 1.
WRITE: 'implementation 3 reocrds for vbrk'.
SKIP 1.
SELECT from vbrk
FIELDS VBELN,
FKART,
FKTYP,
VBTYP
INTO TABLE @data(lt_vbrk) UP TO 20 ROWS.

LOOP AT lt_vbrk INTO DATA(ls_vbrk).


WRITE: / ls_vbrk-vbeln,
ls_vbrk-FKART,
ls_vbrk-fktyp,
ls_vbrk-vbtyp.

ENDLOOP.
endmethod.

 In second implementation, fetch sales order data (VBAK).


Same procedure as previous.

method ZIF_EX_SHAR_CUSTOM_BADI~DISPLAYTABLERECORDS.

SKIP 1.
WRITE: 'Implementatio 2- records of vbak'.
SKIP 1.
SELECT FROM VBAK
FIELDS VBELN,
ERDAT,
ERZET,
ERNAM
INTO TABLE @DATA(lt_vbak) UP TO 20 rows.

LOOP AT lt_vbak ASSIGNING FIELD-SYMBOL(<fs_vbak>).


WRITE: / <fs_vbak>-vbeln,
<fs_vbak>-erdat,
<fs_vbak>-erzet,
<fs_vbak>-ernam.
ENDLOOP.

endmethod.

Create a program in se38,

*&-----------------------------------------------------------------
----*
*& Report ZSHAR_RP_CUSTOM_BADI

*&-----------------------------------------------------------------
----*
*&

*&-----------------------------------------------------------------
----*
REPORT ZSHAR_RP_CUSTOM_BADI.

DATA : o_ref TYPE REF TO ZIF_EX_SHAR_CUSTOM_BADI.

call METHOD CL_EXITHANDLER=>get_instance


EXPORTING
exit_name = 'ZSHAR_CUSTOM_BADI'
" Business Add-In Definition

CHANGING
instance = o_ref "
Instance
EXCEPTIONS
no_reference = 1 " No
Reference
no_interface_reference = 2 " No
Interface Reference
no_exit_interface = 3 " No Exit
Interface Available
class_not_implement_interface = 4 " Exit Class
Does Not Implement Exit Interface
single_exit_multiply_active = 5 " Multiple
Activation with a Single Exit
cast_error = 6 " Cast Error
exit_not_existing = 7 " Exit does
not exist
data_incons_in_exit_managem = 8 " Data
Consistency in Exit Administration
others = 9
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

o_ref->displaytablerecords( ).
2. Create filter BADI?
3. How to find Standard BADI’s? (Try to Explore)
 We can use SAP class CL_EXITHANDLER. In this class, we have the
method GET_INSTANCE.
1. Navigate to se24. Provide the name cl_exithandler as object
type.
2. In that select GET_INSTANCE method. Put breakpoint as sy-
subrc value.

3. Navigate to MM01 and provide the necessary fields.


After giving all the fields save it. It will navigate to debugging
session. There we can see badi.

 Pass the package name of the program in SE18 transaction code


(click on F4 help of BADI name → new selection → pass the
package name).
1. Navigate to MM01 select the package name
2. Doble click on program name

Goto-> attributes
3. Se18->select badi name radio button and click f4 -
>information system
->select radio button classic badi->give package name.
 Pass the package name of the program in SE84 transaction code
(Enhancements → Business Add-ins → Definition).
4. Difference between user exit, customer exit and BADI?

Customer Exit User Exit BADI


BADI is based on object-
Customer Exit is based User Exit is based on
oriented concepts using
on function modules include programs
classes and interfaces,
and uses transactions written within SAP
implemented via SE18
SMOD and CMOD. standard code.
and SE19.
It also follows a
It follows a procedural It follows an object-
procedural
programming oriented programming
programming
approach. approach.
approach.
Only one
It allows only a single It supports multiple
implementation is
implementation. implementations.
allowed.
It is also less flexible It is highly flexible and
It is less flexible in
and limited to reusable across
terms of enhancement
predefined code different
capabilities.
blocks. implementations.
It is transported It is managed using an
It requires a CMOD
along with the enhancement
project for transport.
development object. implementation object.
It is defined using
It is limited to specific It is inserted directly
enhancement spots
enhancement points into SAP standard
provided in the
defined by SAP. code using includes.
standard.

5. Difference between procedure oriented and object oriented?

Procedural Programming (POP) Object-Oriented Programming (OOP)


Follows a step-by-step approach Uses classes and objects to model real-
using functions. world behavior.
Program divided into objects (instances of
Program divided into functions.
classes).
Supports access modifiers like private,
No access modifiers.
public, protected.
More secure due to abstraction and data
Less secure due to no abstraction.
hiding.
Easy to modify or extend using
Harder to add new features.
inheritance.
Focus on functions. Focus on data and objects.
Supports inheritance (public, private,
No inheritance support.
protected).
Examples: C, BASIC, Pascal Examples: Java, Python, C++

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy