First of all, I would like to acknowledge and thank Shankar M, author of the following link:-

https://wiki.scn.sap.com/wiki/display/ABAP/To+find+out+User+Exit’s+and+BADI’s+for+Any+Transaction+code

In my post here, I have elucidated the upgrade done on top of the “Custom Program to find out the Function module exits and BADIs associated with a particular Transaction Code”.

I could visualize some scope of enhancing the utility of this Custom Program as:-

1) For the input given as VA03 (Display Sales Order) Transaction code in the selection-screen of the program ‘YMS_USEREXITBADITEST’ as per the above wiki link – it would display only the SMOD Transaction code Enhancement names (say V45A0003) under the Enhancement section as shown below.

Here the missing factor is that the CMOD Transaction code Projects corresponding to these Enhancements are missing, thus forcing one to follow a strenuous time-consuming process in order to infer if any function module exit Z* inlcude is customized or not, by navigating into each of the Enhancements via SMOD Transaction code, using the hot-spot enabled.

2) Similarly the output shows the BADI names corresponding to the Package ‘VA’ of Transaction code Input as VA03, under the Business Add-in section above.

While here, the missing factor is that there is no further information on the Implementation status of these BADIs. This leaves us again with a time-consuming approach to navigate into each of the BADI names and infer the details of their implementation one after the other, using the hot-spot enabled in the above report output – that navigates to SE18 Transaction code.

The above missing factors have been incorporated in a new custom program and hence we would enable SAP Consultants to save a lot of their time in the case of brownfield SAP Support / Implementation Projects with many Customizations / Enhancements in it, as they try to find out the implementation of function module exits & BADIs of any Transaction code.

Output of new Custom Program (ZTEST792) w.r.t

(A): Function module Exits Implementation:

Now in the enhanced version of this report, a new column has been added in the output as CMOD Project Name. So in this case, the Consultant will be able to infer that for VA03 Transaction code, the only Project created is MYPROJ w.r.t Function module exits implementation – while there are around 15 SMOD Enhancements as listed above, thus saves us a lot of time.

Also, when we select the corresponding enhancement V45A0002, which is hot-spot enabled it takes us to the CMOD Transaction code and clearly depicts below the Function module exit status as implemented.

It has a Z-include ZXVVAU04 as shown below.

PFB the custom logic implemented, inside the include ZXVVAU04.

(B): BADIs Implementation:

Under the BADIs (Business Add-in) section, there are two BADIs listed. While for the first one, there is no BADI Implementation done and for the second – the BADI Implementation (YBADITEST) is available.

In addition to the Custom BADI Implementation name, we also find its desctiption, its status and Filter value (if any) in this comprehensive Report output with all these technical details.

Also, hot-spot is enabled on the BADI name BADI_SD_V46H0001, which helps us navigate into SE18 Transaction code as shown below.

Following is the source code of the Program(with inline comments) to find out Function Module Exits & BADIs of Transaction Code:-

REPORT ztest792.

TABLES : tstc,
tadir,
modsapt,
modact,
trdir,
tfdir,
enlfdir,
sxs_attrt,
tstct.

*** Begin of Modification – Maheswaran – 18.10.2016
*DATA : JTAB LIKE TADIR OCCURS 0 WITH HEADER LINE.

* Declaration of Constants
CONSTANTS:
c_saplsexo(10)   TYPE c VALUE ‘SAPLSEXO’,
c_0100(5)        TYPE c VALUE ‘0100’,
c_bdc_cursor(15) TYPE c VALUE ‘BDC_CURSOR’,
c_exn(3)         TYPE c VALUE ‘EXN’,
c_se18(5)        TYPE c VALUE ‘SE18’,
c_g_is_badi(10)  TYPE c VALUE ‘G_IS_BADI’,
c_bdc_okcode(10) TYPE c VALUE ‘BDC_OKCODE’,
c_isspot(10)     TYPE c VALUE ‘=ISSPOT’,
c_g_is_spot(10)  TYPE c VALUE ‘G_IS_SPOT’,
c_space(3)       TYPE c VALUE ‘ ‘,
c_e              TYPE c VALUE ‘E’,
c_x              TYPE c VALUE ‘X’.

* Declaration of Types
TYPES:      BEGIN OF ty_modsapt,
name     TYPE modname,
modtext  TYPE modtext_d,
END OF ty_modsapt,

BEGIN OF ty_jtab_modsapt,
name      TYPE modname,
END OF ty_jtab_modsapt,

BEGIN OF ty_sxs_attrt,
exit_name TYPE exit_def,
text      TYPE cus_text,
END OF ty_sxs_attrt,

BEGIN OF ty_jtab_sxs_attrt,
exit_name TYPE exit_def,
END OF ty_jtab_sxs_attrt,

BEGIN OF ty_tadir,
pgmid      TYPE pgmid,
object     TYPE trobjtype,
member     TYPE modmember,
korrnum    TYPE trkorr_old,
srcsystem  TYPE srcsystem,
author     TYPE responsibl,
srcdep     TYPE repair,
devclass   TYPE devclass,
genflag    TYPE genflag,
edtflag    TYPE edtflag,
cproject   TYPE cproject,
masterlang TYPE masterlang,
versid     TYPE versionid,
paknocheck TYPE paknocheck,
objstablty TYPE char1,
component  TYPE dlvunit,
crelease   TYPE saprelease,
delflag    TYPE objdelflag,
translttxt TYPE translttxt,
created_on TYPE creationdt,
check_date TYPE scc_date,
check_cfg  TYPE scc_cfg,
END OF ty_tadir,

BEGIN OF ty_modact,
name       TYPE cmodname,
member     TYPE modmember,
END OF ty_modact.

* Data declaration
DATA : lt_jtab_tmp       TYPE TABLE OF ty_tadir,
lt_modact         TYPE TABLE OF ty_modact,
lt_modsapt        TYPE TABLE OF ty_modsapt,
jtab              TYPE TABLE OF tadir,
lt_jtab_modsapt   TYPE TABLE OF ty_jtab_modsapt,
lt_jtab_sxs_attrt TYPE TABLE OF ty_jtab_sxs_attrt,
lt_sxs_attrt      TYPE TABLE OF ty_sxs_attrt,
wa_sxs_attrt      TYPE ty_sxs_attrt,
wa_jtab_sxs_attrt TYPE ty_jtab_sxs_attrt,
wa_jtab_modsapt   TYPE ty_jtab_modsapt,
wa_jtab_tmp       TYPE ty_tadir,
wa_modact         TYPE ty_modact,
wa_modsapt        TYPE ty_modsapt.

DATA:  it_impl           TYPE seex_exit_list_tab_type,
it_elf            TYPE STANDARD TABLE OF zelf_header,
wa_impl           LIKE LINE OF it_impl,
wa_elf            LIKE LINE OF it_elf,
lv_exit_name      TYPE exit_def.
*** End of Modification – Maheswaran – 18.10.2016

DATA : field1(30).
DATA : v_devclass LIKE tadir-devclass.
PARAMETERS : p_tcode LIKE tstc-tcode,
p_pgmna LIKE tstc-pgmna.
DATA wa_tadir TYPE tadir.

* Start-of-Selection Event
START-OF-SELECTION.

IF NOT p_tcode IS INITIAL.
SELECT SINGLE * FROM tstc WHERE tcode EQ p_tcode.
ELSEIF NOT p_pgmna IS INITIAL.
tstc-pgmna = p_pgmna.
ENDIF.

IF sy-subrc EQ 0.
SELECT SINGLE * FROM tadir
WHERE pgmid  = ‘R3TR’
AND object   = ‘PROG’
AND obj_name = tstc-pgmna.

MOVE : tadir-devclass TO v_devclass.
IF sy-subrc NE 0.
SELECT SINGLE * FROM trdir
WHERE name = tstc-pgmna.

IF trdir-subc EQ ‘F’.
SELECT SINGLE * FROM tfdir
WHERE pname = tstc-pgmna.

SELECT SINGLE * FROM enlfdir
WHERE funcname = tfdir-funcname.

SELECT SINGLE * FROM tadir
WHERE pgmid = ‘R3TR’
AND object  = ‘FUGR’
AND obj_name EQ enlfdir-area.

MOVE : tadir-devclass TO v_devclass.
ENDIF.
ENDIF.

SELECT * FROM tadir INTO TABLE jtab
WHERE pgmid = ‘R3TR’
AND object IN (‘SMOD’, ‘SXSD’)
AND devclass = v_devclass.

*** Begin of Modification – Maheswaran – 18.10.2016
LOOP AT jtab INTO wa_tadir.
CLEAR wa_jtab_tmp.
wa_jtab_tmp-pgmid       = wa_tadir-pgmid.
wa_jtab_tmp-object      = wa_tadir-object.
wa_jtab_tmp-member      = wa_tadir-obj_name.
wa_jtab_tmp-korrnum     = wa_tadir-korrnum.
wa_jtab_tmp-srcsystem   = wa_tadir-srcsystem.
wa_jtab_tmp-author      = wa_tadir-author.
wa_jtab_tmp-srcdep      = wa_tadir-srcdep.
wa_jtab_tmp-devclass    = wa_tadir-devclass.
wa_jtab_tmp-genflag     = wa_tadir-genflag.
wa_jtab_tmp-edtflag     = wa_tadir-edtflag.
wa_jtab_tmp-cproject    = wa_tadir-cproject.
wa_jtab_tmp-masterlang  = wa_tadir-masterlang.
wa_jtab_tmp-versid      = wa_tadir-versid.
wa_jtab_tmp-paknocheck  = wa_tadir-paknocheck.
wa_jtab_tmp-objstablty  = wa_tadir-objstablty.
wa_jtab_tmp-component   = wa_tadir-component.
wa_jtab_tmp-crelease    = wa_tadir-crelease.
wa_jtab_tmp-delflag     = wa_tadir-delflag.
wa_jtab_tmp-translttxt  = wa_tadir-translttxt.
wa_jtab_tmp-created_on  = wa_tadir-created_on.
wa_jtab_tmp-check_date  = wa_tadir-check_date.
wa_jtab_tmp-check_cfg   = wa_tadir-check_cfg.
APPEND wa_jtab_tmp TO lt_jtab_tmp.

IF wa_tadir-object = ‘SMOD’.
CLEAR wa_jtab_modsapt.
wa_jtab_modsapt-name    = wa_tadir-obj_name.
APPEND wa_jtab_modsapt TO lt_jtab_modsapt.
ELSEIF wa_tadir-object = ‘SXSD’.
CLEAR wa_jtab_sxs_attrt.
wa_jtab_sxs_attrt-exit_name = wa_tadir-obj_name.
APPEND wa_jtab_sxs_attrt TO lt_jtab_sxs_attrt.
ENDIF.
ENDLOOP.

SORT lt_jtab_tmp BY member.
SORT lt_jtab_modsapt BY name.
SORT lt_jtab_sxs_attrt BY exit_name.

SELECT name member FROM modact
INTO TABLE lt_modact
FOR ALL ENTRIES IN lt_jtab_tmp
WHERE member = lt_jtab_tmp-member.
IF sy-subrc = 0.
SORT lt_modact BY member.
ENDIF.

SELECT name modtext FROM modsapt
INTO TABLE lt_modsapt
FOR ALL ENTRIES IN lt_jtab_modsapt
WHERE sprsl = sy-langu
AND name  = lt_jtab_modsapt-name.
IF sy-subrc = 0.
SORT lt_modsapt BY name.
ENDIF.

SELECT exit_name text
INTO TABLE lt_sxs_attrt
FROM sxs_attrt
FOR ALL ENTRIES IN lt_jtab_sxs_attrt
WHERE exit_name = lt_jtab_sxs_attrt-exit_name
AND sprsl = sy-langu.
IF sy-subrc = 0.
SORT lt_sxs_attrt BY exit_name.
ENDIF.

*** End of Modification – Maheswaran – 18.10.2016

SELECT SINGLE * FROM tstct
WHERE sprsl EQ sy-langu
AND tcode EQ p_tcode.

FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
WRITE:/(19) ‘Transaction Code – ‘,
20(20) p_tcode,
45(50) tstct-ttext.

SKIP.

IF NOT jtab[] IS INITIAL.
WRITE:/(130) sy-uline.
FORMAT COLOR COL_HEADING INTENSIFIED ON.

* SORTING THE INTERNAL TABLE
SORT jtab BY object.

DATA : wf_txt(60)     TYPE c,
wf_smod        TYPE i,
wf_badi        TYPE i,
wf_object2(30) TYPE c.

CLEAR : wf_smod, wf_badi , wf_object2.

*GET THE TOTAL SMOD.
LOOP AT jtab INTO wa_tadir.
AT FIRST.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/1 sy-vline,
2 ‘Enhancement/ Business Add-in’,
41 sy-vline ,
42 ‘Description’,
105 sy-vline,
106 ‘CMOD Project Name’,
130 sy-vline.
WRITE:/(130) sy-uline.
ENDAT.

CLEAR wf_txt.
AT NEW object.

*** Begin of Modification – Maheswaran – 18.10.2016
FORMAT COLOR COL_HEADING INTENSIFIED ON.

IF wa_tadir-object = ‘SMOD’.
WRITE:/1   sy-vline,
2   ‘Enhancement’ ,
41  sy-vline ,
42  ‘Description’,
105 sy-vline,
106 ‘Project Name’,
130 sy-vline.

WRITE:/(130) sy-uline.

ELSEIF wa_tadir-object = ‘SXSD’.
WRITE:/1 sy-vline,
2 ‘Business Add-in’,
41 sy-vline ,
42 ‘Description’,
130 sy-vline.

WRITE:/(130) sy-uline.
ENDIF.
*** End of Modification – Maheswaran – 18.10.2016

ENDAT.
CASE wa_tadir-object.
WHEN ‘SMOD’.

*** Begin of Modification – Maheswaran – 18.10.2016
CLEAR wa_modact.
READ TABLE lt_modact INTO wa_modact
WITH KEY member = wa_tadir-obj_name
TRANSPORTING name.
IF sy-subrc <> 0.
CLEAR wa_modact.
ENDIF.

wf_smod = wf_smod + 1.

CLEAR: wf_txt, wa_modsapt.
READ TABLE lt_modsapt INTO wa_modsapt
WITH KEY name = wa_tadir-obj_name
TRANSPORTING modtext.
IF sy-subrc = 0.
wf_txt = wa_modsapt-modtext.
ENDIF.

FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

WHEN ‘SXSD’.
* FOR BADIS
wf_badi = wf_badi + 1 .

CLEAR: wf_txt, wa_sxs_attrt.
READ TABLE lt_sxs_attrt INTO wa_sxs_attrt
WITH KEY exit_name = wa_tadir-obj_name
TRANSPORTING text.
IF sy-subrc = 0.
wf_txt = wa_sxs_attrt-text.
ENDIF.

FORMAT COLOR COL_NORMAL INTENSIFIED ON.
ENDCASE.

AT NEW obj_name.
IF wa_tadir-object = ‘SMOD’.

WRITE:/1   sy-vline,
2   wa_tadir-obj_name HOTSPOT ON,
41  sy-vline ,
42  wf_txt,
105 sy-vline,
106 wa_modact-name,
130 sy-vline.

ELSEIF wa_tadir-object = ‘SXSD’.

FORMAT COLOR COL_POSITIVE INTENSIFIED ON.

WRITE:/1 sy-vline,
2 wa_tadir-obj_name HOTSPOT ON,
41 sy-vline ,
42 wf_txt,
130 sy-vline.

lv_exit_name = wa_tadir-obj_name.

CALL FUNCTION ‘SXL_GET_ALL_ACCORDING_IMPS’
EXPORTING
exit_name  = lv_exit_name
mnt_langu  = ‘E’
TABLES
imps       = it_impl
EXCEPTIONS
no_results = 1
OTHERS     = 2.
IF sy-subrc <> 0.
*              MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
*                       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

IF it_impl IS NOT INITIAL.

WRITE:/(130) sy-uline.

FORMAT COLOR COL_TOTAL INTENSIFIED OFF.

WRITE: /1  sy-vline,
2  ‘Badi Impl. name’,
23 sy-vline ,
24 ‘Badi Impl. Desc.’,
75 sy-vline,
76 ‘Status’,
86 sy-vline,
87 ‘Filter Value’,
130 sy-vline.

WRITE:/(130) sy-uline.

FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

LOOP AT it_impl INTO wa_impl.

WRITE:/1 sy-vline,
2 wa_impl-imp_name,
23 sy-vline ,
24 wa_impl-text,
75 sy-vline.

IF wa_impl-active = c_x.

WRITE : 76 ‘Active’.

ELSE.

WRITE : 76 ‘InActive’.

ENDIF.

WRITE:86 sy-vline,
87 wa_impl-flt_val(43).

WRITE : 130 sy-vline.

ENDLOOP.

ELSE.

WRITE:/(130) sy-uline.

FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

WRITE:/1 sy-vline,
42 ‘No implementation has been done’,
130 sy-vline.

WRITE:/(130) sy-uline.

ENDIF.

ENDIF.

ENDAT.
*** End of Modification – Maheswaran – 18.10.2016

AT END OF object.

WRITE : /(130) sy-uline.

ENDAT.

ENDLOOP.

WRITE:/(130) sy-uline.

SKIP.

FORMAT COLOR COL_TOTAL INTENSIFIED ON.

WRITE:/ ‘No.of Exits:’ , wf_smod.

WRITE:/ ‘No.of BADis:’ , wf_badi.

ELSE.

FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.

WRITE:/(130) ‘No userexits or BADis exist’.

ENDIF.

ELSE.

FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.

WRITE:/(130) ‘Transaction does not exist’.

ENDIF.

AT LINE-SELECTION.

DATA : wf_object TYPE tadir-object.
CLEAR wf_object.
*** Begin of Modification – Maheswaran – 18.10.2016
DATA wa_obj TYPE modact-name.
CLEAR wa_obj.
DATA : lt_bdc TYPE TABLE OF bdcdata,
ls_bdc TYPE bdcdata,
lt_msg TYPE TABLE OF bdcmsgcoll,
wa_opt TYPE ctu_params.

GET CURSOR FIELD field1.
CHECK field1(8) EQ ‘WA_TADIR’.

READ TABLE jtab INTO wa_tadir WITH KEY obj_name = sy-lisel+1(20).
IF sy-subrc = 0.
MOVE wa_tadir-object TO wf_object.
wa_obj = sy-lisel+105(8).
ENDIF.

CASE wf_object.

WHEN ‘SMOD’.

IF wa_obj IS NOT INITIAL.
CALL FUNCTION ‘MOD_COMPONENTS’
EXPORTING
message    = ‘X’
mode       = ‘SHOM’
modname    = wa_obj
p_standard = ‘KUN’.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ELSE.
MESSAGE i000(ztool)
WITH ‘No Project is created for Enhancement’ sy-lisel+1(10).
SET PARAMETER ID ‘MON’ FIELD sy-lisel+1(10).
CALL TRANSACTION ‘SMOD’ AND SKIP FIRST SCREEN.
ENDIF.

WHEN ‘SXSD’.

CLEAR ls_bdc.
MOVE : c_saplsexo TO ls_bdc-program,
c_0100 TO ls_bdc-dynpro,
c_x TO ls_bdc-dynbegin.
APPEND ls_bdc TO lt_bdc.
CLEAR ls_bdc.

MOVE : c_bdc_cursor TO ls_bdc-fnam,
c_g_is_badi TO ls_bdc-fval.
APPEND ls_bdc TO lt_bdc.
CLEAR ls_bdc.

MOVE : c_bdc_okcode TO ls_bdc-fnam,
c_isspot TO ls_bdc-fval.
APPEND ls_bdc TO lt_bdc.
CLEAR ls_bdc.

MOVE : c_g_is_spot TO ls_bdc-fnam,
c_space TO ls_bdc-fval.
APPEND ls_bdc TO lt_bdc.
CLEAR ls_bdc.

MOVE : c_g_is_badi TO ls_bdc-fnam,
c_x TO ls_bdc-fval.
APPEND ls_bdc TO lt_bdc.
CLEAR ls_bdc.

CLEAR wa_opt.

wa_opt-dismode = c_e.
wa_opt-defsize = c_x.

SET PARAMETER ID c_exn FIELD sy-lisel+1(20).
CALL TRANSACTION c_se18 USING lt_bdc
MESSAGES INTO lt_msg
OPTIONS FROM wa_opt.

ENDCASE.
*** End of Modification – Maheswaran – 18.10.2016

 

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply