SAP ABAP - Report Program Capable Of Finding User Exits, Badi's & Enhancements For Any Transaction Or Program.
This report program is very useful to find user exits, badi's and enhancements for any transaction (tcode) or standard program.
SAMPLE PROGRAM
REPORT zuserexit.
TABLES : tstc, tadir, modsapt,
modact, trdir, tfdir, enlfdir, sxs_attrt , tstct.
DATA : jtab LIKE TADIR OCCURS 0 WITH HEADER LINE.
field1(30),
v_devclass LIKE tadir-devclass,
wa_tadir TYPE tadir.
PARAMETERS : p_tcode LIKE tstc-tcode,
p_pgmna LIKE tstc-pgmna .
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.
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:/(105) 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.
WRITE: (105) sy-uline.
ENDAT.
CLEAR wf_txt.
AT NEW object.
IF wa_tadir-object = 'SMOD'.
wf_object2 = 'Enhancement' .
ELSEIF wa_tadir-object = 'SXSD'.
wf_object2 = ' Business Add-in'.
ENDIF.
FORMAT COLOR col_group INTENSIFIED ON.
WRITE:/1 sy-vline,
2 wf_object2,
105 sy-vline.
ENDAT.
CASE wa_tadir-object.
WHEN 'SMOD'.
wf_smod = wf_smod + 1.
SELECT SINGLE modtext INTO wf_txt
FROM MODSAPT
WHERE sprsl = sy-langu
AND name = wa_tadir-obj_name.
FORMAT COLOR col_normal INTENSIFIED OFF.
WHEN 'SXSD'.
* FOR BADI'S
wf_badi = wf_badi + 1 .
SELECT SINGLE text INTO wf_txt
FROM SXS_ATTRT
WHERE sprsl = sy-langu
ANDit_name = wa_tadir-obj_name.
FORMAT COLOR col_normal INTENSIFIED ON.
ENDCASE.
WRITE: /1 sy-vline,
2 wa_tadir-obj_name hotspot on,
41 sy-vline ,
42 wf_txt,
105 sy-vline.
AT END OF object.
WRITE : /(105) sy-uline.
ENDAT.
ENDLOOP.
WRITE: /(105) 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:/(105) 'No userexits or BADis exist'.
ENDIF.
ELSE.
FORMAT COLOR col_negative INTENSIFIED ON.
WRITE:/(105) 'Transaction does not exist'.
ENDIF.
AT LINE-SELECTION.
DATA : wf_object TYPE tadir-object.
CLEAR wf_object.
GET CURSOR FIELD field1.
CHECK field1(8) EQ 'WA_TADIR'.
READ TABLE jtab WITH KEY obj_name = sy-lisel+1(20).
MOVE jtab-object TO wf_object.
CASE wf_object.
WHEN 'SMOD'.
SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).
CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
WHEN 'SXSD'.
SET PARAMETER ID 'EXN' FIELD sy-lisel+1(20).
CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN.
ENDCASE.
THE OUTPUT SCREEN LOOKS LIKE:
MORE PROGRAMS ON REPORT PROGRAMMING:
- BDC To Create Condition Types & Amount For Tcode MEK1.
- Edit / Create Customer Specific Message / Text On Login Screen Via SE61.
- MM - Determine Shelf Life Of Materials.
- Function Module To Verify Valid E-Mail Address.
- Upload the financial documents from a legacy system (excel file) into SAP using transaction code FB01.
- ...Back To Index On Report Programming.
Your suggestions and comments are welcome in this section.
Please mail all your contributions to administrator@abapmadeeasy.com We request you to mention your Name, Designation, Experience & Organization you are working for. Your posts will be verified and posted in this site with your name.
SAMPLE PROGRAM
REPORT zuserexit.
TABLES : tstc, tadir, modsapt,
modact, trdir, tfdir, enlfdir, sxs_attrt , tstct.
DATA : jtab LIKE TADIR OCCURS 0 WITH HEADER LINE.
field1(30),
v_devclass LIKE tadir-devclass,
wa_tadir TYPE tadir.
PARAMETERS : p_tcode LIKE tstc-tcode,
p_pgmna LIKE tstc-pgmna .
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.
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:/(105) 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.
WRITE: (105) sy-uline.
ENDAT.
CLEAR wf_txt.
AT NEW object.
IF wa_tadir-object = 'SMOD'.
wf_object2 = 'Enhancement' .
ELSEIF wa_tadir-object = 'SXSD'.
wf_object2 = ' Business Add-in'.
ENDIF.
FORMAT COLOR col_group INTENSIFIED ON.
WRITE:/1 sy-vline,
2 wf_object2,
105 sy-vline.
ENDAT.
CASE wa_tadir-object.
WHEN 'SMOD'.
wf_smod = wf_smod + 1.
SELECT SINGLE modtext INTO wf_txt
FROM MODSAPT
WHERE sprsl = sy-langu
AND name = wa_tadir-obj_name.
FORMAT COLOR col_normal INTENSIFIED OFF.
WHEN 'SXSD'.
* FOR BADI'S
wf_badi = wf_badi + 1 .
SELECT SINGLE text INTO wf_txt
FROM SXS_ATTRT
WHERE sprsl = sy-langu
ANDit_name = wa_tadir-obj_name.
FORMAT COLOR col_normal INTENSIFIED ON.
ENDCASE.
WRITE: /1 sy-vline,
2 wa_tadir-obj_name hotspot on,
41 sy-vline ,
42 wf_txt,
105 sy-vline.
AT END OF object.
WRITE : /(105) sy-uline.
ENDAT.
ENDLOOP.
WRITE: /(105) 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:/(105) 'No userexits or BADis exist'.
ENDIF.
ELSE.
FORMAT COLOR col_negative INTENSIFIED ON.
WRITE:/(105) 'Transaction does not exist'.
ENDIF.
AT LINE-SELECTION.
DATA : wf_object TYPE tadir-object.
CLEAR wf_object.
GET CURSOR FIELD field1.
CHECK field1(8) EQ 'WA_TADIR'.
READ TABLE jtab WITH KEY obj_name = sy-lisel+1(20).
MOVE jtab-object TO wf_object.
CASE wf_object.
WHEN 'SMOD'.
SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).
CALL TRANSACTION 'SMOD' AND SKIP FIRST SCREEN.
WHEN 'SXSD'.
SET PARAMETER ID 'EXN' FIELD sy-lisel+1(20).
CALL TRANSACTION 'SE18' AND SKIP FIRST SCREEN.
ENDCASE.
THE OUTPUT SCREEN LOOKS LIKE:
MORE PROGRAMS ON REPORT PROGRAMMING:
- BDC To Create Condition Types & Amount For Tcode MEK1.
- Edit / Create Customer Specific Message / Text On Login Screen Via SE61.
- MM - Determine Shelf Life Of Materials.
- Function Module To Verify Valid E-Mail Address.
- Upload the financial documents from a legacy system (excel file) into SAP using transaction code FB01.
- ...Back To Index On Report Programming.
Your suggestions and comments are welcome in this section.
Please mail all your contributions to administrator@abapmadeeasy.com We request you to mention your Name, Designation, Experience & Organization you are working for. Your posts will be verified and posted in this site with your name.