*&---------------------------------------------------------------------*
*& Report ZFIND
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zfind MESSAGE-ID z25m_x_tool.
TABLES: tstc, " SAP Transaction Codes
tadir, " Directory of Repository Objects
modsapt, " SAP Enhancements - Short Texts
sxs_attrt,"Exit: Definition side: Attributes, Text table
trdir, " System table TRDIR
tfdir, " Function Module
enlfdir, " Additional Attributes for Function Modules
tstct. " Transaction Code Texts
DATA : g_oname TYPE sobj_name, "Variable to hold Program Name Entered
g_tcode TYPE tcode. "Variable to hold Transaction Code Entered
DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE. "Internal Tabele declaration.. Withe header line
DATA : v_devclass LIKE tadir-devclass. "Variable to hold Package of Tcode/prog entered
DATA : v_smod TYPE i ,
v_badi TYPE i ,
v_object TYPE trobjtype.
DATA: l_es_erw TYPE enh_hook_def,
l_es_erw_s TYPE enh_hook_def_spot,
l_erw TYPE enhincinx,
l_imp TYPE enh_hook_source,
l_full_name TYPE string,
l_full_name_ret TYPE string.
DATA : itab_inc TYPE STANDARD TABLE OF d010inc, " Internal Table to handle include programs
wa_inc TYPE d010inc. "Work area Declarations
***************************Structure Declasrations********************************************
DATA: BEGIN OF wa_result, " Result structure
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 wa_result.
DATA: BEGIN OF wa_enhnames, " Enhancement name details structure
enhname TYPE sobj_name,
main_name TYPE enhobj-main_name,
END OF wa_enhnames.
**--
DATA: BEGIN OF wa_enhnames_enho, " Enhancement deatils structure
enhname TYPE enhname,
obj_name TYPE trobj_name,
main_type TYPE trobjtype,
END OF wa_enhnames_enho.
DATA: BEGIN OF wa_es_head_it, "Enhnacement Spot name
enhspot TYPE enhobj-main_name,
END OF wa_es_head_it.
* Batch Input Table
DATA: BEGIN OF i_bdcdata OCCURS 0. "BDC data structure
INCLUDE STRUCTURE bdcdata.
DATA: END OF i_bdcdata.
DATA: i_eso_it TYPE STANDARD TABLE OF enhspotobj, "enhancements details
i_eso_it_1 TYPE STANDARD TABLE OF enhspotobj, "enhancements details
i_result LIKE wa_result OCCURS 0 WITH HEADER LINE, "result table with details
i_final LIKE wa_result OCCURS 0 WITH HEADER LINE, "display table
i_enhnames LIKE wa_enhnames OCCURS 0 WITH HEADER LINE,
i_enhnames_enho LIKE wa_enhnames_enho OCCURS 0 WITH HEADER LINE,
i_es_head_it LIKE wa_es_head_it OCCURS 0 WITH HEADER LINE,
i_jtab LIKE tadir OCCURS 0 WITH HEADER LINE, "table to capture enhancements
i_jtab_enho LIKE tadir OCCURS 0 WITH HEADER LINE,
i_messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE. "#EC * "BDC message tab
DATA : wa_eso_it LIKE LINE OF i_eso_it,
lv_enhname LIKE enhobj-enhname,
lv_fld TYPE enhname.
*"A: show all dynpros "E: show dynpro on error only N: do not display dynpro
DATA: ctumode LIKE ctu_params-dismode VALUE 'E',
*"S: synchronously *"A: asynchronously *"L: local
cupdate LIKE ctu_params-updmode VALUE 'L'.
**-- Include program names
TYPES: BEGIN OF t_includes,
prog TYPE trobj_name,
END OF t_includes.
**-- Program content for text download
DATA: BEGIN OF content OCCURS 0, "#EC *
line(255), "#EC *
END OF content.
**-- Types for enhancement spots
TYPES: BEGIN OF type_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 type_enhspotobj.
**--
TYPES: BEGIN OF type_enho_obj,
obj_name TYPE trobjtype,
devclass TYPE devclass,
END OF type_enho_obj.
**--
TYPES: BEGIN OF type_switch,
switch_id TYPE sfw_switch_id,
devclass TYPE packname,
END OF type_switch.
**--
TYPES: BEGIN OF type_switch_state,
switch_id TYPE sfw_switch_id,
state TYPE sfw_switchpos,
END OF type_switch_state.
**-- Names of function modules used within programmes
DATA: i_prog_includes TYPE STANDARD TABLE OF t_includes WITH HEADER LINE.
**-- Internal table for enhancement spots
DATA: i_enhspotobj TYPE STANDARD TABLE OF type_enhspotobj WITH HEADER LINE,
wa_enhspotobj TYPE type_enhspotobj,
**-- Development classes for implimentation
i_enho_obj TYPE STANDARD TABLE OF type_enho_obj WITH HEADER LINE,
**-- Switch
i_switch TYPE STANDARD TABLE OF type_switch WITH HEADER LINE,
**-- Switch state
i_switch_state TYPE STANDARD TABLE OF type_switch_state WITH HEADER LINE.
FIELD-SYMBOLS : <l_imp> TYPE enh_hook_source,
<l_eso> TYPE enhspotobj,
<l_enhspotobj> TYPE type_enhspotobj.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : r_exit RADIOBUTTON GROUP g1 USER-COMMAND ucom DEFAULT 'X', "To find user exits/badis
r_espot RADIOBUTTON GROUP g1. "To find Enhancement spots
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS : r_tcode RADIOBUTTON GROUP g2 USER-COMMAND ucom2 MODIF ID a DEFAULT 'X', "Search Based on Transaction Code
p_tcode TYPE tstc-tcode MODIF ID b, "Transaction code name
r_name RADIOBUTTON GROUP g2 MODIF ID c, "Search Based on Program
p_name TYPE tadir-obj_name MODIF ID d. "Program name
SELECTION-SCREEN END OF BLOCK b2.
** Four MODIF ID's are used, because for 2nd block in selection screen, if transaction code has to be entered,
** then Program Name is suppose to be input inactive and vice-versa.
***********************************************************************************************************
* TOGGLING FACILITY OF SELECTION SCREEN *
***********************************************************************************************************
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF r_exit = 'X'.
IF screen-group1 = 'C' OR screen-group1 = 'D'.
screen-active = 0. "if user exit radio button is selected, grey out Prog name parameter
MODIFY SCREEN.
ENDIF.
ELSEIF r_espot = 'X'.
"if Enhancement Spots radio button is selected
IF screen-group1 = 'A' OR screen-group1 = 'B' OR screen-group1 = 'C' OR screen-group1 = 'D'.
screen-active = '1'.
IF r_tcode = 'X'.
"if Tcode radio button is selected, grey out Prog name parameter
IF screen-group1 = 'D'.
screen-input = 0.
ENDIF.
ELSEIF r_name = 'X'.
"if Prog name radio button is selected, grey out Tcode parameter
IF screen-group1 = 'B'.
screen-input = 0.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
***********************************************************************************************************
* SELECTION SCREEN VALIDATIONS *
***********************************************************************************************************
AT SELECTION-SCREEN ON p_tcode.
CASE sy-ucomm.
WHEN 'ONLI'.
IF r_tcode = 'X'. "if user selects Transaction code and does not fill in a tcode
IF p_tcode IS INITIAL. " display an Error message.
MESSAGE e000.
ENDIF.
ENDIF.
ENDCASE.
AT SELECTION-SCREEN ON p_name.
CASE sy-ucomm.
WHEN 'ONLI'.
IF r_espot = 'X' AND r_name = 'X'. "if user selects Program and does not fill in a prog name
IF p_name IS INITIAL. " display an Error message.
MESSAGE e001.
ENDIF.
ENDIF.
ENDCASE.
***********************************************************************************************************
* AT SELCTION SCREEN EVENT *
***********************************************************************************************************
AT SELECTION-SCREEN.
IF r_exit EQ 'X'.
CLEAR r_name.
ENDIF.
IF r_espot = 'X'.
IF r_tcode = 'X'.
CLEAR p_name.
ENDIF.
IF r_name = 'X'.
CLEAR p_tcode.
ENDIF.
ENDIF.
IF r_tcode = 'X' AND p_tcode IS NOT INITIAL. "If user enters a transaction code
SELECT SINGLE tcode "Check if tcode exists in standard table TSTC
FROM tstc
INTO g_tcode
WHERE tcode = p_tcode.
IF sy-subrc NE 0.
MESSAGE e003.
ENDIF.
ENDIF.
IF r_name = 'X' AND p_name IS NOT INITIAL. "If user enters program name
SELECT SINGLE obj_name "#EC * " Check if prog name exists in standard table TADIR.
FROM tadir
INTO g_oname
WHERE obj_name = p_name.
IF sy-subrc NE 0.
MESSAGE e002.
ENDIF.
ENDIF.
***********************************************************************************************************
* START OF SELECTION EVENT *
***********************************************************************************************************
START-OF-SELECTION.
IF r_exit = 'X'. "if user wants to find user exits.
PERFORM f_badis_exits. "Subroutine to find User Exits/Badis
ELSEIF r_espot = 'X'. " if user want to find ENHANCEMENT SPOT.
IF r_tcode = 'X'.
PERFORM f_tcode_spots. "Subroutine to find Enhancment Spots For a given Tcdoe
ELSE.
PERFORM f_pname_spots. "Subroutine to find Enhancment Spots For a given Program
ENDIF.
ENDIF.
***********************************************************************************************************
* AT LINE SELECTION EVENT *
***********************************************************************************************************
AT LINE-SELECTION. "Navigation on clicking on a list item
**--
CLEAR: lv_fld,
lv_enhname.
**--
GET CURSOR FIELD lv_fld VALUE lv_enhname.
"If user clicks on Enhancment Name in list display, it transits to 2nd screen of SE19.
IF lv_fld = 'I_FINAL-ENHNAME'.
IF lv_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' lv_enhname.
PERFORM fbdc_field USING 'G_IS_NEW_2' 'X'.
PERFORM fbdc_dynpro USING 'SAPLSEXO' '0120'.
PERFORM fbdc_field USING 'BDC_OKCODE' '=WB_BACK'.
PERFORM fbdc_field USING 'BDC_CURSOR' 'G_ENHNAME'.
PERFORM fbdc_field USING 'G_IS_NEW_1' 'X'.
PERFORM fbdc_field USING 'G_ENHNAME' lv_enhname.
PERFORM fbdc_field USING 'G_IS_NEW_2' 'X'.
PERFORM fbdc_transaction USING 'SE19'. " Call transaction se19
ENDIF.
"If user clicks on Enhancment Spot in list display, navigate to 2nd screen of SE18.
ELSEIF lv_fld = 'I_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_dynpro USING 'SAPLSEXO' '100'.
PERFORM fbdc_field USING 'BDC_OKCODE' '=WB_BACK'.
PERFORM fbdc_field USING 'BDC_CURSOR' 'G_BADINAME'.
PERFORM fbdc_field USING 'G_IS_BADI' 'X'.
PERFORM fbdc_transaction USING 'SE18'. " Call transaction se18
ELSEIF lv_fld(4) EQ 'JTAB'.
READ TABLE jtab WITH KEY obj_name = sy-lisel+1(20).
MOVE jtab-object TO v_object.
CASE v_object.
"if user clicks on a User-Exit in list display, navigate to 2nd screen of SMOD.
WHEN 'SMOD'.
SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).
PERFORM fbdc_dynpro USING 'SAPMSMOD' '2010'.
PERFORM fbdc_field USING 'BDC_CURSOR' 'MOD0-NAME'.
PERFORM fbdc_field USING 'BDC_OKCODE' '=SHOW'.
PERFORM fbdc_field USING 'MOD0-NAME' sy-lisel+1(10).
PERFORM fbdc_field USING 'MODF-CHAM' 'X'.
PERFORM fbdc_dynpro USING 'SAPMSMOD' '2010'.
PERFORM fbdc_field USING 'BDC_CURSOR' 'MOD0-NAME'.
PERFORM fbdc_field USING 'BDC_OKCODE' '=BACK'.
PERFORM fbdc_field USING 'MODF-HEAS' 'X'.
PERFORM fbdc_transaction USING 'SMOD'. "CALL TRANSACTION smod
"if user clicks on a BADI in list display
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_dynpro USING 'SAPLSEXO' '100'.
PERFORM fbdc_field USING 'BDC_OKCODE' '=WB_BACK'.
PERFORM fbdc_field USING 'BDC_CURSOR' 'G_BADINAME'.
PERFORM fbdc_field USING 'G_IS_BADI' 'X'.
PERFORM fbdc_transaction USING 'SE18'. "CALL TRANSACTION se18
ENDCASE.
ENDIF.
***********************************************************************************************************
* END OF SELECTION EVENT *
***********************************************************************************************************
END-OF-SELECTION.
REFRESH: i_result, i_final, i_enhnames,
i_es_head_it, i_jtab, i_bdcdata,
i_messtab.
FREE: i_result, i_final, i_enhnames,
i_es_head_it, i_jtab, i_bdcdata,
i_messtab.
** All the internal table the feilds are refreshed and free, according to the requirement.
FORM f_badis_exits .
IF NOT p_tcode IS INITIAL.
*-- Validate Transaction Code using the Standard Table TSTC.
SELECT SINGLE * FROM tstc
WHERE tcode EQ p_tcode.
*-- Find Repository Objects for transaction code, which has Object Type PROG.
IF sy-subrc EQ 0.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'PROG'
AND obj_name = tstc-pgmna.
**--Find Repository Objects for transaction code, which has Object Type TRAN.
IF sy-subrc NE 0.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'TRAN'
AND obj_name = p_tcode.
ENDIF.
MOVE : tadir-devclass TO v_devclass. " Capture Package
IF sy-subrc NE 0. "in case object type is function group
SELECT SINGLE * FROM trdir
WHERE name = tstc-pgmna.
IF trdir-subc EQ 'F'.
SELECT SINGLE * FROM tfdir "#EC *
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 = enlfdir-area.
MOVE : tadir-devclass TO v_devclass. "Capture Package
ENDIF.
ENDIF.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
MESSAGE e004.
ENDIF.
ENDIF.
**--
* Find SAP Modifactions
SELECT * FROM tadir "Select user exits/BADIS
INTO TABLE jtab
WHERE pgmid = 'R3TR'
AND object IN ('SMOD','SXSD')
AND devclass = v_devclass.
"To display Tcode Short Descriptions
SELECT SINGLE * FROM 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) tstct-ttext.
ENDIF.
IF NOT 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 jtab.
"For listing out User Exits
AT NEW object.
IF jtab-object = 'SMOD'.
FORMAT COLOR COL_GROUP INTENSIFIED ON.
WRITE:/1 sy-vline,
2 'User Exits'(300),
105 sy-vline.
"For listing out BADI's
ELSEIF jtab-object = 'SXSD'.
FORMAT COLOR COL_GROUP INTENSIFIED ON.
WRITE:/1 sy-vline,
2 ' Business Add-in'(301),
105 sy-vline.
ENDIF.
ENDAT.
CASE jtab-object.
WHEN 'SMOD'. "for user exits
v_smod = v_smod + 1. "counter for user exits, to give the total number of user exits.
SELECT SINGLE * FROM modsapt
WHERE sprsl = sy-langu
AND name = jtab-obj_name.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
WRITE:/1 sy-vline,
2 jtab-obj_name HOTSPOT ON,
41 sy-vline ,
42 modsapt-modtext,
105 sy-vline.
WHEN 'SXSD'.
* For BADI's
v_badi = v_badi + 1 . "counter for BADIS
SELECT SINGLE * FROM sxs_attrt
WHERE sprsl = sy-langu
AND exit_name = jtab-obj_name.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
WRITE:/1 sy-vline,
2 jtab-obj_name HOTSPOT ON,
41 sy-vline ,
42 sxs_attrt-text,
105 sy-vline.
ENDCASE.
AT END OF object.
WRITE : /(105) sy-uline.
ENDAT.
ENDLOOP.
WRITE:/(105) sy-uline.
DESCRIBE TABLE jtab.
SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ 'No of exits:'(302), v_smod.
WRITE:/ 'No of BADI''s:'(303), v_badi.
ELSE.
"Incase BADI's/ User Exits do not Exist
CALL FUNCTION 'POPUP_TO_INFORM' "EC NOTEXT
EXPORTING
titel = 'Information Message'(500)
txt1 = 'Sorry!!!'(501)
txt2 = 'No BADI''s/User exits available for the above Transaction'(502).
LEAVE PROGRAM.
ENDIF.
ENDFORM. " F_BADIS_EXITS
*&---------------------------------------------------------------------*
*& Form F_TCODE_SPOTS
*&---------------------------------------------------------------------*
* Finds the enhancement spots.
*----------------------------------------------------------------------*
FORM f_tcode_spots .
IF NOT p_tcode IS INITIAL.
**--select tcode from tadir
SELECT SINGLE * FROM tstc
WHERE tcode EQ p_tcode.
IF sy-subrc EQ 0.
"Select Prog behind the btransaction
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'PROG'
AND obj_name = tstc-pgmna.
"Capture Program pav\ckage
MOVE : tadir-devclass TO v_devclass.
"Else look in trdir
IF sy-subrc NE 0.
SELECT SINGLE * FROM trdir
WHERE name = tstc-pgmna.
IF trdir-subc EQ 'F'.
SELECT SINGLE * FROM tfdir "#EC *
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. "IF trdir-subc EQ 'F'
ENDIF. "IF sy-subrc NE 0
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
MESSAGE e004.
ENDIF.
**--
PERFORM get_from_tadir.
ENDIF. "IF sy-subrc EQ 0
*-Fill i_result
LOOP AT i_eso_it ASSIGNING <l_eso>.
i_result-enhspot = <l_eso>-enhspot.
APPEND i_result.
ENDLOOP.
IF NOT i_result[] IS INITIAL.
DELETE ADJACENT DUPLICATES FROM i_result.
SORT i_jtab BY obj_name.
LOOP AT i_result.
READ TABLE i_jtab WITH KEY obj_name = i_result-enhspot
BINARY SEARCH.
IF sy-subrc = 0.
i_result-obj_name = i_jtab-obj_name.
READ TABLE i_eso_it INTO wa_eso_it WITH KEY enhspot = i_jtab-obj_name+0(30)
BINARY SEARCH.
IF sy-subrc = 0.
i_result-obj_type = wa_eso_it-obj_type.
ENDIF.
MODIFY i_result.
CLEAR i_result.
ENDIF.
ENDLOOP.
"select Name/ID's of Enhancement Spots
SELECT enhspot
INTO TABLE i_es_head_it
FROM enhspotheader
FOR ALL ENTRIES IN i_result
WHERE enhspot = i_result-enhspot
AND version = 'A'.
"Select Enhancement names and main prog names
IF sy-subrc = 0.
SELECT enhname
main_name
APPENDING TABLE i_enhnames
FROM enhobj
FOR ALL ENTRIES IN i_es_head_it
WHERE main_type = 'ENHS'
AND main_name = i_es_head_it-enhspot.
IF sy-subrc = 0.
SORT i_enhnames BY main_name.
DELETE ADJACENT DUPLICATES FROM i_enhnames COMPARING enhname main_name.
**-- Get the development calss for the enhacement spots & implimentation
SELECT obj_name
devclass
INTO TABLE i_enho_obj
FROM tadir
FOR ALL ENTRIES IN i_enhnames
WHERE obj_name = i_enhnames-enhname AND
object = 'ENHO'.
IF sy-subrc = 0.
**-- Get the switch details
SELECT switch_id
devclass
INTO TABLE i_switch
FROM sfw_package
FOR ALL ENTRIES IN i_enho_obj
WHERE devclass = i_enho_obj-devclass.
IF sy-subrc = 0.
**-- Get the switch status
SELECT switch_id
state
INTO TABLE i_switch_state
FROM sfw_switch_state
FOR ALL ENTRIES IN i_switch
WHERE switch_id = i_switch-switch_id.
ENDIF.
ENDIF.
**--
LOOP AT i_result.
i_final-obj_type = i_result-obj_type.
i_final-obj_name = i_result-obj_name.
i_final-enhspot = i_result-enhspot.
LOOP AT i_enhnames WHERE main_name = i_result-enhspot.
**-- Populate the switch
READ TABLE i_enho_obj WITH KEY obj_name = i_enhnames-enhname. "#EC *
IF sy-subrc = 0.
READ TABLE i_switch WITH KEY devclass = i_enho_obj-devclass.
IF sy-subrc = 0.
READ TABLE i_switch_state WITH KEY switch_id = i_switch-switch_id.
IF sy-subrc = 0.
i_final-switch_id = i_switch_state-switch_id.
i_final-state = i_switch_state-state.
ENDIF.
ENDIF.
ENDIF.
**--
i_final-enhname = i_enhnames-enhname.
APPEND i_final.
ENDLOOP.
IF sy-subrc <> 0.
APPEND i_final.
ENDIF.
CLEAR i_final.
ENDLOOP.
ENDIF.
ENDIF.
**-- Also consider the Enhancement implimentation which are not part of enhancement spot's
LOOP AT i_jtab WHERE object = 'ENHO'.
i_jtab_enho = i_jtab.
APPEND i_jtab_enho.
ENDLOOP.
**--
IF NOT i_jtab_enho[] IS INITIAL.
SELECT enhname "EC#..,bzw.
obj_name
main_type
INTO TABLE i_enhnames_enho
FROM enhobj
FOR ALL ENTRIES IN i_jtab_enho
WHERE enhname = i_jtab_enho-obj_name+0(30)
AND obj_type = 'ENHS'.
IF sy-subrc = 0.
**-- Select the enhancement spot object
**--
SELECT * "#EC
FROM enhspotobj
INTO CORRESPONDING FIELDS OF TABLE i_eso_it_1
FOR ALL ENTRIES IN i_enhnames_enho
WHERE enhspot = i_enhnames_enho-obj_name+0(30).
IF sy-subrc = 0.
SORT i_eso_it_1 BY enhspot.
ENDIF.
**-- Populate the final table
DELETE ADJACENT DUPLICATES FROM i_enhnames_enho COMPARING enhname.
LOOP AT i_enhnames_enho.
READ TABLE i_final WITH KEY enhname = i_enhnames_enho-enhname.
IF sy-subrc <> 0.
CLEAR: i_final.
**--
CLEAR: wa_eso_it.
READ TABLE i_eso_it_1 INTO wa_eso_it WITH KEY
enhspot = i_enhnames_enho-obj_name+0(30) BINARY SEARCH.
IF sy-subrc = 0.
i_final-obj_type = wa_eso_it-obj_type.
ENDIF.
i_final-enhspot = i_enhnames_enho-obj_name.
i_final-enhname = i_enhnames_enho-enhname.
APPEND i_final.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
**--
LOOP AT i_final.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
AT NEW enhspot.
WRITE: /1 sy-vline,
2 i_final-enhspot HOTSPOT ON,
34 sy-vline.
ENDAT.
CASE i_final-obj_type.
WHEN 'REPS' OR 'PROG'.
WRITE: 36 'Source Code Enhancement'(304).
WHEN 'INTF' OR 'SXSD'.
WRITE: 36 'BADI Enhancement'(305).
WHEN 'FUNC' OR 'FUGR'.
WRITE: 36 'Function group Enhancement'(306).
WHEN 'CLAS'.
WRITE: 36 'Class Enhancement'(307).
WHEN OTHERS.
WRITE: 36 i_final-obj_type.
ENDCASE.
WRITE: 64 sy-vline,
66 i_final-enhname HOTSPOT ON,
100 sy-vline,
101 i_final-switch_id,
132 sy-vline.
**--
CASE i_final-state.
WHEN 'T'.
WRITE 133 'On'(308).
WHEN 'S'.
WRITE 133 'Stand-by'(309).
WHEN 'F'.
WRITE 133 'Off'(310).
ENDCASE.
WRITE: 150 sy-vline.
ENDLOOP.
WRITE:/(150) sy-uline.
ENDIF.
ENDFORM. " F_TCODE_SPOTS
*&---------------------------------------------------------------------*
*& Form GET_FROM_TADIR
*&---------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
FORM get_from_tadir .
" select records whose object types are enhancment spots/implimentations
SELECT * FROM tadir
INTO TABLE i_jtab
WHERE pgmid = 'R3TR'
AND object IN ('ENHS','ENHO')
AND devclass = v_devclass.
"to display short texts for tcode
SELECT SINGLE * FROM 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.
ENDIF.
WRITE: 55(50) tstct-ttext.
SKIP.
IF NOT i_jtab[] IS INITIAL.
**-- Genral information.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/ 'To see Enhancement spot/Implementation in detail, please click on values under column'(311).
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'(520),
132 sy-vline,
133 'Switch State'(521),
150 sy-vline.
WRITE:/(150) sy-uline.
**--Required details from enhspotobj table
SELECT * "#EC
FROM enhspotobj
INTO CORRESPONDING FIELDS OF TABLE i_eso_it
FOR ALL ENTRIES IN i_jtab
WHERE enhspot = i_jtab-obj_name+0(30).
IF sy-subrc EQ 0.
SORT i_eso_it BY enhspot.
ENDIF.
ELSE.
"Information popup
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'Information Message'(503)
txt1 = 'Sorry!!!'(504)
txt2 = 'No Enhancements available for the selected Transaction'(505).
LEAVE PROGRAM.
ENDIF. "IF NOT I_JTAB[] IS INITIAL
ENDFORM. " GET_FROM_TADIR
*&---------------------------------------------------------------------*
*& Form F_PNAME_SPOTS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM f_pname_spots .
"select record corresponding to entered tcode
SELECT SINGLE tcode FROM tstc "#EC *
INTO p_tcode
WHERE pgmna = p_name.
SELECT SINGLE * FROM tstc
WHERE tcode EQ p_tcode.
IF p_tcode IS INITIAL.
SELECT SINGLE * FROM trdir WHERE name = p_name.
IF trdir-subc EQ 'I'.
" in case include programs, select required details from d010inc
SELECT * FROM d010inc
INTO TABLE itab_inc
WHERE include = p_name.
IF itab_inc IS NOT INITIAL.
LOOP AT itab_inc INTO wa_inc.
SELECT SINGLE * FROM tstc "#EC *
WHERE pgmna = wa_inc-master.
IF sy-subrc = 0.
EXIT.
ENDIF.
ENDLOOP.
tstc-pgmna = p_name.
ENDIF.
ENDIF.
ENDIF.
IF sy-subrc EQ 0.
IF NOT tstc-pgmna IS INITIAL.
**-- Select the include program's which are there in the main program
PERFORM f_find_include_programs USING tstc-pgmna.
**-- Append the main program also into internal table I_PROG_INCLUDES
i_prog_includes-prog = tstc-pgmna.
APPEND i_prog_includes.
**--
IF NOT i_prog_includes[] IS INITIAL.
**-- Select the enhancement spot's data from ENHSPOTOBJ
**-- All the includes in itab I_PROG_INCLUDES
SELECT enhspot
version
obj_type
obj_name
main_type
main_name
INTO TABLE i_enhspotobj
FROM enhspotobj
FOR ALL ENTRIES IN i_prog_includes
WHERE obj_name = i_prog_includes-prog AND
version = 'A'.
IF NOT i_enhspotobj[] IS INITIAL.
**--Select Transaction code description in system language
SELECT SINGLE * FROM tstct
WHERE sprsl EQ sy-langu
AND tcode EQ p_tcode.
FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
**-- Transaction Code
WRITE:/1 text-013,
25(20) p_tcode,
48(50) tstct-ttext.
SKIP.
**-- Genral information.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/ 'To see Enhancement spot/Implementation in detail, please click on the enhancements of your choice'(325).
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'(522),
132 sy-vline,
133 'Switch State'(523),
150 sy-vline.
WRITE:/(150) sy-uline.
ENDIF. "IF NOT i_enhspotobj[] IS INITIAL
ENDIF. " IF not I_PROG_INCLUDES[] is initial.
ELSE.
"information popup
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'Information Message'(506)
txt1 = 'Sorry!!!'(507)
txt2 = 'No Enhancements available for the selected Transaction'(508).
LEAVE PROGRAM.
ENDIF.
ELSE.
"information popup
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'Information Message'(509)
txt1 = 'Sorry!!!'(510)
txt2 = 'No Enhancements available for the selected Transaction'(511).
LEAVE PROGRAM.
ENDIF. "IF sy-subrc EQ 0
**---
**--
IF NOT i_enhspotobj[] IS INITIAL.
**--
LOOP AT i_enhspotobj ASSIGNING <l_enhspotobj>.
i_result-enhspot = <l_enhspotobj>-enhspot.
APPEND i_result.
ENDLOOP.
IF NOT i_result[] IS INITIAL.
**--remove redundant records
DELETE ADJACENT DUPLICATES FROM i_result.
**--sort table
SORT i_enhspotobj BY enhspot.
**--Populate rest of i_result
LOOP AT i_result.
***--get obj_name and main_type values from ENHSPOTOBJ table
READ TABLE i_enhspotobj INTO wa_enhspotobj WITH KEY enhspot = i_result-enhspot
BINARY SEARCH.
IF sy-subrc = 0.
i_result-obj_name = wa_enhspotobj-obj_name.
i_result-obj_type = wa_enhspotobj-main_type. " obj_type.
ENDIF.
MODIFY i_result.
CLEAR i_result.
ENDLOOP.
**--
SELECT enhspot
INTO TABLE i_es_head_it
FROM enhspotheader
FOR ALL ENTRIES IN i_result
WHERE enhspot = i_result-enhspot
AND version = 'A'.
IF sy-subrc = 0.
**-- Get the enhancement id data from ENHOBJ
SELECT enhname
main_name
APPENDING TABLE i_enhnames
FROM enhobj
FOR ALL ENTRIES IN i_es_head_it
WHERE main_type = 'ENHS'
AND main_name = i_es_head_it-enhspot.
IF sy-subrc = 0.
**--sort table
SORT i_enhnames BY main_name.
DELETE ADJACENT DUPLICATES FROM i_enhnames COMPARING enhname main_name.
**-- Get the development calss for the enhacement spots & implimentation
SELECT obj_name
devclass
INTO TABLE i_enho_obj
FROM tadir
FOR ALL ENTRIES IN i_enhnames
WHERE obj_name = i_enhnames-enhname AND
object = 'ENHO'.
IF sy-subrc = 0.
**-- Get the switch details
SELECT switch_id
devclass
INTO TABLE i_switch
FROM sfw_package
FOR ALL ENTRIES IN i_enho_obj
WHERE devclass = i_enho_obj-devclass.
IF sy-subrc = 0.
**-- Get the switch status
SELECT switch_id
state
INTO TABLE i_switch_state
FROM sfw_switch_state
FOR ALL ENTRIES IN i_switch
WHERE switch_id = i_switch-switch_id.
ENDIF.
ENDIF.
**--
LOOP AT i_result.
i_final-obj_type = i_result-obj_type.
i_final-obj_name = i_result-obj_name.
i_final-enhspot = i_result-enhspot.
LOOP AT i_enhnames WHERE main_name = i_result-enhspot.
**-- Populate the switch
READ TABLE i_enho_obj WITH KEY obj_name = i_enhnames-enhname. "#EC *
IF sy-subrc = 0.
READ TABLE i_switch WITH KEY devclass = i_enho_obj-devclass.
IF sy-subrc = 0.
READ TABLE i_switch_state WITH KEY switch_id = i_switch-switch_id.
IF sy-subrc = 0.
i_final-switch_id = i_switch_state-switch_id.
i_final-state = i_switch_state-state.
ENDIF.
ENDIF.
ENDIF.
**--Populate enhancement name
i_final-enhname = i_enhnames-enhname.
APPEND i_final.
ENDLOOP.
CLEAR i_final.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
**--
**--Fill up the final display table
LOOP AT i_final.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
WRITE: /1 sy-vline,
2 i_final-enhspot HOTSPOT ON,
34 sy-vline.
**--Description of object types
CASE i_final-obj_type.
WHEN 'REPS' OR 'PROG'.
WRITE: 36 'Source Code Enhancement'(315).
WHEN 'INTF' OR 'SXSD'.
WRITE: 36 'BADI Enhancement'(316).
WHEN 'FUNC' OR 'FUGR' .
WRITE: 36 'Function group Enhancement'(317).
WHEN 'CLAS'.
WRITE: 36 'Class Enhancement'(318).
WHEN OTHERS.
WRITE: 36 i_final-obj_type.
ENDCASE.
**--Enhancement names and switch id
WRITE: 64 sy-vline,
66 i_final-enhname HOTSPOT ON,
100 sy-vline,
101 i_final-switch_id,
132 sy-vline.
**--Switxh state
CASE i_final-state.
WHEN 'T'.
WRITE 133 'On'(319).
WHEN 'S'.
WRITE 133 'Stand-by'(320).
WHEN 'F'.
WRITE 133 'Off'(321).
ENDCASE.
WRITE: 150 sy-vline.
ENDLOOP.
WRITE:/(150) sy-uline.
ELSEIF i_enhspotobj[] IS INITIAL.
"information popup
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'Information Message'(509)
txt1 = 'Sorry!!!'(510)
txt2 = 'No Enhancements available for the selected Transaction'(511).
ENDIF.
ENDFORM. " F_PNAME_SPOTS
*&---------------------------------------------------------------------*
*& Form fbdc_dynpro
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PROGRAM text
* -->DYNPRO text
*----------------------------------------------------------------------*
FORM fbdc_dynpro USING program TYPE any dynpro TYPE any.
CLEAR i_bdcdata.
i_bdcdata-program = program.
i_bdcdata-dynpro = dynpro.
i_bdcdata-dynbegin = 'X'.
APPEND i_bdcdata.
ENDFORM. "FBDC_DYNPRO
*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
FORM fbdc_field USING fnam TYPE any fval TYPE any.
CLEAR i_bdcdata.
i_bdcdata-fnam = fnam.
i_bdcdata-fval = fval.
APPEND i_bdcdata.
ENDFORM. "FBDC_FIELD
*----------------------------------------------------------------------*
* Start new transaction according to parameters *
*----------------------------------------------------------------------*
FORM fbdc_transaction USING value(l_tcode) LIKE tstc-tcode.
REFRESH i_messtab.
CALL TRANSACTION l_tcode USING i_bdcdata
MODE ctumode
UPDATE cupdate
MESSAGES INTO i_messtab.
REFRESH i_bdcdata.
CLEAR i_bdcdata.
ENDFORM. "fbdc_transaction
*&---------------------------------------------------------------------*
*& Form F_FIND_INCLUDE_PROGRAMS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_TSTC_PGMNA text
*----------------------------------------------------------------------*
FORM f_find_include_programs USING p_tstc_pgmna TYPE any.
DATA: lv_fip_prog(255),
lv_tail(255). "#EC *
*--- Lines for include
DATA: i_inc_lines LIKE content OCCURS 0 WITH HEADER LINE.
**-- Read ABAP
READ REPORT p_tstc_pgmna INTO i_inc_lines.
**-- Examine each line of ABAP
LOOP AT i_inc_lines.
**-- find include programs.
IF i_inc_lines(1) = '*' OR i_inc_lines IS INITIAL.
CONTINUE.
ENDIF.
TRANSLATE i_inc_lines-line TO UPPER CASE.
SHIFT i_inc_lines-line UP TO 'INCLUDE'.
IF ( i_inc_lines-line(7) EQ 'INCLUDE' ) OR
( i_inc_lines-line(7) EQ 'INCLUDE' )
AND i_inc_lines-line+8(9) NE space
AND sy-tabix <> 1.
lv_fip_prog = i_inc_lines-line+8(64).
SPLIT lv_fip_prog AT '.' INTO lv_fip_prog lv_tail.
**- Append program name to list of include programs
SELECT SINGLE * FROM trdir WHERE name EQ lv_fip_prog.
CHECK sy-subrc EQ 0.
i_prog_includes-prog = lv_fip_prog.
APPEND i_prog_includes.
*--- Recursively look for other includes.
PERFORM f_find_include_programs USING lv_fip_prog.
ENDIF.
ENDLOOP.
ENDFORM. " F_FIND_INCLUDE_PROGRAMS
*& Report ZFIND
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zfind MESSAGE-ID z25m_x_tool.
TABLES: tstc, " SAP Transaction Codes
tadir, " Directory of Repository Objects
modsapt, " SAP Enhancements - Short Texts
sxs_attrt,"Exit: Definition side: Attributes, Text table
trdir, " System table TRDIR
tfdir, " Function Module
enlfdir, " Additional Attributes for Function Modules
tstct. " Transaction Code Texts
DATA : g_oname TYPE sobj_name, "Variable to hold Program Name Entered
g_tcode TYPE tcode. "Variable to hold Transaction Code Entered
DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE. "Internal Tabele declaration.. Withe header line
DATA : v_devclass LIKE tadir-devclass. "Variable to hold Package of Tcode/prog entered
DATA : v_smod TYPE i ,
v_badi TYPE i ,
v_object TYPE trobjtype.
DATA: l_es_erw TYPE enh_hook_def,
l_es_erw_s TYPE enh_hook_def_spot,
l_erw TYPE enhincinx,
l_imp TYPE enh_hook_source,
l_full_name TYPE string,
l_full_name_ret TYPE string.
DATA : itab_inc TYPE STANDARD TABLE OF d010inc, " Internal Table to handle include programs
wa_inc TYPE d010inc. "Work area Declarations
***************************Structure Declasrations********************************************
DATA: BEGIN OF wa_result, " Result structure
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 wa_result.
DATA: BEGIN OF wa_enhnames, " Enhancement name details structure
enhname TYPE sobj_name,
main_name TYPE enhobj-main_name,
END OF wa_enhnames.
**--
DATA: BEGIN OF wa_enhnames_enho, " Enhancement deatils structure
enhname TYPE enhname,
obj_name TYPE trobj_name,
main_type TYPE trobjtype,
END OF wa_enhnames_enho.
DATA: BEGIN OF wa_es_head_it, "Enhnacement Spot name
enhspot TYPE enhobj-main_name,
END OF wa_es_head_it.
* Batch Input Table
DATA: BEGIN OF i_bdcdata OCCURS 0. "BDC data structure
INCLUDE STRUCTURE bdcdata.
DATA: END OF i_bdcdata.
DATA: i_eso_it TYPE STANDARD TABLE OF enhspotobj, "enhancements details
i_eso_it_1 TYPE STANDARD TABLE OF enhspotobj, "enhancements details
i_result LIKE wa_result OCCURS 0 WITH HEADER LINE, "result table with details
i_final LIKE wa_result OCCURS 0 WITH HEADER LINE, "display table
i_enhnames LIKE wa_enhnames OCCURS 0 WITH HEADER LINE,
i_enhnames_enho LIKE wa_enhnames_enho OCCURS 0 WITH HEADER LINE,
i_es_head_it LIKE wa_es_head_it OCCURS 0 WITH HEADER LINE,
i_jtab LIKE tadir OCCURS 0 WITH HEADER LINE, "table to capture enhancements
i_jtab_enho LIKE tadir OCCURS 0 WITH HEADER LINE,
i_messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE. "#EC * "BDC message tab
DATA : wa_eso_it LIKE LINE OF i_eso_it,
lv_enhname LIKE enhobj-enhname,
lv_fld TYPE enhname.
*"A: show all dynpros "E: show dynpro on error only N: do not display dynpro
DATA: ctumode LIKE ctu_params-dismode VALUE 'E',
*"S: synchronously *"A: asynchronously *"L: local
cupdate LIKE ctu_params-updmode VALUE 'L'.
**-- Include program names
TYPES: BEGIN OF t_includes,
prog TYPE trobj_name,
END OF t_includes.
**-- Program content for text download
DATA: BEGIN OF content OCCURS 0, "#EC *
line(255), "#EC *
END OF content.
**-- Types for enhancement spots
TYPES: BEGIN OF type_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 type_enhspotobj.
**--
TYPES: BEGIN OF type_enho_obj,
obj_name TYPE trobjtype,
devclass TYPE devclass,
END OF type_enho_obj.
**--
TYPES: BEGIN OF type_switch,
switch_id TYPE sfw_switch_id,
devclass TYPE packname,
END OF type_switch.
**--
TYPES: BEGIN OF type_switch_state,
switch_id TYPE sfw_switch_id,
state TYPE sfw_switchpos,
END OF type_switch_state.
**-- Names of function modules used within programmes
DATA: i_prog_includes TYPE STANDARD TABLE OF t_includes WITH HEADER LINE.
**-- Internal table for enhancement spots
DATA: i_enhspotobj TYPE STANDARD TABLE OF type_enhspotobj WITH HEADER LINE,
wa_enhspotobj TYPE type_enhspotobj,
**-- Development classes for implimentation
i_enho_obj TYPE STANDARD TABLE OF type_enho_obj WITH HEADER LINE,
**-- Switch
i_switch TYPE STANDARD TABLE OF type_switch WITH HEADER LINE,
**-- Switch state
i_switch_state TYPE STANDARD TABLE OF type_switch_state WITH HEADER LINE.
FIELD-SYMBOLS : <l_imp> TYPE enh_hook_source,
<l_eso> TYPE enhspotobj,
<l_enhspotobj> TYPE type_enhspotobj.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : r_exit RADIOBUTTON GROUP g1 USER-COMMAND ucom DEFAULT 'X', "To find user exits/badis
r_espot RADIOBUTTON GROUP g1. "To find Enhancement spots
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETERS : r_tcode RADIOBUTTON GROUP g2 USER-COMMAND ucom2 MODIF ID a DEFAULT 'X', "Search Based on Transaction Code
p_tcode TYPE tstc-tcode MODIF ID b, "Transaction code name
r_name RADIOBUTTON GROUP g2 MODIF ID c, "Search Based on Program
p_name TYPE tadir-obj_name MODIF ID d. "Program name
SELECTION-SCREEN END OF BLOCK b2.
** Four MODIF ID's are used, because for 2nd block in selection screen, if transaction code has to be entered,
** then Program Name is suppose to be input inactive and vice-versa.
***********************************************************************************************************
* TOGGLING FACILITY OF SELECTION SCREEN *
***********************************************************************************************************
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF r_exit = 'X'.
IF screen-group1 = 'C' OR screen-group1 = 'D'.
screen-active = 0. "if user exit radio button is selected, grey out Prog name parameter
MODIFY SCREEN.
ENDIF.
ELSEIF r_espot = 'X'.
"if Enhancement Spots radio button is selected
IF screen-group1 = 'A' OR screen-group1 = 'B' OR screen-group1 = 'C' OR screen-group1 = 'D'.
screen-active = '1'.
IF r_tcode = 'X'.
"if Tcode radio button is selected, grey out Prog name parameter
IF screen-group1 = 'D'.
screen-input = 0.
ENDIF.
ELSEIF r_name = 'X'.
"if Prog name radio button is selected, grey out Tcode parameter
IF screen-group1 = 'B'.
screen-input = 0.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDIF.
ENDIF.
ENDLOOP.
***********************************************************************************************************
* SELECTION SCREEN VALIDATIONS *
***********************************************************************************************************
AT SELECTION-SCREEN ON p_tcode.
CASE sy-ucomm.
WHEN 'ONLI'.
IF r_tcode = 'X'. "if user selects Transaction code and does not fill in a tcode
IF p_tcode IS INITIAL. " display an Error message.
MESSAGE e000.
ENDIF.
ENDIF.
ENDCASE.
AT SELECTION-SCREEN ON p_name.
CASE sy-ucomm.
WHEN 'ONLI'.
IF r_espot = 'X' AND r_name = 'X'. "if user selects Program and does not fill in a prog name
IF p_name IS INITIAL. " display an Error message.
MESSAGE e001.
ENDIF.
ENDIF.
ENDCASE.
***********************************************************************************************************
* AT SELCTION SCREEN EVENT *
***********************************************************************************************************
AT SELECTION-SCREEN.
IF r_exit EQ 'X'.
CLEAR r_name.
ENDIF.
IF r_espot = 'X'.
IF r_tcode = 'X'.
CLEAR p_name.
ENDIF.
IF r_name = 'X'.
CLEAR p_tcode.
ENDIF.
ENDIF.
IF r_tcode = 'X' AND p_tcode IS NOT INITIAL. "If user enters a transaction code
SELECT SINGLE tcode "Check if tcode exists in standard table TSTC
FROM tstc
INTO g_tcode
WHERE tcode = p_tcode.
IF sy-subrc NE 0.
MESSAGE e003.
ENDIF.
ENDIF.
IF r_name = 'X' AND p_name IS NOT INITIAL. "If user enters program name
SELECT SINGLE obj_name "#EC * " Check if prog name exists in standard table TADIR.
FROM tadir
INTO g_oname
WHERE obj_name = p_name.
IF sy-subrc NE 0.
MESSAGE e002.
ENDIF.
ENDIF.
***********************************************************************************************************
* START OF SELECTION EVENT *
***********************************************************************************************************
START-OF-SELECTION.
IF r_exit = 'X'. "if user wants to find user exits.
PERFORM f_badis_exits. "Subroutine to find User Exits/Badis
ELSEIF r_espot = 'X'. " if user want to find ENHANCEMENT SPOT.
IF r_tcode = 'X'.
PERFORM f_tcode_spots. "Subroutine to find Enhancment Spots For a given Tcdoe
ELSE.
PERFORM f_pname_spots. "Subroutine to find Enhancment Spots For a given Program
ENDIF.
ENDIF.
***********************************************************************************************************
* AT LINE SELECTION EVENT *
***********************************************************************************************************
AT LINE-SELECTION. "Navigation on clicking on a list item
**--
CLEAR: lv_fld,
lv_enhname.
**--
GET CURSOR FIELD lv_fld VALUE lv_enhname.
"If user clicks on Enhancment Name in list display, it transits to 2nd screen of SE19.
IF lv_fld = 'I_FINAL-ENHNAME'.
IF lv_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' lv_enhname.
PERFORM fbdc_field USING 'G_IS_NEW_2' 'X'.
PERFORM fbdc_dynpro USING 'SAPLSEXO' '0120'.
PERFORM fbdc_field USING 'BDC_OKCODE' '=WB_BACK'.
PERFORM fbdc_field USING 'BDC_CURSOR' 'G_ENHNAME'.
PERFORM fbdc_field USING 'G_IS_NEW_1' 'X'.
PERFORM fbdc_field USING 'G_ENHNAME' lv_enhname.
PERFORM fbdc_field USING 'G_IS_NEW_2' 'X'.
PERFORM fbdc_transaction USING 'SE19'. " Call transaction se19
ENDIF.
"If user clicks on Enhancment Spot in list display, navigate to 2nd screen of SE18.
ELSEIF lv_fld = 'I_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_dynpro USING 'SAPLSEXO' '100'.
PERFORM fbdc_field USING 'BDC_OKCODE' '=WB_BACK'.
PERFORM fbdc_field USING 'BDC_CURSOR' 'G_BADINAME'.
PERFORM fbdc_field USING 'G_IS_BADI' 'X'.
PERFORM fbdc_transaction USING 'SE18'. " Call transaction se18
ELSEIF lv_fld(4) EQ 'JTAB'.
READ TABLE jtab WITH KEY obj_name = sy-lisel+1(20).
MOVE jtab-object TO v_object.
CASE v_object.
"if user clicks on a User-Exit in list display, navigate to 2nd screen of SMOD.
WHEN 'SMOD'.
SET PARAMETER ID 'MON' FIELD sy-lisel+1(10).
PERFORM fbdc_dynpro USING 'SAPMSMOD' '2010'.
PERFORM fbdc_field USING 'BDC_CURSOR' 'MOD0-NAME'.
PERFORM fbdc_field USING 'BDC_OKCODE' '=SHOW'.
PERFORM fbdc_field USING 'MOD0-NAME' sy-lisel+1(10).
PERFORM fbdc_field USING 'MODF-CHAM' 'X'.
PERFORM fbdc_dynpro USING 'SAPMSMOD' '2010'.
PERFORM fbdc_field USING 'BDC_CURSOR' 'MOD0-NAME'.
PERFORM fbdc_field USING 'BDC_OKCODE' '=BACK'.
PERFORM fbdc_field USING 'MODF-HEAS' 'X'.
PERFORM fbdc_transaction USING 'SMOD'. "CALL TRANSACTION smod
"if user clicks on a BADI in list display
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_dynpro USING 'SAPLSEXO' '100'.
PERFORM fbdc_field USING 'BDC_OKCODE' '=WB_BACK'.
PERFORM fbdc_field USING 'BDC_CURSOR' 'G_BADINAME'.
PERFORM fbdc_field USING 'G_IS_BADI' 'X'.
PERFORM fbdc_transaction USING 'SE18'. "CALL TRANSACTION se18
ENDCASE.
ENDIF.
***********************************************************************************************************
* END OF SELECTION EVENT *
***********************************************************************************************************
END-OF-SELECTION.
REFRESH: i_result, i_final, i_enhnames,
i_es_head_it, i_jtab, i_bdcdata,
i_messtab.
FREE: i_result, i_final, i_enhnames,
i_es_head_it, i_jtab, i_bdcdata,
i_messtab.
** All the internal table the feilds are refreshed and free, according to the requirement.
FORM f_badis_exits .
IF NOT p_tcode IS INITIAL.
*-- Validate Transaction Code using the Standard Table TSTC.
SELECT SINGLE * FROM tstc
WHERE tcode EQ p_tcode.
*-- Find Repository Objects for transaction code, which has Object Type PROG.
IF sy-subrc EQ 0.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'PROG'
AND obj_name = tstc-pgmna.
**--Find Repository Objects for transaction code, which has Object Type TRAN.
IF sy-subrc NE 0.
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'TRAN'
AND obj_name = p_tcode.
ENDIF.
MOVE : tadir-devclass TO v_devclass. " Capture Package
IF sy-subrc NE 0. "in case object type is function group
SELECT SINGLE * FROM trdir
WHERE name = tstc-pgmna.
IF trdir-subc EQ 'F'.
SELECT SINGLE * FROM tfdir "#EC *
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 = enlfdir-area.
MOVE : tadir-devclass TO v_devclass. "Capture Package
ENDIF.
ENDIF.
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
MESSAGE e004.
ENDIF.
ENDIF.
**--
* Find SAP Modifactions
SELECT * FROM tadir "Select user exits/BADIS
INTO TABLE jtab
WHERE pgmid = 'R3TR'
AND object IN ('SMOD','SXSD')
AND devclass = v_devclass.
"To display Tcode Short Descriptions
SELECT SINGLE * FROM 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) tstct-ttext.
ENDIF.
IF NOT 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 jtab.
"For listing out User Exits
AT NEW object.
IF jtab-object = 'SMOD'.
FORMAT COLOR COL_GROUP INTENSIFIED ON.
WRITE:/1 sy-vline,
2 'User Exits'(300),
105 sy-vline.
"For listing out BADI's
ELSEIF jtab-object = 'SXSD'.
FORMAT COLOR COL_GROUP INTENSIFIED ON.
WRITE:/1 sy-vline,
2 ' Business Add-in'(301),
105 sy-vline.
ENDIF.
ENDAT.
CASE jtab-object.
WHEN 'SMOD'. "for user exits
v_smod = v_smod + 1. "counter for user exits, to give the total number of user exits.
SELECT SINGLE * FROM modsapt
WHERE sprsl = sy-langu
AND name = jtab-obj_name.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
WRITE:/1 sy-vline,
2 jtab-obj_name HOTSPOT ON,
41 sy-vline ,
42 modsapt-modtext,
105 sy-vline.
WHEN 'SXSD'.
* For BADI's
v_badi = v_badi + 1 . "counter for BADIS
SELECT SINGLE * FROM sxs_attrt
WHERE sprsl = sy-langu
AND exit_name = jtab-obj_name.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
WRITE:/1 sy-vline,
2 jtab-obj_name HOTSPOT ON,
41 sy-vline ,
42 sxs_attrt-text,
105 sy-vline.
ENDCASE.
AT END OF object.
WRITE : /(105) sy-uline.
ENDAT.
ENDLOOP.
WRITE:/(105) sy-uline.
DESCRIBE TABLE jtab.
SKIP.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ 'No of exits:'(302), v_smod.
WRITE:/ 'No of BADI''s:'(303), v_badi.
ELSE.
"Incase BADI's/ User Exits do not Exist
CALL FUNCTION 'POPUP_TO_INFORM' "EC NOTEXT
EXPORTING
titel = 'Information Message'(500)
txt1 = 'Sorry!!!'(501)
txt2 = 'No BADI''s/User exits available for the above Transaction'(502).
LEAVE PROGRAM.
ENDIF.
ENDFORM. " F_BADIS_EXITS
*&---------------------------------------------------------------------*
*& Form F_TCODE_SPOTS
*&---------------------------------------------------------------------*
* Finds the enhancement spots.
*----------------------------------------------------------------------*
FORM f_tcode_spots .
IF NOT p_tcode IS INITIAL.
**--select tcode from tadir
SELECT SINGLE * FROM tstc
WHERE tcode EQ p_tcode.
IF sy-subrc EQ 0.
"Select Prog behind the btransaction
SELECT SINGLE * FROM tadir
WHERE pgmid = 'R3TR'
AND object = 'PROG'
AND obj_name = tstc-pgmna.
"Capture Program pav\ckage
MOVE : tadir-devclass TO v_devclass.
"Else look in trdir
IF sy-subrc NE 0.
SELECT SINGLE * FROM trdir
WHERE name = tstc-pgmna.
IF trdir-subc EQ 'F'.
SELECT SINGLE * FROM tfdir "#EC *
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. "IF trdir-subc EQ 'F'
ENDIF. "IF sy-subrc NE 0
ELSE.
FORMAT COLOR COL_NEGATIVE INTENSIFIED ON.
MESSAGE e004.
ENDIF.
**--
PERFORM get_from_tadir.
ENDIF. "IF sy-subrc EQ 0
*-Fill i_result
LOOP AT i_eso_it ASSIGNING <l_eso>.
i_result-enhspot = <l_eso>-enhspot.
APPEND i_result.
ENDLOOP.
IF NOT i_result[] IS INITIAL.
DELETE ADJACENT DUPLICATES FROM i_result.
SORT i_jtab BY obj_name.
LOOP AT i_result.
READ TABLE i_jtab WITH KEY obj_name = i_result-enhspot
BINARY SEARCH.
IF sy-subrc = 0.
i_result-obj_name = i_jtab-obj_name.
READ TABLE i_eso_it INTO wa_eso_it WITH KEY enhspot = i_jtab-obj_name+0(30)
BINARY SEARCH.
IF sy-subrc = 0.
i_result-obj_type = wa_eso_it-obj_type.
ENDIF.
MODIFY i_result.
CLEAR i_result.
ENDIF.
ENDLOOP.
"select Name/ID's of Enhancement Spots
SELECT enhspot
INTO TABLE i_es_head_it
FROM enhspotheader
FOR ALL ENTRIES IN i_result
WHERE enhspot = i_result-enhspot
AND version = 'A'.
"Select Enhancement names and main prog names
IF sy-subrc = 0.
SELECT enhname
main_name
APPENDING TABLE i_enhnames
FROM enhobj
FOR ALL ENTRIES IN i_es_head_it
WHERE main_type = 'ENHS'
AND main_name = i_es_head_it-enhspot.
IF sy-subrc = 0.
SORT i_enhnames BY main_name.
DELETE ADJACENT DUPLICATES FROM i_enhnames COMPARING enhname main_name.
**-- Get the development calss for the enhacement spots & implimentation
SELECT obj_name
devclass
INTO TABLE i_enho_obj
FROM tadir
FOR ALL ENTRIES IN i_enhnames
WHERE obj_name = i_enhnames-enhname AND
object = 'ENHO'.
IF sy-subrc = 0.
**-- Get the switch details
SELECT switch_id
devclass
INTO TABLE i_switch
FROM sfw_package
FOR ALL ENTRIES IN i_enho_obj
WHERE devclass = i_enho_obj-devclass.
IF sy-subrc = 0.
**-- Get the switch status
SELECT switch_id
state
INTO TABLE i_switch_state
FROM sfw_switch_state
FOR ALL ENTRIES IN i_switch
WHERE switch_id = i_switch-switch_id.
ENDIF.
ENDIF.
**--
LOOP AT i_result.
i_final-obj_type = i_result-obj_type.
i_final-obj_name = i_result-obj_name.
i_final-enhspot = i_result-enhspot.
LOOP AT i_enhnames WHERE main_name = i_result-enhspot.
**-- Populate the switch
READ TABLE i_enho_obj WITH KEY obj_name = i_enhnames-enhname. "#EC *
IF sy-subrc = 0.
READ TABLE i_switch WITH KEY devclass = i_enho_obj-devclass.
IF sy-subrc = 0.
READ TABLE i_switch_state WITH KEY switch_id = i_switch-switch_id.
IF sy-subrc = 0.
i_final-switch_id = i_switch_state-switch_id.
i_final-state = i_switch_state-state.
ENDIF.
ENDIF.
ENDIF.
**--
i_final-enhname = i_enhnames-enhname.
APPEND i_final.
ENDLOOP.
IF sy-subrc <> 0.
APPEND i_final.
ENDIF.
CLEAR i_final.
ENDLOOP.
ENDIF.
ENDIF.
**-- Also consider the Enhancement implimentation which are not part of enhancement spot's
LOOP AT i_jtab WHERE object = 'ENHO'.
i_jtab_enho = i_jtab.
APPEND i_jtab_enho.
ENDLOOP.
**--
IF NOT i_jtab_enho[] IS INITIAL.
SELECT enhname "EC#..,bzw.
obj_name
main_type
INTO TABLE i_enhnames_enho
FROM enhobj
FOR ALL ENTRIES IN i_jtab_enho
WHERE enhname = i_jtab_enho-obj_name+0(30)
AND obj_type = 'ENHS'.
IF sy-subrc = 0.
**-- Select the enhancement spot object
**--
SELECT * "#EC
FROM enhspotobj
INTO CORRESPONDING FIELDS OF TABLE i_eso_it_1
FOR ALL ENTRIES IN i_enhnames_enho
WHERE enhspot = i_enhnames_enho-obj_name+0(30).
IF sy-subrc = 0.
SORT i_eso_it_1 BY enhspot.
ENDIF.
**-- Populate the final table
DELETE ADJACENT DUPLICATES FROM i_enhnames_enho COMPARING enhname.
LOOP AT i_enhnames_enho.
READ TABLE i_final WITH KEY enhname = i_enhnames_enho-enhname.
IF sy-subrc <> 0.
CLEAR: i_final.
**--
CLEAR: wa_eso_it.
READ TABLE i_eso_it_1 INTO wa_eso_it WITH KEY
enhspot = i_enhnames_enho-obj_name+0(30) BINARY SEARCH.
IF sy-subrc = 0.
i_final-obj_type = wa_eso_it-obj_type.
ENDIF.
i_final-enhspot = i_enhnames_enho-obj_name.
i_final-enhname = i_enhnames_enho-enhname.
APPEND i_final.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
**--
LOOP AT i_final.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
AT NEW enhspot.
WRITE: /1 sy-vline,
2 i_final-enhspot HOTSPOT ON,
34 sy-vline.
ENDAT.
CASE i_final-obj_type.
WHEN 'REPS' OR 'PROG'.
WRITE: 36 'Source Code Enhancement'(304).
WHEN 'INTF' OR 'SXSD'.
WRITE: 36 'BADI Enhancement'(305).
WHEN 'FUNC' OR 'FUGR'.
WRITE: 36 'Function group Enhancement'(306).
WHEN 'CLAS'.
WRITE: 36 'Class Enhancement'(307).
WHEN OTHERS.
WRITE: 36 i_final-obj_type.
ENDCASE.
WRITE: 64 sy-vline,
66 i_final-enhname HOTSPOT ON,
100 sy-vline,
101 i_final-switch_id,
132 sy-vline.
**--
CASE i_final-state.
WHEN 'T'.
WRITE 133 'On'(308).
WHEN 'S'.
WRITE 133 'Stand-by'(309).
WHEN 'F'.
WRITE 133 'Off'(310).
ENDCASE.
WRITE: 150 sy-vline.
ENDLOOP.
WRITE:/(150) sy-uline.
ENDIF.
ENDFORM. " F_TCODE_SPOTS
*&---------------------------------------------------------------------*
*& Form GET_FROM_TADIR
*&---------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
FORM get_from_tadir .
" select records whose object types are enhancment spots/implimentations
SELECT * FROM tadir
INTO TABLE i_jtab
WHERE pgmid = 'R3TR'
AND object IN ('ENHS','ENHO')
AND devclass = v_devclass.
"to display short texts for tcode
SELECT SINGLE * FROM 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.
ENDIF.
WRITE: 55(50) tstct-ttext.
SKIP.
IF NOT i_jtab[] IS INITIAL.
**-- Genral information.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/ 'To see Enhancement spot/Implementation in detail, please click on values under column'(311).
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'(520),
132 sy-vline,
133 'Switch State'(521),
150 sy-vline.
WRITE:/(150) sy-uline.
**--Required details from enhspotobj table
SELECT * "#EC
FROM enhspotobj
INTO CORRESPONDING FIELDS OF TABLE i_eso_it
FOR ALL ENTRIES IN i_jtab
WHERE enhspot = i_jtab-obj_name+0(30).
IF sy-subrc EQ 0.
SORT i_eso_it BY enhspot.
ENDIF.
ELSE.
"Information popup
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'Information Message'(503)
txt1 = 'Sorry!!!'(504)
txt2 = 'No Enhancements available for the selected Transaction'(505).
LEAVE PROGRAM.
ENDIF. "IF NOT I_JTAB[] IS INITIAL
ENDFORM. " GET_FROM_TADIR
*&---------------------------------------------------------------------*
*& Form F_PNAME_SPOTS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM f_pname_spots .
"select record corresponding to entered tcode
SELECT SINGLE tcode FROM tstc "#EC *
INTO p_tcode
WHERE pgmna = p_name.
SELECT SINGLE * FROM tstc
WHERE tcode EQ p_tcode.
IF p_tcode IS INITIAL.
SELECT SINGLE * FROM trdir WHERE name = p_name.
IF trdir-subc EQ 'I'.
" in case include programs, select required details from d010inc
SELECT * FROM d010inc
INTO TABLE itab_inc
WHERE include = p_name.
IF itab_inc IS NOT INITIAL.
LOOP AT itab_inc INTO wa_inc.
SELECT SINGLE * FROM tstc "#EC *
WHERE pgmna = wa_inc-master.
IF sy-subrc = 0.
EXIT.
ENDIF.
ENDLOOP.
tstc-pgmna = p_name.
ENDIF.
ENDIF.
ENDIF.
IF sy-subrc EQ 0.
IF NOT tstc-pgmna IS INITIAL.
**-- Select the include program's which are there in the main program
PERFORM f_find_include_programs USING tstc-pgmna.
**-- Append the main program also into internal table I_PROG_INCLUDES
i_prog_includes-prog = tstc-pgmna.
APPEND i_prog_includes.
**--
IF NOT i_prog_includes[] IS INITIAL.
**-- Select the enhancement spot's data from ENHSPOTOBJ
**-- All the includes in itab I_PROG_INCLUDES
SELECT enhspot
version
obj_type
obj_name
main_type
main_name
INTO TABLE i_enhspotobj
FROM enhspotobj
FOR ALL ENTRIES IN i_prog_includes
WHERE obj_name = i_prog_includes-prog AND
version = 'A'.
IF NOT i_enhspotobj[] IS INITIAL.
**--Select Transaction code description in system language
SELECT SINGLE * FROM tstct
WHERE sprsl EQ sy-langu
AND tcode EQ p_tcode.
FORMAT COLOR COL_POSITIVE INTENSIFIED OFF.
**-- Transaction Code
WRITE:/1 text-013,
25(20) p_tcode,
48(50) tstct-ttext.
SKIP.
**-- Genral information.
FORMAT COLOR COL_HEADING INTENSIFIED ON.
WRITE:/ 'To see Enhancement spot/Implementation in detail, please click on the enhancements of your choice'(325).
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'(522),
132 sy-vline,
133 'Switch State'(523),
150 sy-vline.
WRITE:/(150) sy-uline.
ENDIF. "IF NOT i_enhspotobj[] IS INITIAL
ENDIF. " IF not I_PROG_INCLUDES[] is initial.
ELSE.
"information popup
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'Information Message'(506)
txt1 = 'Sorry!!!'(507)
txt2 = 'No Enhancements available for the selected Transaction'(508).
LEAVE PROGRAM.
ENDIF.
ELSE.
"information popup
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'Information Message'(509)
txt1 = 'Sorry!!!'(510)
txt2 = 'No Enhancements available for the selected Transaction'(511).
LEAVE PROGRAM.
ENDIF. "IF sy-subrc EQ 0
**---
**--
IF NOT i_enhspotobj[] IS INITIAL.
**--
LOOP AT i_enhspotobj ASSIGNING <l_enhspotobj>.
i_result-enhspot = <l_enhspotobj>-enhspot.
APPEND i_result.
ENDLOOP.
IF NOT i_result[] IS INITIAL.
**--remove redundant records
DELETE ADJACENT DUPLICATES FROM i_result.
**--sort table
SORT i_enhspotobj BY enhspot.
**--Populate rest of i_result
LOOP AT i_result.
***--get obj_name and main_type values from ENHSPOTOBJ table
READ TABLE i_enhspotobj INTO wa_enhspotobj WITH KEY enhspot = i_result-enhspot
BINARY SEARCH.
IF sy-subrc = 0.
i_result-obj_name = wa_enhspotobj-obj_name.
i_result-obj_type = wa_enhspotobj-main_type. " obj_type.
ENDIF.
MODIFY i_result.
CLEAR i_result.
ENDLOOP.
**--
SELECT enhspot
INTO TABLE i_es_head_it
FROM enhspotheader
FOR ALL ENTRIES IN i_result
WHERE enhspot = i_result-enhspot
AND version = 'A'.
IF sy-subrc = 0.
**-- Get the enhancement id data from ENHOBJ
SELECT enhname
main_name
APPENDING TABLE i_enhnames
FROM enhobj
FOR ALL ENTRIES IN i_es_head_it
WHERE main_type = 'ENHS'
AND main_name = i_es_head_it-enhspot.
IF sy-subrc = 0.
**--sort table
SORT i_enhnames BY main_name.
DELETE ADJACENT DUPLICATES FROM i_enhnames COMPARING enhname main_name.
**-- Get the development calss for the enhacement spots & implimentation
SELECT obj_name
devclass
INTO TABLE i_enho_obj
FROM tadir
FOR ALL ENTRIES IN i_enhnames
WHERE obj_name = i_enhnames-enhname AND
object = 'ENHO'.
IF sy-subrc = 0.
**-- Get the switch details
SELECT switch_id
devclass
INTO TABLE i_switch
FROM sfw_package
FOR ALL ENTRIES IN i_enho_obj
WHERE devclass = i_enho_obj-devclass.
IF sy-subrc = 0.
**-- Get the switch status
SELECT switch_id
state
INTO TABLE i_switch_state
FROM sfw_switch_state
FOR ALL ENTRIES IN i_switch
WHERE switch_id = i_switch-switch_id.
ENDIF.
ENDIF.
**--
LOOP AT i_result.
i_final-obj_type = i_result-obj_type.
i_final-obj_name = i_result-obj_name.
i_final-enhspot = i_result-enhspot.
LOOP AT i_enhnames WHERE main_name = i_result-enhspot.
**-- Populate the switch
READ TABLE i_enho_obj WITH KEY obj_name = i_enhnames-enhname. "#EC *
IF sy-subrc = 0.
READ TABLE i_switch WITH KEY devclass = i_enho_obj-devclass.
IF sy-subrc = 0.
READ TABLE i_switch_state WITH KEY switch_id = i_switch-switch_id.
IF sy-subrc = 0.
i_final-switch_id = i_switch_state-switch_id.
i_final-state = i_switch_state-state.
ENDIF.
ENDIF.
ENDIF.
**--Populate enhancement name
i_final-enhname = i_enhnames-enhname.
APPEND i_final.
ENDLOOP.
CLEAR i_final.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
**--
**--Fill up the final display table
LOOP AT i_final.
FORMAT COLOR COL_NORMAL INTENSIFIED ON.
WRITE: /1 sy-vline,
2 i_final-enhspot HOTSPOT ON,
34 sy-vline.
**--Description of object types
CASE i_final-obj_type.
WHEN 'REPS' OR 'PROG'.
WRITE: 36 'Source Code Enhancement'(315).
WHEN 'INTF' OR 'SXSD'.
WRITE: 36 'BADI Enhancement'(316).
WHEN 'FUNC' OR 'FUGR' .
WRITE: 36 'Function group Enhancement'(317).
WHEN 'CLAS'.
WRITE: 36 'Class Enhancement'(318).
WHEN OTHERS.
WRITE: 36 i_final-obj_type.
ENDCASE.
**--Enhancement names and switch id
WRITE: 64 sy-vline,
66 i_final-enhname HOTSPOT ON,
100 sy-vline,
101 i_final-switch_id,
132 sy-vline.
**--Switxh state
CASE i_final-state.
WHEN 'T'.
WRITE 133 'On'(319).
WHEN 'S'.
WRITE 133 'Stand-by'(320).
WHEN 'F'.
WRITE 133 'Off'(321).
ENDCASE.
WRITE: 150 sy-vline.
ENDLOOP.
WRITE:/(150) sy-uline.
ELSEIF i_enhspotobj[] IS INITIAL.
"information popup
CALL FUNCTION 'POPUP_TO_INFORM'
EXPORTING
titel = 'Information Message'(509)
txt1 = 'Sorry!!!'(510)
txt2 = 'No Enhancements available for the selected Transaction'(511).
ENDIF.
ENDFORM. " F_PNAME_SPOTS
*&---------------------------------------------------------------------*
*& Form fbdc_dynpro
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->PROGRAM text
* -->DYNPRO text
*----------------------------------------------------------------------*
FORM fbdc_dynpro USING program TYPE any dynpro TYPE any.
CLEAR i_bdcdata.
i_bdcdata-program = program.
i_bdcdata-dynpro = dynpro.
i_bdcdata-dynbegin = 'X'.
APPEND i_bdcdata.
ENDFORM. "FBDC_DYNPRO
*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
FORM fbdc_field USING fnam TYPE any fval TYPE any.
CLEAR i_bdcdata.
i_bdcdata-fnam = fnam.
i_bdcdata-fval = fval.
APPEND i_bdcdata.
ENDFORM. "FBDC_FIELD
*----------------------------------------------------------------------*
* Start new transaction according to parameters *
*----------------------------------------------------------------------*
FORM fbdc_transaction USING value(l_tcode) LIKE tstc-tcode.
REFRESH i_messtab.
CALL TRANSACTION l_tcode USING i_bdcdata
MODE ctumode
UPDATE cupdate
MESSAGES INTO i_messtab.
REFRESH i_bdcdata.
CLEAR i_bdcdata.
ENDFORM. "fbdc_transaction
*&---------------------------------------------------------------------*
*& Form F_FIND_INCLUDE_PROGRAMS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_TSTC_PGMNA text
*----------------------------------------------------------------------*
FORM f_find_include_programs USING p_tstc_pgmna TYPE any.
DATA: lv_fip_prog(255),
lv_tail(255). "#EC *
*--- Lines for include
DATA: i_inc_lines LIKE content OCCURS 0 WITH HEADER LINE.
**-- Read ABAP
READ REPORT p_tstc_pgmna INTO i_inc_lines.
**-- Examine each line of ABAP
LOOP AT i_inc_lines.
**-- find include programs.
IF i_inc_lines(1) = '*' OR i_inc_lines IS INITIAL.
CONTINUE.
ENDIF.
TRANSLATE i_inc_lines-line TO UPPER CASE.
SHIFT i_inc_lines-line UP TO 'INCLUDE'.
IF ( i_inc_lines-line(7) EQ 'INCLUDE' ) OR
( i_inc_lines-line(7) EQ 'INCLUDE' )
AND i_inc_lines-line+8(9) NE space
AND sy-tabix <> 1.
lv_fip_prog = i_inc_lines-line+8(64).
SPLIT lv_fip_prog AT '.' INTO lv_fip_prog lv_tail.
**- Append program name to list of include programs
SELECT SINGLE * FROM trdir WHERE name EQ lv_fip_prog.
CHECK sy-subrc EQ 0.
i_prog_includes-prog = lv_fip_prog.
APPEND i_prog_includes.
*--- Recursively look for other includes.
PERFORM f_find_include_programs USING lv_fip_prog.
ENDIF.
ENDLOOP.
ENDFORM. " F_FIND_INCLUDE_PROGRAMS