Академический Документы
Профессиональный Документы
Культура Документы
form data_select.
*data selection message to sap gui
call function 'SAPGUI_PROGRESS_INDICATOR'
destination 'SAPGUI'
keeping logical unit of work
EXPORTING
text = 'Get programs/includes' "#EC NOTEXT
EXCEPTIONS
system_failure
communication_failure
. "#EC *
*get TCode name for ALV grid title
clear w_gridtxt.
if not p_tcode is initial.
select single * from tstct where tcode = p_tcode
and sprsl = sy-langu.
concatenate 'TCode:' p_tcode tstct-ttext into w_gridtxt
separated by space.
endif.
*get program name for ALV grid title
if not p_pname is initial.
select single * from trdirt where name = p_pname
and sprsl = sy-langu.
concatenate 'Program:' p_pname tstct-ttext into w_gridtxt
separated by space.
endif.
* determine search words
keywords-word = 'CALL'.
append keywords.
keywords-word = 'FORM'.
append keywords.
keywords-word = 'PERFORM'.
append keywords.
keywords-word = 'SUBMIT'.
append keywords.
keywords-word = 'INCLUDE'.
append keywords.
keywords-word = 'AUTHORITY-CHECK'.
append keywords.
if not p_tcode is initial.
* get program name from TCode
select single pgmna from tstc into wa_tstc-pgmna
where tcode eq p_tcode.
if not wa_tstc-pgmna is initial.
p_pname = wa_tstc-pgmna.
*TCode does not include program name, but does have reference TCode
else.
select single param from tstcp into wa_tstcp-param
where tcode eq p_tcode.
if sy-subrc = 0.
check wa_tstcp-param(1) = '/'.
check wa_tstcp-param+1(1) = '*'.
if wa_tstcp-param ca ' '.
endif.
w_off = sy-fdpos + 1.
subtract 2 from sy-fdpos.
if sy-fdpos gt 0.
p_tcode = wa_tstcp-param+2(sy-fdpos).
endif.
select single pgmna from tstc into wa_tstc-pgmna
where tcode eq p_tcode.
p_pname = wa_tstc-pgmna.
if sy-subrc 0.
message s110(/saptrx/asc) with 'No program found for: ' p_tcode."#E
C NOTEXT
stop.
endif.
else.
message s110(/saptrx/asc) with 'No program found for: ' p_tcode."#EC
NOTEXT
stop.
endif.
endif.
endif.
*Call customer-function aus Program coding
read report p_pname into sourcetab.
if sy-subrc > 0.
message e017(enhancement) with p_pname raising no_program."#EC *
endif.
scan abap-source sourcetab tokens into i_stoken
statements into i_sstmnt
keywords from keywords
overflow into c_overflow
with includes. "#EC
if sy-subrc > 0. "keine/syntakt. falsche Ablauflog./Fehler im Skanner
message e130(enhancement) raising syntax_error. "#EC
endif.
*check I_STOKEN for entries
clear w_linnum.
describe table i_stoken lines w_linnum.
if w_linnum gt 0.
w_level = '0'.
w_prog = ''.
w_incl = ''.
perform data_search tables i_stoken using w_level w_prog w_incl.
endif.
endform. "DATA_SELECT
form get_fm_data.
*data selection message to sap gui
call function 'SAPGUI_PROGRESS_INDICATOR'
destination 'SAPGUI'
keeping logical unit of work
EXPORTING
text = 'Get function module data' "#EC NOTEXT
EXCEPTIONS
system_failure
communication_failure
. "#EC *
* Function module data
sort i_fmodule by name.
delete adjacent duplicates from i_fmodule comparing name.
loop at i_fmodule where done ne c_x.
clear: i_stoken, i_sstmnt, sourcetab, wa_tfdir, w_include .
refresh: i_stoken, i_sstmnt, sourcetab.
clear wa_tfdir.
select single funcname pname include from tfdir into wa_tfdir
where funcname = i_fmodule-name.
check sy-subrc = 0.
call function 'FUNCTION_INCLUDE_SPLIT'
EXPORTING
program = wa_tfdir-pname
IMPORTING
group = w_area.
concatenate 'L' w_area 'U' wa_tfdir-include into w_include.
i_fmodule-pname = w_include.
i_fmodule-pname2 = wa_tfdir-pname.
modify i_fmodule.
read report i_fmodule-pname into sourcetab.
if sy-subrc = 0.
scan abap-source sourcetab tokens into i_stoken
statements into i_sstmnt
keywords from keywords
with includes.
if sy-subrc > 0.
message e130(enhancement) raising syntax_error.
endif.
*check i_stoken for entries
clear w_linnum.
describe table i_stoken lines w_linnum.
if w_linnum gt 0.
w_level = '1'.
w_prog = i_fmodule-pname2.
w_incl = i_fmodule-pname.
perform data_search tables i_stoken using w_level w_prog w_incl.
endif.
endif.
endloop.
*store development classes
if p_devc = c_x.
loop at i_fmodule.
clear: wa_tadir, wa_enlfdir.
select single area from enlfdir into wa_enlfdir-area
where funcname = i_fmodule-name.
check not wa_enlfdir-area is initial.
select single devclass into wa_tadir-devclass
from tadir where pgmid = 'R3TR'
and object = 'FUGR'
and obj_name = wa_enlfdir-area.
check not wa_tadir-devclass is initial.
move wa_tadir-devclass to i_devclass-clas.
append i_devclass.
i_fmodule-done = c_x.
modify i_fmodule.
endloop.
sort i_devclass.
delete adjacent duplicates from i_devclass.
endif.
endform. "GET_FM_DATA
form get_submit_data.
*data selection message to sap gui
call function 'SAPGUI_PROGRESS_INDICATOR'
destination 'SAPGUI'
keeping logical unit of work
EXPORTING
text = 'Get submit data' "#EC NOTEXT
EXCEPTIONS
system_failure
communication_failure
. "#EC *
sort i_submit.
delete adjacent duplicates from i_submit comparing pname.
w_level = '0'.
loop at i_submit where done ne c_x.
clear: i_stoken, i_sstmnt, sourcetab.
refresh: i_stoken, i_sstmnt, sourcetab.
read report i_submit-pname into sourcetab.
if sy-subrc = 0.
scan abap-source sourcetab tokens into i_stoken
statements into i_sstmnt
keywords from keywords
with includes.
if sy-subrc > 0.
*message e130(enhancement) raising syntax_error.
continue.
endif.
*check i_stoken for entries
clear w_linnum.
describe table i_stoken lines w_linnum.
if w_linnum gt 0.
w_prog = i_submit-pname.
w_incl = ''.
perform data_search tables i_stoken using w_level w_prog w_incl.
endif.
endif.
*restrict number of submit program selected for processing
describe table i_submit lines w_linnum.
if w_linnum ge p_limit.
w_level = '1'.
endif.
i_submit-done = c_x.
modify i_submit.
endloop.
endform. "GET_SUBMIT_DATA
form get_additional_data.
*data selection message to sap gui
call function 'SAPGUI_PROGRESS_INDICATOR'
destination 'SAPGUI'
keeping logical unit of work
EXPORTING
text = 'Get additional data' "#EC NOTEXT
EXCEPTIONS
system_failure
communication_failure
. "#EC *
loop at i_userexit.
*Workflow
if i_userexit-type eq 'WorkFlow'.
continue.
endif.
*Enhancement data
if i_userexit-type cs 'Enh'.
clear: wa_modsapa.
select single name into wa_modsapa-name from modsap
where member = i_userexit-txt.
check sy-subrc = 0.
i_userexit-modname = wa_modsapa-name.
clear wa_modsapt.
select single modtext into wa_modsapt-modtext from modsapt
where name = wa_modsapa-name
and sprsl = sy-langu.
i_userexit-modtext = wa_modsapt-modtext.
*Get the CMOD project name
clear w_mod.
select single modact~member modact~name modattr~status
modattr~anam modattr~adat
into w_mod
from modact
inner join modattr
on modattr~name = modact~name
where modact~member = wa_modsapa-name
and modact~typ = space.
if sy-subrc = 0.
i_userexit-modattr = w_mod.
endif.
endif.
*BADI data
if i_userexit-type eq 'BADI'.
clear wa_sxs_attr.
select single exit_name into wa_sxs_attr-exit_name from sxs_attr
where exit_name = i_userexit-txt.
if sy-subrc = 0.
i_userexit-modname = i_userexit-txt.
else.
i_userexit-modname = 'Dynamic call'. "#EC NOTEXT
endif.
clear wa_sxs_attrt.
select single text into wa_sxs_attrt-text from sxs_attrt
where exit_name = wa_sxs_attr-exit_name
and sprsl = sy-langu.
i_userexit-modtext = wa_sxs_attrt-text.
endif.
*BADI Implementation
if i_userexit-type eq 'BADI'.
clear sxc_exit.
select COUNT( * ) from sxc_exit where exit_name = i_userexit-txt.
w_cnt = sy-dbcnt.
*determine id BADI is for interal or external use
clear sxs_attr.
select single * from sxs_attr where exit_name = i_userexit-txt.
if sxs_attr-internal = 'X'.
wa_sxs_attrt-text = 'SAP '.
else.
wa_sxs_attrt-text = 'CUST'.
endif.
* concatenate wa_sxs_attrt-text w_cnt into i_userexit-modattr-name
* separated by space.
write wa_sxs_attrt-text to i_userexit-modattr-name.
write w_cnt to i_userexit-modattr-name+5.
endif.
modify i_userexit.
endloop.
*get enhancements via program package
clear wa_tadir.
select single devclass into wa_tadir-devclass from tadir
where pgmid = 'R3TR'
and object = 'PROG'
and obj_name = p_pname.
if sy-subrc = 0.
clear: wa_modsapa, wa_modsapt.
select name from modsapa into wa_modsapa-name
where devclass = wa_tadir-devclass.
select single modtext from modsapt into wa_modsapt-modtext
where name = wa_modsapa-name
and sprsl = sy-langu.
clear i_userexit.
read table i_userexit with key modname = wa_modsapa-name.
if sy-subrc 0.
i_userexit-modtext = wa_modsapt-modtext.
i_userexit-type = 'Enhancement'. "#EC NOTEXT
i_userexit-modname = wa_modsapa-name.
i_userexit-txt = 'Determined from program DevClass'."#EC NOTEXT
i_userexit-pname = 'Unknown'. "#EC NOTEXT
append i_userexit.
endif.
endselect.
endif.
*set row colour.
loop at i_userexit.
case i_userexit-type.
when 'BADI'.
i_userexit-colour = 'C601'.
when 'Enhancement'.
i_userexit-colour = 'C501'.
when 'Program Exit'.
i_userexit-colour = 'C401'.
when 'WorkFlow'.
i_userexit-colour = 'C301'.
when 'BusTrEvent'.
i_userexit-colour = 'C201'.
endcase.
modify i_userexit.
endloop.
endform. "GET_ADDITIONAL_DATA
form data_display.
*data selection message to sap gui
call function 'SAPGUI_PROGRESS_INDICATOR'
destination 'SAPGUI'
keeping logical unit of work
EXPORTING
text = 'Prepare screen for display' "#EC NOTEXT
EXCEPTIONS
system_failure
communication_failure
. "#EC *
sort i_userexit by type txt modname.
delete adjacent duplicates from i_userexit comparing txt pname modname.
*ensure records selected.
describe table i_userexit lines w_linnum.
if w_linnum = 0.
message s003(g00). "No data records were selected
exit.
endif.
if p_alv = ' '.
*format headings
write: 'Enhancements from main program: ', p_pname.
write: 'Enhancements from TCode: ', p_tcode.
write: 201''.
uline.
format color col_heading.
write: / sy-vline,
(12) c_col1, "Enhanmt Type
sy-vline,
(40) c_col2, "Enhancement
sy-vline,
(30) c_col3, "Program/Include
sy-vline,
(20) c_col4, "Enhancement name
sy-vline,
(40) c_col5, "Enhancement description
sy-vline,
(8) c_col6, "Project
sy-vline,
(1) c_col7, "S
sy-vline,
(12) c_col8, "ChangeName
sy-vline,
(10) c_col9, "ChangeDate
sy-vline.
format reset.
uline.
* format lines
loop at i_userexit.
*set line colour
case i_userexit-type.
when 'Enhancement'.
format color 3 intensified off.
when 'BADI'.
format color 4 intensified off.
when 'BusTrEvent'.
format color 5 intensified off.
when 'Program Exit'.
format color 6 intensified off.
when others.
format reset.
endcase.
write: / sy-vline,
i_userexit-type,
sy-vline,
i_userexit-txt(40),
sy-vline,
i_userexit-pname(30),
sy-vline,
i_userexit-modname(20),
sy-vline,
i_userexit-modtext(40),
sy-vline.
write: i_userexit-modattr-name,
sy-vline,
i_userexit-modattr-status,
sy-vline,
i_userexit-modattr-anam,
sy-vline,
i_userexit-modattr-adat no-zero,
sy-vline.
hide: i_userexit-modname, i_userexit-type, i_userexit-modattr-name.
endloop.
format reset.
uline.
*user-exits from development class of function modules
if p_devc = c_x.
write: /.
write: / c_devc.
write: 201''.
uline (90).
write: 201''.
loop at i_devclass.
clear wa_modsapa.
select name from modsapa into wa_modsapa
where devclass = i_devclass-clas.
select single name modtext into corresponding fields of wa_modsapt
from modsapt
where name = wa_modsapa-name
and sprsl = sy-langu.
format color 3 intensified off.
write: / sy-vline,
(12) 'Enhancement',
sy-vline,
wa_modsapa-name,
sy-vline,
wa_modsapt-modtext,
sy-vline.
endselect.
endloop.
write: 201''.
uline (90).
format reset.
endif.
* display fuction modules used in program
write /.
describe table i_fmodule lines w_linnum.
write: / c_fmod , at 35 w_linnum. "#EC NOTEXT
write: 201''.
if p_func = c_x.
uline (38).
write: 201''.
loop at i_fmodule.
write: sy-vline,
i_fmodule-name,
sy-vline,
i_fmodule-bapi,
sy-vline.
write: 201''.
endloop.
write: 201''.
uline (38).
endif.
*display submit programs used in program
write /.
describe table i_submit lines w_linnum.
write: / c_subm , at 35 w_linnum. "#EC NOTEXT
write: 201''.
if p_subm = c_x.
uline (44).
write: 201''.
loop at i_submit.
write: sy-vline,
i_submit-pname,
sy-vline.
write: 201''.
endloop.
write: 201''.
uline (44).
endif.
*issue message with number of user-exits displayed
describe table i_userexit lines w_linnum.
message s697(56) with w_linnum.
else. " Show in alv format
*issue message with number of user-exits displayed
describe table i_userexit lines w_linnum.
message s697(56) with w_linnum.
*Create field catalog
perform create_field_catalog using 'TYPE' 'T_USEREXIT' ' ' 'Typ
e'.
perform create_field_catalog using 'PNAME' 'T_USEREXIT' ' ' 'Pro
g?am name'.
perform create_field_catalog using 'TXT' 'T_USEREXIT' ' ' 'Enh
ancement'.
perform create_field_catalog using 'LEVEL' 'T_USEREXIT' c_x 'Lev
el'.
perform create_field_catalog using 'MODNAME' 'T_USEREXIT' ' ' 'Enh
ancement name'.
perform create_field_catalog using 'MODTEXT' 'T_USEREXIT' ' ' 'Enh
ancement text'.
perform create_field_catalog using 'MODATTR-MEMBER' 'T_USEREXIT' c_x 'Mem
ber'.
perform create_field_catalog using 'MODATTR-NAME' 'T_USEREXIT' ' ' 'Pro
ject'.
perform create_field_catalog using 'MODATTR-STATUS' 'T_USEREXIT' ' ' 'Sta
tus'.
perform create_field_catalog using 'MODATTR-ANAM' 'T_USEREXIT' ' ' 'Cha
nged by'.
perform create_field_catalog using 'MODATTR-ADAT' 'T_USEREXIT' ' ' 'Cha
nge date'.
*Layout
clear i_layout.
i_layout-colwidth_optimize = c_x.
i_layout-info_fieldname = 'COLOUR'.
*Sort
clear i_sort.
i_sort-fieldname = 'TYPE'.
i_sort-tabname = 'T_USEREXIT'.
i_sort-up = c_x.
append i_sort.
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-cprog
i_callback_user_command = 'USER_COMMAND'
is_layout = i_layout
it_fieldcat = i_fieldcat[]
it_sort = i_sort[]
i_default = c_x
i_save = 'A'
i_grid_title = w_gridtxt
TABLES
t_outtab = i_userexit.
endif.
*issue message with number of user-exits displayed
describe table i_userexit lines w_linnum.
message s697(56) with w_linnum.
endform. "DATA_DISPLAY
form create_field_catalog using p_fieldname
p_tabname
p_hide
p_text.
i_fieldcat-fieldname = p_fieldname.
i_fieldcat-tabname = p_tabname.
i_fieldcat-no_out = p_hide.
i_fieldcat-seltext_l = p_text.
append i_fieldcat.
endform. " CREATE_FIELD_CATALOG