Monday, December 7, 2009

How to Find a BADI/User exit for a Transaction

Run The following Program from se38.
Code:
REPORT ztestdp_badi_find
*-----------------------------------------------------------------------
* Author         : DurgaPrasad                                         *
* Creation Date  : 03 Dec 2009                                         *
* Valid Upto Version SAP r/3 4.7.
* Steps To run this Program:(User Guide);
*.1. Run This prorgam from SE38
* 2. Run your Transaction for which you wanted to find the BADI's
* 3. When your Trsnaction stopped at Break point, check
*    the value of parameter 'EXIT_NAME'.
*    It will show you the BADI for that transaction.
*----------------------------------------------------------------------
* version: ZTESTDP_BADI_FIND v1.0
* For support
*-----------------------------------------------------------------------
* <<< Start of Comment:5005070995  :04.12.2009:

* <<< End   of Comment:5005070995  :04.12.2009:

       NO STANDARD PAGE HEADING LINE-SIZE 255.
DATA:   bdcdata LIKE bdcdata    OCCURS 0 WITH HEADER LINE.
*       messages of call transaction
DATA:   messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
*       error session opened (' ' or 'X')
DATA:   e_group_opened.
*       message texts
TABLES: t100.
START-
OF-SELECTION.


perform bdc_dynpro      using 'SAPLSEOD' '1000'.
perform bdc_field       using 'BDC_CURSOR'
                              'SEOCLASS-CLSNAME'.
perform bdc_field       using 'BDC_OKCODE'
                              '=CIDI'.
perform bdc_field       using 'SEOCLASS-CLSNAME'
                              'CL_EXITHANDLER'.
perform bdc_dynpro      using 'SAPLSEOD' '2000'.
perform bdc_field       using 'BDC_OKCODE'
                              '=OO_PICKUP'.
perform bdc_field       using 'BDC_CURSOR'
                              'DY_0253-CPDNAME(02)'.
perform bdc_dynpro      using 'SAPLSEO_CLEDITOR' '0200'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ED_SET_BREAK'.
perform bdc_dynpro      using 'SAPLSEO_CLEDITOR' '0200'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ED_SET_BREAK'.
perform bdc_dynpro      using 'SAPLSEO_CLEDITOR' '0200'.
perform bdc_field       using 'BDC_OKCODE'
                              '=ED_SET_BREAK'.
perform bdc_dynpro      using 'SAPLSEO_CLEDITOR' '0200'.
perform bdc_field       using 'BDC_OKCODE'
                              '/EWB_BACK'.
perform bdc_dynpro      using 'SAPLSEOD' '2000'.
perform bdc_field       using 'BDC_OKCODE'
                              '=WB_BACK'.
perform bdc_field       using 'BDC_CURSOR'
                              'DY_0253-CPDNAME(02)'.
perform bdc_dynpro      using 'SAPLSEOD' '1000'.
perform bdc_field       using 'BDC_CURSOR'
                              'SEOCLASS-CLSNAME'.
perform bdc_field       using 'BDC_OKCODE'
                              '=WB_BACK'.
perform bdc_field       using 'SEOCLASS-CLSNAME'
                              'CL_EXITHANDLER'.

  
CALL TRANSACTION 'SE24' USING bdcdata
  
mode 'E'
  MESSAGES INTO  messtab.
if sy-subrc = 0.
  
MESSAGE i016(zz) with 'Success' text-004 text-001.
* text-004 Run your Tcode Now
*text-001 Check parameter 'EXIT_NAME' at the Break Point.
"Check the value of parameter 'EXIT_NAME'.
"  It will show you the BADI for that transaction.
  else.
MESSAGE i016(zz) with 'Error.Run Again'.
    
endif.

*perform close_group.


FORM bdc_dynpro USING program dynpro.
  
CLEAR bdcdata.
  bdcdata-
program  = program.
  bdcdata-
dynpro   = dynpro.
  bdcdata-dynbegin = 
'X'.
  
APPEND bdcdata.
ENDFORM.                    "BDC_DYNPRO

*----------------------------------------------------------------------*
*        Insert field                                                  *
*----------------------------------------------------------------------*
FORM bdc_field USING fnam fval.

  
CLEAR bdcdata.
  bdcdata-fnam = fnam.
  bdcdata-fval = fval.
  
APPEND bdcdata.
ENDFORM.                    "BDC_FIELD
 
Run the transaction for which you wanted to find a BADI. When your Transaction stopped at Break point, check    the value of parameter 'EXIT_NAME'.
    It will show you the BADI for that transaction.
 
 
 

 
 
 
Thanks & Regards
Durga  Prasad
 
 
 

No comments: