Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Badis

Former Member
0 Likes
715

hi abapers,

i have a assignment in BADIs and iam just a beginner to it.

Can any one post me basic BADIs document to me, with examples and relevant documentation, so that i can practice.

baleeq ahmed

4 REPLIES 4
Read only

Former Member
0 Likes
610

u'll get from this

http://www.sapdevelopment.co.uk/enhance/enhancehome.htm

Points expecting in the case of helpful.

Shashi

Read only

anversha_s
Active Contributor
Read only

Former Member
0 Likes
610

Hi Mohammad,

Business Add-Ins are a new SAP enhancement technique based on ABAP Objects. They can be inserted into the SAP System to accommodate user requirements too specific to be included in the standard delivery. Since specific industries often require special functions, SAP allows you to predefine these points in your software.

For viewing the standard BADIs in the system, you can go to SE18 transaction. if already a BADI is implemented in some transaction, you can go and view it in SE19 transaction.

In order to enhance a program, a Business Add-In must first be defined. Application developers create an interface for the add-in. Enhancement management takes this interface and generates an adapter class for implementing it, thus opening a path for implementations created by partners or customers. Your developer then creates an instance of the adapter class in the application program and calls the corresponding method at the appropriate time.

Customers can find the enhancements present in their system in the IMG and in the component hierarchy. Whenever they want to use a Business Add-In, they must create their own implementation of the add-in. Customers must first implement methods and user interface enhancements, and then activate their implementations of the enhancement. The enhancement's active components are then called at runtime.

Normally, a Business Add-In contains an interface and other additional components such as function codes for menu enhancements. In some cases, Business Add-Ins also include enhancements for screens. The enhancement, interface, and associated classes generated all lie in the appropriate application development namespace. Business Add-In implementations lie in the respective namespaces of the people who created them.

For e.g I am giving you a BADI example which was written for transaction VF31 to control invoice printing.

The name of the std implementation is 'BADI_INV_PRTDATA' - view it in SE19.

Go to SE19 transaction, create your own BADI in Z_....

It will ask for an definition name and you can give the 'BADI_INV_PRTDATA in it. Activate it.

If you go into the interface tab, there are methods available like:

BADI_INV_PRTDATA where you can write the logic in the methos as follows:

METHOD IF_EX_BADI_INV_PRTDATA~BADI_INV_PRTDATA .

******************

*Requirement 1:*

******************

**BADI activated in order check if the excise invoice has been created for the billing document

**selected.If the excise invoice is not created for that billing document ,and the subsequent

**billing outputs are not displayed or printed.

******************

*Requirement 2:*

******************

**For billing type ZFF2,ZRF2,ZDF2 there are instances where excise invoice for the

**billing document is zero

  • TYPE-POOLS: slis.

DATA: IT_INVOICE TYPE LBBIL_INVOICE,

W_EXNUM TYPE J_1IEXCHDR-EXNUM,

W_EXNUM1 TYPE J_1IEXCHDR-EXNUM,

IT_VBRK TYPE LBBIL_OUTP_DBDATA-VBRK,

LS_FINCHDEL TYPE FINCHDEL,

W_EXBED TYPE J_1IEXCDTL-EXBED,

W_FKART TYPE VBRK-FKART,

W_DELIVERY TYPE VBFA-VBELV,

W_DEPDEL TYPE J_1IRG23D-VBELN,

W_PLANT TYPE VBRP-WERKS.

FIELD-SYMBOLS: <FS_VBRK> TYPE VBRK ,<FS_VBRK1> TYPE VBRK .

LOOP AT IS_BIL_OUTP_DBDATA-VBRK ASSIGNING <FS_VBRK> .

SELECT SINGLE WERKS INTO W_PLANT FROM VBRP WHERE VBELN EQ <FS_VBRK>-VBELN.

IF W_PLANT EQ '1000' OR W_PLANT EQ '2000' OR W_PLANT EQ '3000'.

CLEAR W_EXNUM.

SELECT SINGLE EXNUM INTO W_EXNUM FROM J_1IEXCHDR

WHERE RDOC = <FS_VBRK>-VBELN.

IF SY-SUBRC <> 0.

IF ( <FS_VBRK>-FKART = 'ZFF2' ) OR ( <FS_VBRK>-FKART = 'ZRF2' )

OR ( <FS_VBRK>-FKART = 'ZSTX' ) OR ( <FS_VBRK>-FKART = 'ZGF2' )

OR ( <FS_VBRK>-FKART = 'ZDX2' ) OR ( <FS_VBRK>-FKART = 'ZESX' ).

MESSAGE E000(ZSFL) WITH 'No excise Invoice created for ' <FS_VBRK>-VBELN.

ENDIF.

ENDIF.

IF ( <FS_VBRK>-FKART = 'ZFF2' ) OR ( <FS_VBRK>-FKART = 'ZRF2' )

OR ( <FS_VBRK>-FKART = 'ZSTX' ).

CLEAR: W_EXNUM1,W_EXBED.

SELECT SINGLE EXNUM EXBED INTO (W_EXNUM1, W_EXBED) FROM J_1IEXCDTL

WHERE RDOC2 = <FS_VBRK>-VBELN .

IF W_EXBED = 0 .

MESSAGE E017(ZUSER_EXIT) WITH W_EXNUM1.

ENDIF.

ENDIF.

ELSEIF <FS_VBRK>-FKART EQ 'ZSTX' AND ( W_PLANT EQ '8000' OR W_PLANT EQ '8100' ).

SELECT SINGLE VBELV INTO W_DELIVERY FROM VBFA WHERE VBELN EQ <FS_VBRK>-VBELN AND VBTYP_V = 'J' AND VBTYP_N = 'U'.

IF W_DELIVERY NE SPACE.

SELECT SINGLE VBELN INTO W_DEPDEL FROM J_1IRG23D WHERE VBELN EQ W_DELIVERY.

IF SY-SUBRC <> 0.

MESSAGE E022(ZUSER_EXIT).

ENDIF.

ENDIF.

ENDIF.

ENDLOOP.