Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

*&---------------------------------------------------------------------*
*& Report  zenhancementfinder
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  zenhancementfinder NO STANDARD PAGE HEADING LINE-SIZE 150.

*&---------------------------------------------------------------------*
*& Variables
*&---------------------------------------------------------------------*
DATA : t_jtab TYPE STANDARD TABLE OF tadir,
       wa_jtab TYPE tadir.

DATA : v_devclass TYPE tadir-devclass,
       v_smod TYPE i ,
       v_badi TYPE i ,
       v_object TYPE trobjtype.

TYPES:  BEGIN OF ty_result,
         obj_type       TYPE enhobj-obj_type,
         obj_name       TYPE enhobj-obj_name,
         enhspot        TYPE enhspotobj-enhspot,
         enhname        TYPE enhobj-enhname,
         switch_id TYPE sfw_switch_id,
         state     TYPE  sfw_switchpos,
       END OF ty_result.

TYPES:  BEGIN OF ty_enhnames,
          enhname      TYPE sobj_name,
          main_name    TYPE enhobj-main_name,
       END OF ty_enhnames.
**--
TYPES:  BEGIN OF ty_enhnames_enho,
          enhname      TYPE enhname,
          obj_name     TYPE trobj_name,
          main_type    TYPE trobjtype,
       END OF ty_enhnames_enho.

TYPES:  BEGIN OF ty_es_head_it,
          enhspot       TYPE enhobj-main_name,
       END OF ty_es_head_it.

* Batch Input Table
DATA: t_bdcdata        TYPE STANDARD TABLE OF bdcdata,
      wa_bdcdata       TYPE bdcdata.


DATA:   t_eso_it        TYPE STANDARD TABLE OF enhspotobj,
        t_eso_it_1      TYPE STANDARD TABLE OF enhspotobj,
        t_result        TYPE STANDARD TABLE OF ty_result,
        wa_result       TYPE ty_result,
        t_final         TYPE STANDARD TABLE OF ty_result,
        wa_final        TYPE ty_result,
        t_enhnames      TYPE STANDARD TABLE OF ty_enhnames,
        wa_enhnames     TYPE ty_enhnames,
        t_enhnames_enho TYPE STANDARD TABLE OF ty_enhnames_enho,
        wa_enhnames_enho TYPE ty_enhnames_enho,
        t_es_head_it    TYPE STANDARD TABLE OF ty_es_head_it,
*        wa_es_head_it   TYPE ty_es_head_it,
        t_itab          TYPE STANDARD TABLE OF tadir,
        t_itab_enho     TYPE STANDARD TABLE OF tadir,
        wa_jtab_enho    TYPE tadir,
        t_messtab       TYPE STANDARD TABLE OF bdcmsgcoll.  "#EC *

DATA : wa_eso_it        LIKE LINE OF t_eso_it,
       v_enhname       TYPE enhobj-enhname,
       v_fld           TYPE enhname.

*"A: show all dynpros "E: show dynpro on error only N: do not display dynpro
DATA: v_ctumode TYPE ctu_params-dismode VALUE 'E',
*"S: synchronously *"A: asynchronously *"L: local
      v_cupdate TYPE ctu_params-updmode VALUE 'L'.

**-- Include program names
TYPES: BEGIN OF ty_includes,
         prog TYPE trobj_name,
       END OF ty_includes.

**-- Program ty_content for text download
TYPES: BEGIN OF ty_content,
        line(255) TYPE c,
      END OF ty_content.

**--  Types for enhancement spots
TYPES: BEGIN OF ty_enhspotobj,
         enhspot   TYPE enhspotname,
         version   TYPE r3state,
         obj_type  TYPE trobjtype,
         obj_name  TYPE trobj_name,
         main_type TYPE trobjtype,
         main_name TYPE eu_aname,
       END OF ty_enhspotobj.

**--
TYPES: BEGIN OF ty_enho_obj,
         obj_name TYPE trobjtype,
         devclass TYPE devclass,
       END OF ty_enho_obj.

**--
TYPES: BEGIN OF ty_switch,
         switch_id TYPE sfw_switch_id,
         devclass  TYPE packname,
       END OF ty_switch.
**--
TYPES: BEGIN OF ty_switch_state,
         switch_id TYPE sfw_switch_id,
         state     TYPE  sfw_switchpos,
       END OF ty_switch_state.


**-- Names of function modules used within programmes
DATA: t_prog_includes TYPE STANDARD TABLE OF  ty_includes,
      wa_prog_includes TYPE ty_includes.

**-- Internal table for enhancement spots
DATA: t_enhspotobj TYPE STANDARD TABLE OF  ty_enhspotobj,
      wa_enhspotobj    TYPE ty_enhspotobj,
**-- Development classes for implimentation
      t_enho_obj TYPE STANDARD TABLE OF  ty_enho_obj,
      wa_enho_obj TYPE ty_enho_obj,
**--  Switch
      t_switch   TYPE STANDARD TABLE OF ty_switch,
      wa_switch   TYPE ty_switch,
**-- Switch state
      t_switch_state TYPE STANDARD TABLE OF ty_switch_state,
      wa_switch_state TYPE ty_switch_state.

**-- Work areas
DATA: wa_tstc TYPE tstc,
      wa_tstct TYPE tstct,
      wa_tlibg TYPE tlibg,
      wa_tlibt TYPE tlibt,
      wa_tdevc TYPE tdevc,
      wa_tadir TYPE tadir,
      wa_trdir TYPE trdir,
      wa_tfdir TYPE tfdir,
      wa_enlfdir TYPE enlfdir,
      wa_modsapt TYPE modsapt,
      wa_sxs_attrt TYPE sxs_attrt.

FIELD-SYMBOLS : %LTfs_eso%GT TYPE enhspotobj,
                %LTfs_enhspotobj%GT TYPE ty_enhspotobj.
**--**--
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-036.
PARAMETERS : p_tcode TYPE tstc-tcode, " OBLIGATORY,
             p_dev TYPE devclass ,
             p_fun TYPE tlibg-area.

*SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
PARAMETERS : p_exit RADIOBUTTON GROUP g1 USER-COMMAND u1,
             p_espot RADIOBUTTON GROUP g1.
*SELECTION-SCREEN END OF BLOCK b2.

*SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME.

SELECTION-SCREEN BEGIN OF LINE .
**--
SELECTION-SCREEN POSITION 5.
PARAMETERS : p_prog RADIOBUTTON GROUP g2 MODIF ID sc1.      "#EC *
SELECTION-SCREEN COMMENT 8(20) text-001 FOR FIELD p_prog MODIF ID sc1.
SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN BEGIN OF LINE .
**--
SELECTION-SCREEN POSITION 5.
PARAMETERS :  p_devl RADIOBUTTON GROUP g2 MODIF ID sc1.     "#EC *
SELECTION-SCREEN COMMENT 8(30) text-002 FOR FIELD p_devl MODIF ID sc1.
SELECTION-SCREEN END OF LINE.
*SELECTION-SCREEN END OF BLOCK b3.

SELECTION-SCREEN END OF BLOCK b1.
**--
AT SELECTION-SCREEN.
  IF ( p_tcode IS INITIAL AND
       p_dev   IS INITIAL AND
       p_fun   IS INITIAL ) OR
     ( NOT p_tcode IS INITIAL AND
       NOT p_dev   IS INITIAL AND
       NOT p_fun  IS INITIAL ) OR
      ( NOT p_tcode IS INITIAL AND
       NOT p_dev   IS INITIAL ) OR
      ( NOT p_dev   IS INITIAL AND
         NOT p_fun  IS INITIAL ) OR
      ( NOT p_tcode IS INITIAL AND
        NOT p_fun   IS INITIAL ) .
**-- Enter either Tcode or Package or Function group
    MESSAGE e001(00) WITH text-003.
  ENDIF.

**-- Tcode validation
  IF NOT p_tcode IS INITIAL.
    SELECT SINGLE * FROM tstc INTO wa_tstc
     WHERE tcode EQ p_tcode.
    IF sy-subrc %LT%GT 0.
**-- Transaction Code Does Not Exist
      MESSAGE e001(00) WITH text-004.
    ENDIF.
  ENDIF.

**-- Package validation
  IF NOT p_dev IS INITIAL.
    SELECT SINGLE * FROM tdevc INTO wa_tdevc
     WHERE devclass EQ p_dev.
    IF sy-subrc %LT%GT 0.
**-- Package Does Not Exist
      MESSAGE e001(00) WITH text-005.
    ENDIF.
  ENDIF.

**-- Function group validation
  IF NOT p_fun IS INITIAL.
    SELECT SINGLE * FROM tlibg INTO wa_tlibg
     WHERE area EQ p_fun.
    IF sy-subrc %LT%GT 0.
**-- Function group Does Not Exist
      MESSAGE e001(00) WITH text-021.
    ENDIF.
**--
    SELECT SINGLE *
      FROM tlibt INTO wa_tlibt
      WHERE area = p_fun AND
            spras = sy-langu.
  ENDIF.


**--
AT SELECTION-SCREEN OUTPUT.
**--
  LOOP AT SCREEN.
    IF p_espot = 'X'.
      IF screen-group1 = 'SC1'.
*        screen-INVISIBLE = '0'.
        screen-input = '1'.
        MODIFY SCREEN.
      ENDIF.
    ELSE.
      IF screen-group1 = 'SC1'.
*        screen-INVISIBLE = '1'.
        screen-input = '0'.
        MODIFY SCREEN.
      ENDIF.
    ENDIF.
  ENDLOOP.
**--
START-OF-SELECTION.
**--
  IF p_exit = 'X'.
**--
    PERFORM f_fuehtiwedoctroegakcap.

  ELSE.
    IF p_prog = 'X' AND
      ( NOT p_tcode IS INITIAL OR
        NOT p_fun IS INITIAL ) .
**--
      PERFORM ftnemecnahenybmargorpeman.

    ELSEIF p_devl = 'X' OR
           ( p_prog = 'X' AND
             NOT p_dev IS INITIAL )  OR
           ( NOT p_fun IS INITIAL ).
**--
      PERFORM ftnemecnahenyegakcapeman.

    ENDIF.

  ENDIF.

**-- Take the user to SE19 for the Enhancement that was selected.
AT LINE-SELECTION.
**--
  CLEAR: v_fld,
         v_enhname.
**--
  GET CURSOR FIELD v_fld VALUE v_enhname.
  IF v_fld = 'WA_FINAL-ENHNAME'.
    IF v_enhname IS NOT INITIAL.
      PERFORM fbdc_dynpro      USING 'SAPLSEXO' '0120'.
      PERFORM fbdc_field       USING 'BDC_OKCODE' '=IMP_SHOW'.
      PERFORM fbdc_field       USING 'BDC_CURSOR' 'G_ENHNAME'.
      PERFORM fbdc_field       USING 'G_IS_NEW_1' 'X'.
      PERFORM fbdc_field       USING 'G_ENHNAME'  v_enhname.
      PERFORM fbdc_field       USING 'G_IS_NEW_2' 'X'.
      PERFORM fbdc_transaction USING 'SE19'.
    ENDIF.
  ELSEIF v_fld = 'WA_FINAL-ENHSPOT'.
    PERFORM fbdc_dynpro      USING 'SAPLSEXO' '0100'.
    PERFORM fbdc_field       USING 'BDC_OKCODE' '=SHOW'.
    PERFORM fbdc_field       USING 'BDC_CURSOR' 'G_ENHSPOTNAME'.
    PERFORM fbdc_field       USING 'G_IS_SPOT' 'X'.
    PERFORM fbdc_field       USING 'G_ENHSPOTNAME'  sy-lisel+1(29).
    PERFORM fbdc_transaction USING 'SE18'.
  ELSEIF v_fld(7) EQ 'WA_JTAB'.

    READ TABLE t_jtab INTO wa_jtab WITH KEY obj_name = sy-lisel+1(20).
    MOVE wa_jtab-object TO v_object.

    CASE v_object.
      WHEN 'SMOD'.
        SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).

        CALL TRANSACTION 'SMOD' AND SKIP FIRST   SCREEN.
      WHEN 'SXSD'.

        PERFORM fbdc_dynpro      USING 'SAPLSEXO' '0100'.
        PERFORM fbdc_field       USING 'BDC_OKCODE' '=ISSPOT'.
        PERFORM fbdc_field       USING 'BDC_CURSOR' 'G_IS_BADI'.
        PERFORM fbdc_field       USING 'G_IS_BADI' 'X'.

        PERFORM fbdc_dynpro      USING 'SAPLSEXO' '0100'.
        PERFORM fbdc_field       USING 'BDC_OKCODE' '=SHOW'.
        PERFORM fbdc_field       USING 'G_BADINAME'  sy-lisel+1(29).

        PERFORM fbdc_transaction USING 'SE18'.
    ENDCASE.
  ENDIF.

END-OF-SELECTION.
  REFRESH: t_result,
           t_final,
           t_enhnames,
           t_es_head_it,
           t_itab,
           t_bdcdata,
           t_messtab.

  FREE: t_result,
        t_final,
        t_enhnames,
        t_es_head_it,
        t_itab,
        t_bdcdata,
        t_messtab.
**--
*&---------------------------------------------------------------------*
*&      Form  f_fuehtiwedoctroegakcap
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --%GT  p1        text
*  %LT--  p2        text
*----------------------------------------------------------------------*
FORM f_fuehtiwedoctroegakcap.

**--
  IF NOT p_tcode IS INITIAL.
**-- Validate Transaction Code
    SELECT SINGLE * FROM tstc INTO wa_tstc
     WHERE tcode EQ p_tcode.
**-- Find Repository Objects for transaction code
    IF sy-subrc EQ 0.
      SELECT SINGLE * FROM tadir INTO wa_tadir
       WHERE pgmid = 'R3TR'
         AND object = 'PROG'
         AND obj_name = wa_tstc-pgmna.

      IF sy-subrc NE 0.
        SELECT SINGLE * FROM tadir INTO wa_tadir
         WHERE pgmid  = 'R3TR'
           AND object = 'TRAN'
           AND obj_name = p_tcode.
      ENDIF.
**--
      MOVE : wa_tadir-devclass TO v_devclass.
      IF sy-subrc NE 0.
        SELECT SINGLE * FROM trdir INTO wa_trdir
         WHERE name = wa_tstc-pgmna.
        IF wa_trdir-subc EQ 'F'.
          SELECT SINGLE * FROM tfdir INTO wa_tfdir
           WHERE pname = wa_tstc-pgmna.                     "#EC *

          SELECT SINGLE * FROM enlfdir INTO wa_enlfdir
           WHERE funcname = wa_tfdir-funcname.

          SELECT SINGLE * FROM tadir INTO wa_tadir
           WHERE pgmid = 'R3TR'
             AND object = 'FUGR'
             AND obj_name = wa_enlfdir-area.

          MOVE : wa_tadir-devclass TO v_devclass.
        ENDIF.
      ENDIF.
    ELSE.
      FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
      WRITE:/(105) text-006.
    ENDIF.
  ELSEIF NOT p_dev IS INITIAL.
**--
    MOVE : p_dev TO v_devclass.
  ELSEIF NOT p_fun IS INITIAL.
**--
    SELECT SINGLE * FROM tadir INTO wa_tadir
    WHERE pgmid = 'R3TR'
      AND object = 'FUGR'
      AND obj_name = p_fun.

    MOVE : wa_tadir-devclass TO v_devclass.
  ENDIF.


**--
* Find SAP Modifactions
  SELECT * FROM tadir
    INTO TABLE t_jtab
   WHERE pgmid = 'R3TR'
     AND object IN ('SMOD','SXSD')
     AND devclass = v_devclass.

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

  FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
  IF NOT p_tcode IS INITIAL.
    WRITE:/(19) text-007,
          20(20) p_tcode,
          45(50) wa_tstct-ttext.
  ELSEIF NOT p_dev IS INITIAL.
    WRITE:/(19) text-012,
          20(20) p_dev.
  ELSEIF NOT p_fun IS INITIAL.
    WRITE:/(15) text-023,
          20(20) p_fun,
          45(50) wa_tlibt-areat.
  ENDIF.
  SKIP.

  IF NOT t_jtab[] IS INITIAL.
    WRITE:/(105) sy-uline.
    FORMAT COLOR COL_HEADING INTENSIFIED ON.
    WRITE:/1 sy-vline,
           2 text-008,
           41 sy-vline,
           42 text-009,
           105 sy-vline.
    WRITE:/(105) sy-uline.
    LOOP AT t_jtab INTO wa_jtab.
      AT NEW object.
        IF wa_jtab-object = 'SMOD'.
          FORMAT COLOR COL_GROUP INTENSIFIED ON.
          WRITE:/1 sy-vline,
              2 'Enhancement'(024),
             105 sy-vline.
        ELSEIF wa_jtab-object = 'SXSD'.
          FORMAT COLOR COL_GROUP INTENSIFIED ON.
          WRITE:/1 sy-vline,
              2  text-025,
             105 sy-vline.
        ENDIF.
      ENDAT.

      CASE wa_jtab-object.
        WHEN 'SMOD'.
          v_smod = v_smod + 1.

          SELECT SINGLE * FROM modsapt INTO wa_modsapt
           WHERE sprsl = sy-langu
             AND name = wa_jtab-obj_name.
          FORMAT COLOR COL_NORMAL INTENSIFIED ON.

          WRITE:/1 sy-vline,
                 2 wa_jtab-obj_name HOTSPOT ON,
                41 sy-vline ,
                42 wa_modsapt-modtext,
                105 sy-vline.


        WHEN 'SXSD'.
*       For BADis
          v_badi = v_badi + 1 .
          SELECT SINGLE * FROM sxs_attrt INTO wa_sxs_attrt
                            WHERE sprsl     = sy-langu
                              AND exit_name = wa_jtab-obj_name.
          FORMAT COLOR COL_NORMAL INTENSIFIED ON.

          WRITE:/1 sy-vline,
                 2 wa_jtab-obj_name HOTSPOT ON,
                41 sy-vline ,
                42 wa_sxs_attrt-text,
                105 sy-vline.




      ENDCASE.

      AT END OF object.
        WRITE : /(105) sy-uline.
      ENDAT.



    ENDLOOP.
    WRITE:/(105) sy-uline.
    DESCRIBE TABLE t_jtab.
    SKIP.

    FORMAT COLOR COL_TOTAL INTENSIFIED ON.
    WRITE:/ text-010,  v_smod.
    WRITE:/  text-019, v_badi.
  ELSE.
    FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
    WRITE:/(95) text-011.
  ENDIF.

ENDFORM.                    " f_fuehtiwedoctroegakcap
*&---------------------------------------------------------------------*
*&      Form  ftnemecnahenybmargorpeman
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --%GT  p1        text
*  %LT--  p2        text
*----------------------------------------------------------------------*
FORM ftnemecnahenybmargorpeman .


  IF NOT p_tcode IS INITIAL.

    SELECT SINGLE * FROM tstc INTO wa_tstc
     WHERE tcode EQ p_tcode.

  ELSEIF p_fun IS NOT INITIAL.
**--
    SELECT SINGLE * FROM enlfdir INTO wa_enlfdir
       WHERE area = p_fun.                                  "#EC *
    IF sy-subrc = 0.
      SELECT SINGLE * FROM tfdir INTO wa_tfdir
       WHERE funcname = wa_enlfdir-funcname.
      IF sy-subrc = 0.
**-- move the value to tstc-PGMNA
        wa_tstc-pgmna = wa_tfdir-pname.
      ENDIF.
    ENDIF.
  ENDIF.

  IF sy-subrc EQ 0.

    IF NOT wa_tstc-pgmna IS INITIAL.
**-- Select the include program's which are there in the main program
      PERFORM f_find_include_programs USING wa_tstc-pgmna.
**-- Append the main program also into internal table t_prog_includes
      wa_prog_includes-prog = wa_tstc-pgmna.
      APPEND wa_prog_includes TO t_prog_includes.
**--
      IF NOT t_prog_includes[] IS INITIAL.
**-- Select the enhancement spot's data from ENHSPOTOBJ
**-- All the includes in itab t_prog_includes
        SELECT enhspot
               version
               obj_type
               obj_name
               main_type
               main_name
          INTO TABLE t_enhspotobj
          FROM enhspotobj
          FOR ALL ENTRIES IN t_prog_includes
          WHERE obj_name = t_prog_includes-prog AND
                version  = 'A'.
        IF NOT t_enhspotobj[] IS INITIAL.
**--
          SELECT SINGLE * FROM tstct INTO wa_tstct
           WHERE sprsl EQ sy-langu
             AND tcode EQ p_tcode.

          FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
**-- Transaction Code
          IF p_fun IS INITIAL.
            WRITE:/1 text-013,
                   25(20) p_tcode,
                   48(50) wa_tstct-ttext.
          ELSE.
            WRITE:/1 text-022,
                   35(20) p_fun,
                   55(50) wa_tlibt-areat.
          ENDIF.
          SKIP.

**-- Genral information.
          FORMAT COLOR COL_HEADING INTENSIFIED ON.
          WRITE:/ 'To see Enhancement spot/Implementation in detail, please click on values under column'(026), text-020.


          WRITE:/(150) sy-uline.
          FORMAT COLOR COL_HEADING INTENSIFIED ON.
          WRITE:/1 sy-vline,
                 2 text-015,
                34 sy-vline,
                36 text-016,
                64 sy-vline,
                66 text-014,
                100 sy-vline,
               101 'Switch'(027),
               132 sy-vline,
               133 'Switch State'(028),
               150 sy-vline.

          WRITE:/(150) sy-uline.
        ELSE.

          WRITE: / text-017.
        ENDIF.    "IF NOT t_enhspotobj[] IS INITIAL
      ENDIF. " IF not t_prog_includes[] is initial.
    ELSE.
      WRITE: / text-017  .
    ENDIF.
  ELSE.
    FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
    WRITE:/(95) text-004.
  ENDIF.    "IF sy-subrc EQ 0

**---

**--
  IF NOT t_enhspotobj[] IS INITIAL.
**--
    LOOP AT t_enhspotobj ASSIGNING %LTfs_enhspotobj%GT.
      wa_result-enhspot = %LTfs_enhspotobj%GT-enhspot.
      APPEND wa_result TO t_result.
      CLEAR wa_result.
    ENDLOOP.

    IF NOT t_result[] IS INITIAL.
**--
      DELETE ADJACENT DUPLICATES FROM t_result.
**--
      SORT t_enhspotobj BY enhspot.
**--
      LOOP AT t_result INTO wa_result.
***--
        READ TABLE t_enhspotobj INTO wa_enhspotobj WITH KEY enhspot = wa_result-enhspot
                                     BINARY SEARCH.
        IF sy-subrc = 0.
          wa_result-obj_name = wa_enhspotobj-obj_name.
          wa_result-obj_type = wa_enhspotobj-main_type. " obj_type.
        ENDIF.
        MODIFY t_result FROM wa_result.
        CLEAR wa_result.
      ENDLOOP.
**--
      SELECT enhspot
        INTO TABLE t_es_head_it
        FROM enhspotheader
         FOR ALL ENTRIES IN t_result
       WHERE enhspot = t_result-enhspot
         AND   version = 'A'.
      IF sy-subrc = 0.
**-- Get the enhancement id data from ENHOBJ
        SELECT enhname
               main_name
          APPENDING TABLE t_enhnames
          FROM enhobj
           FOR ALL ENTRIES IN t_es_head_it
         WHERE main_type = 'ENHS'
           AND main_name = t_es_head_it-enhspot.
        IF sy-subrc = 0.
**--
          SORT t_enhnames BY main_name.
          DELETE ADJACENT DUPLICATES FROM t_enhnames COMPARING enhname main_name.
**-- Get the development calss for the enhacement spots & implimentation
          SELECT obj_name
                 devclass
            INTO TABLE t_enho_obj
            FROM tadir
            FOR ALL ENTRIES IN t_enhnames
            WHERE obj_name = t_enhnames-enhname AND
                  object   = 'ENHO'.
          IF sy-subrc = 0.
**-- Get the switch details
            SELECT switch_id
                   devclass
              INTO TABLE  t_switch
              FROM sfw_package
              FOR ALL ENTRIES IN t_enho_obj
              WHERE devclass = t_enho_obj-devclass.
            IF sy-subrc = 0.
**-- Get the switch status
              SELECT switch_id
                     state
                INTO TABLE  t_switch_state
                FROM sfw_switch_state
                FOR ALL ENTRIES IN t_switch
                WHERE  switch_id = t_switch-switch_id.
            ENDIF.
          ENDIF.
**--
          LOOP AT t_result INTO wa_result.
            wa_final-obj_type  = wa_result-obj_type.
            wa_final-obj_name  = wa_result-obj_name.
            wa_final-enhspot   = wa_result-enhspot.
            LOOP AT t_enhnames INTO wa_enhnames WHERE main_name = wa_result-enhspot.
**-- Populate the switch
              READ TABLE t_enho_obj INTO wa_enho_obj WITH KEY obj_name = wa_enhnames-enhname."#EC *
              IF sy-subrc = 0.
                READ TABLE t_switch INTO wa_switch WITH KEY devclass = wa_enho_obj-devclass.
                IF sy-subrc = 0.
                  READ TABLE t_switch_state INTO wa_switch_state WITH KEY switch_id = wa_switch-switch_id.
                  IF sy-subrc = 0.
                    wa_final-switch_id = wa_switch_state-switch_id.
                    wa_final-state     = wa_switch_state-state.
                  ENDIF.
                ENDIF.
              ENDIF.
**--
              wa_final-enhname  =  wa_enhnames-enhname.
              APPEND wa_final TO t_final.
            ENDLOOP.
            CLEAR wa_final.
          ENDLOOP.
        ENDIF.
      ENDIF.
    ENDIF.
**--
**--
    LOOP AT t_final INTO wa_final.
      FORMAT COLOR COL_NORMAL INTENSIFIED ON.
      WRITE: /1 sy-vline,
              2 wa_final-enhspot HOTSPOT ON,
              34 sy-vline.
**--
      CASE  wa_final-obj_type.
        WHEN 'REPS' OR 'PROG'.
          WRITE:  36 'Source Code Enhancement'(029).
        WHEN 'INTF' OR 'SXSD'.
          WRITE:  36 'BADI Enhancement'(030).
        WHEN 'FUNC' OR 'FUGR' .
          WRITE:  36 'Function group Enhancement'(031).
        WHEN 'CLAS'.
          WRITE:  36 'Class Enhancement'(032).
        WHEN OTHERS.
          WRITE:  36 wa_final-obj_type.
      ENDCASE.
**--
      WRITE:  64 sy-vline,
              66 wa_final-enhname HOTSPOT ON,
             100 sy-vline,
             101 wa_final-switch_id,
             132 sy-vline.
**--
      CASE wa_final-state.
        WHEN 'T'.
          WRITE 133 'On'(033).
        WHEN 'S'.
          WRITE 133 'Stand-by'(034).
        WHEN 'F'.
          WRITE 133 'Off'(035).
      ENDCASE.

      WRITE: 150 sy-vline.

    ENDLOOP.
    WRITE:/(150) sy-uline.

  ENDIF.

ENDFORM.                    " ftnemecnahenybmargorpeman
*&---------------------------------------------------------------------*
*&      Form  f_FIND_INCLUDE_PROGRAMS
*&---------------------------------------------------------------------*
*       Desc: Get the include names into internal table
*----------------------------------------------------------------------*
FORM f_find_include_programs  USING    ip_tstc_pgmna TYPE any.

  DATA: l_fip_prog(255),
        l_tail(255).                                        "#EC *

*--- Lines for include
  DATA: lt_inc_lines  TYPE STANDARD TABLE OF ty_content,
        lwa_inc_lines TYPE ty_content.

**-- Read ABAP
  READ REPORT ip_tstc_pgmna INTO lt_inc_lines.

**-- Examine each line of ABAP
  LOOP AT lt_inc_lines INTO lwa_inc_lines.
**-- find include programs.
    IF lwa_inc_lines(1) = '*' OR lwa_inc_lines IS INITIAL.
      CONTINUE.
    ENDIF.

    TRANSLATE lwa_inc_lines-line TO UPPER CASE.
    SHIFT lwa_inc_lines-line UP TO 'INCLUDE'.

    IF ( lwa_inc_lines-line(7) EQ 'INCLUDE' ) OR
       ( lwa_inc_lines-line(7) EQ 'INCLUDE' )
    AND lwa_inc_lines-line+8(9) NE space
    AND sy-tabix %LT%GT 1.
      l_fip_prog = lwa_inc_lines-line+8(64).
      SPLIT l_fip_prog AT '.' INTO l_fip_prog l_tail.
**-       Append program name to list of include programs
      SELECT SINGLE * FROM trdir INTO wa_trdir WHERE name EQ l_fip_prog.
      CHECK sy-subrc EQ 0.
      wa_prog_includes-prog = l_fip_prog.
      APPEND wa_prog_includes TO t_prog_includes.
*--- Recursively look for other includes.
      PERFORM f_find_include_programs USING l_fip_prog.
    ENDIF.
  ENDLOOP.

ENDFORM.                    " f_FIND_INCLUDE_PROGRAMS
*&---------------------------------------------------------------------*
*&      Form  ftnemecnahenyegakcapeman
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --%GT  p1        text
*  %LT--  p2        text
*----------------------------------------------------------------------*
FORM ftnemecnahenyegakcapeman .

  IF NOT p_tcode IS INITIAL.
**--
    SELECT SINGLE * FROM tstc INTO wa_tstc
     WHERE tcode EQ p_tcode.
    IF sy-subrc EQ 0.
      SELECT SINGLE * FROM tadir INTO wa_tadir
       WHERE pgmid = 'R3TR'
         AND object = 'PROG'
         AND obj_name = wa_tstc-pgmna.

      MOVE : wa_tadir-devclass TO v_devclass.

      IF sy-subrc NE 0.
        SELECT SINGLE * FROM trdir INTO wa_trdir
         WHERE name = wa_tstc-pgmna.

        IF wa_trdir-subc EQ 'F'.

          SELECT SINGLE * FROM tfdir INTO wa_tfdir
           WHERE pname = wa_tstc-pgmna.                     "#EC *

          SELECT SINGLE * FROM enlfdir INTO wa_enlfdir
           WHERE funcname = wa_tfdir-funcname.

          SELECT SINGLE * FROM tadir INTO wa_tadir
           WHERE pgmid = 'R3TR'
             AND object = 'FUGR'
             AND obj_name EQ wa_enlfdir-area.

          MOVE : wa_tadir-devclass TO v_devclass.
        ENDIF.    "IF trdir-subc EQ 'F'
      ENDIF.    "IF sy-subrc NE 0
    ELSE.
      FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
      WRITE:/(95) text-006.
    ENDIF.
**--
    PERFORM get_from_tadir.

  ELSEIF NOT p_dev IS INITIAL.
**--
    v_devclass = p_dev.
    PERFORM get_from_tadir.

  ELSEIF NOT p_fun IS INITIAL.

**--
    SELECT SINGLE * FROM tadir INTO wa_tadir
    WHERE pgmid = 'R3TR'
      AND object = 'FUGR'
      AND obj_name = p_fun.

    MOVE : wa_tadir-devclass TO v_devclass.
**--
    PERFORM get_from_tadir.
  ENDIF.    "IF sy-subrc EQ 0

**--***--
  LOOP AT t_eso_it ASSIGNING %LTfs_eso%GT.
    wa_result-enhspot = %LTfs_eso%GT-enhspot.
    APPEND wa_result TO t_result.
    CLEAR wa_result.
  ENDLOOP.

  IF NOT t_result[] IS INITIAL.
    DELETE ADJACENT DUPLICATES FROM t_result.

    SORT t_itab BY obj_name.
    LOOP AT t_result INTO wa_result.
      READ TABLE t_itab  INTO wa_jtab WITH KEY obj_name  =  wa_result-enhspot
                                   BINARY SEARCH.
      IF sy-subrc = 0.
        wa_result-obj_name  =  wa_jtab-obj_name.
        READ TABLE t_eso_it INTO wa_eso_it WITH KEY enhspot = wa_jtab-obj_name+0(30)
                                     BINARY SEARCH.
        IF sy-subrc = 0.
          wa_result-obj_type = wa_eso_it-obj_type.
        ENDIF.
        MODIFY t_result FROM wa_result.
        CLEAR wa_result.
      ENDIF.
    ENDLOOP.

    SELECT enhspot
      INTO TABLE t_es_head_it
      FROM enhspotheader
       FOR ALL ENTRIES IN t_result
     WHERE enhspot = t_result-enhspot
       AND   version = 'A'.

    IF sy-subrc = 0.
      SELECT enhname
             main_name
        APPENDING TABLE t_enhnames
        FROM enhobj
         FOR ALL ENTRIES IN t_es_head_it
       WHERE main_type = 'ENHS'
         AND main_name = t_es_head_it-enhspot.
      IF sy-subrc = 0.
        SORT t_enhnames BY main_name.
        DELETE ADJACENT DUPLICATES FROM t_enhnames COMPARING enhname main_name.
**-- Get the development calss for the enhacement spots & implimentation
        SELECT obj_name
               devclass
          INTO TABLE t_enho_obj
          FROM tadir
          FOR ALL ENTRIES IN t_enhnames
          WHERE obj_name = t_enhnames-enhname AND
                object   = 'ENHO'.
        IF sy-subrc = 0.
**-- Get the switch details
          SELECT switch_id
                 devclass
            INTO TABLE  t_switch
            FROM sfw_package
            FOR ALL ENTRIES IN t_enho_obj
            WHERE devclass = t_enho_obj-devclass.
          IF sy-subrc = 0.
**-- Get the switch status
            SELECT switch_id
                   state
              INTO TABLE  t_switch_state
              FROM sfw_switch_state
              FOR ALL ENTRIES IN t_switch
              WHERE  switch_id = t_switch-switch_id.
          ENDIF.
        ENDIF.
**--
        LOOP AT t_result INTO wa_result.
          wa_final-obj_type  = wa_result-obj_type.
          wa_final-obj_name  = wa_result-obj_name.
          wa_final-enhspot   = wa_result-enhspot.
          LOOP AT t_enhnames INTO wa_enhnames WHERE main_name = wa_result-enhspot.
**-- Populate the switch
            READ TABLE t_enho_obj INTO wa_enho_obj WITH KEY obj_name = wa_enhnames-enhname."#EC *
            IF sy-subrc = 0.
              READ TABLE t_switch INTO wa_switch WITH KEY devclass = wa_enho_obj-devclass.
              IF sy-subrc = 0.
                READ TABLE t_switch_state INTO wa_switch_state WITH KEY switch_id = wa_switch-switch_id.
                IF sy-subrc = 0.
                  wa_final-switch_id = wa_switch_state-switch_id.
                  wa_final-state     = wa_switch_state-state.
                ENDIF.
              ENDIF.
            ENDIF.
**--
            wa_final-enhname  =  wa_enhnames-enhname.
            APPEND wa_final TO t_final.
          ENDLOOP.
          IF sy-subrc %LT%GT 0.
            APPEND wa_final TO t_final.
          ENDIF.
          CLEAR wa_final.
        ENDLOOP.
      ENDIF.
    ENDIF.
**-- Also consider the Enhancement implimentation which are not part of enhancement spot's
    LOOP AT t_itab INTO wa_jtab WHERE object = 'ENHO'.
      wa_jtab_enho = wa_jtab.
      APPEND wa_jtab_enho TO t_itab_enho.
      CLEAR wa_jtab_enho.
    ENDLOOP.
**--
    IF NOT t_itab_enho[] IS INITIAL.
      SELECT enhname
             obj_name
             main_type
        INTO TABLE t_enhnames_enho
        FROM enhobj
         FOR ALL ENTRIES IN t_itab_enho
       WHERE enhname = t_itab_enho-obj_name+0(30) AND
             obj_type = 'ENHS'.
      IF sy-subrc = 0.
**-- Select the enhancement spot object
**--
        SELECT *
          FROM enhspotobj
          INTO CORRESPONDING FIELDS OF TABLE t_eso_it_1
           FOR ALL ENTRIES IN t_enhnames_enho
         WHERE enhspot = t_enhnames_enho-obj_name+0(30).
        IF sy-subrc = 0.
          SORT t_eso_it_1 BY enhspot.
        ENDIF.

**-- Populate the final table
        DELETE ADJACENT DUPLICATES FROM t_enhnames_enho COMPARING enhname.
        LOOP AT t_enhnames_enho INTO wa_enhnames_enho.
          READ TABLE t_final INTO wa_final WITH KEY enhname  =  wa_enhnames_enho-enhname.
          IF sy-subrc %LT%GT 0.
            CLEAR: wa_final.
**--
            CLEAR: wa_eso_it.
            READ TABLE t_eso_it_1 INTO wa_eso_it WITH KEY
               enhspot = wa_enhnames_enho-obj_name+0(30)  BINARY SEARCH.
            IF sy-subrc = 0.
              wa_final-obj_type = wa_eso_it-obj_type.
            ENDIF.
            wa_final-enhspot  =  wa_enhnames_enho-obj_name.
            wa_final-enhname  =  wa_enhnames_enho-enhname.
            APPEND wa_final TO t_final.
          ENDIF.
        ENDLOOP.
      ENDIF.
    ENDIF.
**--
    LOOP AT t_final INTO wa_final.

      FORMAT COLOR COL_NORMAL INTENSIFIED ON.
      WRITE: /1 sy-vline,
              2 wa_final-enhspot HOTSPOT ON,
              34 sy-vline.

      CASE  wa_final-obj_type.
        WHEN 'REPS' OR 'PROG'.
          WRITE:  36 'Source Code Enhancement'(029).
        WHEN 'INTF' OR 'SXSD'.
          WRITE:  36 'BADI Enhancement'(030).
        WHEN 'FUNC' OR 'FUGR'.
          WRITE:  36 'Function group Enhancement'(031).
        WHEN 'CLAS'.
          WRITE:  36 'Class Enhancement'(032).

        WHEN OTHERS.
          WRITE:  36 wa_final-obj_type.
      ENDCASE.

      WRITE:  64 sy-vline,
              66 wa_final-enhname HOTSPOT ON,
             100 sy-vline,
              66 wa_final-enhname HOTSPOT ON,
             100 sy-vline,
             101 wa_final-switch_id,
             132 sy-vline.
**--
      CASE wa_final-state.
        WHEN 'T'.
          WRITE 133 'On'(033).
        WHEN 'S'.
          WRITE 133 'Stand-by'(034).
        WHEN 'F'.
          WRITE 133 'Off'(035).
      ENDCASE.

      WRITE: 150 sy-vline.

    ENDLOOP.
    WRITE:/(150) sy-uline.
  ELSE.
    WRITE: / text-017 COLOR COL_BACKGROUND .
  ENDIF.



ENDFORM.                    " ftnemecnahenyegakcapeman
*&---------------------------------------------------------------------*
*&      Form  get_from_tadir
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --%GT  p1        text
*  %LT--  p2        text
*----------------------------------------------------------------------*
FORM get_from_tadir .

  SELECT * FROM tadir
    INTO TABLE t_itab
   WHERE pgmid = 'R3TR'
     AND object IN ('ENHS','ENHO')
     AND devclass = v_devclass.

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

  FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
* Transaction Code
  WRITE:/1 text-018.
  IF NOT p_tcode IS INITIAL.
    WRITE:         30(20) p_tcode.
    WRITE: 55(50) wa_tstct-ttext.
  ELSEIF NOT p_dev IS INITIAL.
    WRITE:         30(20) p_dev.
    WRITE: 55(50) wa_tstct-ttext.
  ELSEIF NOT p_fun IS INITIAL.
    WRITE:         30(20) p_fun.
    WRITE: 55(50)   wa_tlibt-areat.
  ENDIF.


  SKIP.
  IF NOT t_itab[] IS INITIAL.

**-- Genral information.
    FORMAT COLOR COL_HEADING INTENSIFIED ON.
    WRITE:/ 'To see Enhancement spot/Implementation in detail, please click on values under column'(026), text-020.

    WRITE:/(150) sy-uline.
    FORMAT COLOR COL_HEADING INTENSIFIED ON.
    WRITE:/1 sy-vline,
           2 text-015,
          34 sy-vline,
          36 text-016,
          64 sy-vline,
          66 text-014,
         100 sy-vline,
         101 'Switch'(027),
         132 sy-vline,
         133 'Switch State'(028),
         150 sy-vline.

    WRITE:/(150) sy-uline.
**--
    SELECT *
      FROM enhspotobj
      INTO CORRESPONDING FIELDS OF TABLE t_eso_it
       FOR ALL ENTRIES IN t_itab
     WHERE enhspot = t_itab-obj_name+0(30).

    IF sy-subrc %LT%GT 0.
      WRITE: / text-017.
    ELSE.
      SORT t_eso_it BY enhspot.
    ENDIF.    "IF sy-subrc %LT%GT 0
  ENDIF.    "IF NOT t_itab[] IS INITIAL



ENDFORM.                    " get_from_tadir
*----------------------------------------------------------------------*
*        Start new screen                                              *
*----------------------------------------------------------------------*
FORM fbdc_dynpro USING ip_program ip_dynpro TYPE any.       "#EC *
  CLEAR wa_bdcdata.
  wa_bdcdata-program  = ip_program.
  wa_bdcdata-dynpro   = ip_dynpro.
  wa_bdcdata-dynbegin = 'X'.
  APPEND wa_bdcdata TO t_bdcdata.
ENDFORM.                    "FBDC_DYNPRO

*----------------------------------------------------------------------*
*        Insert field                                                  *
*----------------------------------------------------------------------*
FORM fbdc_field USING ip_fnam ip_fval TYPE any.             "#EC *
  CLEAR wa_bdcdata.
  wa_bdcdata-fnam = ip_fnam.
  wa_bdcdata-fval = ip_fval.
  APPEND wa_bdcdata TO t_bdcdata.
ENDFORM.                    "FBDC_FIELD

*----------------------------------------------------------------------*
*        Start new transaction according to parameters                 *
*----------------------------------------------------------------------*
FORM fbdc_transaction USING value(l_tcode) TYPE tstc-tcode.
  REFRESH t_messtab.
  CALL TRANSACTION l_tcode USING t_bdcdata
                               MODE   v_ctumode
                               UPDATE v_cupdate
                               MESSAGES INTO t_messtab.

  REFRESH t_bdcdata.

ENDFORM.                    "fBDC_TRANSACTION

*Text elements
*----------------------------------------------------------
* 001 Find by program name
* 002 Find by package
* 003 Enter either Tcode or Package
* 004 Transaction Code Does Not Exist
* 005 Package Does Not Exist
* 006 Transaction Code Does Not Exist
* 007 Transaction Code -
* 008 Exit Name
* 009 Description
* 010 No of Exits:
* 011 No User Exit Exists
* 012 Package
* 013 Enhancements for tcode
* 014 Enhancement Implementation
* 015 Enhancement Spot Name
* 016 Enhancement Type
* 017 No Enhancement Spots Found
* 018 Enhancement Spot Name for
* 019 No.of BADis:
* 020 Enhancement Spot / Implementation
* 021 Function group Does Not Exist
* 022 Enhancements for Function group
* 023 Function group
* 024 Enhancement
* 025 Business Add-in
* 026 To see Enhancement spot/Implementation in detail, please click on values under column
* 027 Switch
* 028 Switch State
* 029 Source Code Enhancement
* 030 BADI Enhancement
* 031 Function group Enhancement
* 032 Class Enhancement
* 033 On
* 034 Stand-by
* 035 Off
* 036 Selection Parameters


*Selection texts
*----------------------------------------------------------
* P_DEV         Package
* P_DEVL         Developed
* P_ESPOT         Enhancement Spots
* P_EXIT         Exits
* P_FUN         Function group
* P_PROG         Program
* P_TCODE         Transaction Code


*Messages
*----------------------------------------------------------
*
* Message class: 00
*001   &1&2&3&4&5&6&7&8


*Selection texts
*----------------------------------------------------------
* P_DEV         Development Class
* P_DEVL         Development
* P_ESPOT         Enhancement Spot
* P_EXIT         User Exit
* P_FUN         Function Group
* P_PROG         Program
* P_TCODE         Transaction Code


*Messages
*----------------------------------------------------------
*
* Message class: 00
*001   &1&2&3&4&5&6&7&8


*Selection texts
*----------------------------------------------------------
* P_DEV         Development Class
* P_DEVL         Development
* P_ESPOT         Enhancement Spot
* P_EXIT         User Exit
* P_FUN         Function Group
* P_PROG         Program
* P_TCODE         Transaction Code


*Messages
*----------------------------------------------------------
*
* Message class: 00
*001   &1&2&3&4&5&6&7&8

----
  • No labels