TABLES : TSTC,
  TADIR,
  MODSAPT,
  MODACT,
  TRDIR,
  TFDIR,
  ENLFDIR,
  SXS_ATTRT ,
  TSTCT.

DATA : JTAB LIKE TADIR OCCURS 0 WITH HEADER LINE.
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.

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.

* ITAB ı sıralarız

    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.

* Toplam 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'.

*BADi

        wf_badi = wf_badi + 1 .
        SELECT SINGLE TEXT INTO wf_txt
        FROM SXS_ATTRT
        WHERE sprsl = sy-langu
        AND EXIT_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.
 
 
 
Serkan AKKAVAK
Bilgisayar Mühendisi
serkurumsal@yandex.com