04-04-2006 2:17 PM
Hi
Guys.
Is there any table which contains all the function module of the IDOC.
My requirement is like this.
I want to write a report where i will enter any IDOC name name in a selection screen through a parameter option and i will get the output as the USEREXIT of that particular IDOC
If anybody came across such kind of requirement than plz send me the sample codes.
Thanks a lot
Mrutyunjaya Tripathy
04-05-2006 11:58 AM
Hi,
Please refer this sample pgm.Something similar to your reqmt I suppose.Maybe it gives you an idea.
report zuserexit_iden
line-size 132 line-count 65(3)
no standard page heading.
type-pools : slis.
tables : tstc, "SAP Transaction Codes
tadir, "Directory of Repository Objects
modsapt, "SAP Enhancements - Short Texts
modact, "Modifications
trdir, "System table TRDIR
tfdir, "Function Module
enlfdir, "Additional Attributes for Function Modules
modsap, "SAP Extensions
tstct, "Transaction Code Texts
sscrfields, "Fields on selection screens
tftit, "Function Module Short Text
edifct. "IDoc: Assignment of FM to log.
data : jtab like tadir occurs 0 with header line.
data : begin of jtab1 occurs 0,
obj_name like tadir-obj_name ,
modtext like modsapt-modtext,
end of jtab1.
data : v_devclass like tadir-devclass,
p_modname like modsap-member.
data: ws_pgnam(40),
ws_exits(3) type c,
ws_fexits(3) type c,
ws_flag type c,
ws_func like edifct-fctnam.
************************************************************************
* SELECTION-SCREEN *
************************************************************************
selection-screen begin of block b1 with frame .
parameters: rad1 radiobutton group rad user-command ucom1 modif id xy1,
rad2 radiobutton group rad modif id xy2,
rad3 radiobutton group rad modif id xy3,
rad4 radiobutton group rad modif id xy7.
selection-screen end of block b1.
selection-screen skip 3.
parameters : p_tcode like tstc-tcode modif id xy4,
p_prog like tstc-pgmna modif id xy5,
p_func like tfdir-funcname modif id xy6,
p_idoc like vediedifct-mestyp modif id xy8.
selection-screen skip 2.
selection-screen begin of block b2 with frame .
parameters : p_texit as checkbox modif id xy9,
p_fexit as checkbox modif id x10,
p_sexit as checkbox modif id x11,
p_mexit as checkbox modif id x12.
selection-screen end of block b2.
************************************************************************
* INTERNAL TABLES *
************************************************************************
************ FOR ALV - GRID
data: i_fcat type slis_fieldcat_alv occurs 0, " fieldcatalog
i_fcat1 type slis_fieldcat_alv occurs 0,
i_fcat2 type slis_fieldcat_alv occurs 0,
i_fcat3 type slis_fieldcat_alv occurs 0,
i_fcat4 type slis_fieldcat_alv occurs 0,
i_layt type slis_layout_alv occurs 0, " layout
linecolor1 type slis_specialcol_alv.
*********** For collecting the types of Exits
data: begin of subscreens occurs 10,
gdynprog like mod0-gdynprog,
gdynnr(4) type n,
bername like mod0-bername,
cdynprog like mod0-cdynprog,
cdynnr(4) type n,
stext like mod0-stext,
end of subscreens.
data: begin of cua_codes occurs 10,
cuaprog like mod0-cuaprog,
cuafun like mod0-cuafun,
stext like rseu0_mod-l_text,
end of cua_codes.
data: begin of function_exits occurs 10,
funcname like mod0-funcname,
stext like tftit-stext,
end of function_exits.
data: begin of incl_tables occurs 10,
incltab like mod0-incltab,
end of incl_tables.
data: begin of i_exits occurs 0,
funcname like mod0-funcname,
stext like tftit-stext,
bername like mod0-bername,
stext1 like mod0-stext,
cuafun like mod0-cuafun,
stext2 like rseu0_mod-l_text,
incltab like mod0-incltab,
end of i_exits.
************************************************************************
* WORK AREAS *
************************************************************************
data: i_fieldcat like line of i_fcat,
i_layout like line of i_layt.
data: t_event type slis_t_event, " Event
t_uevent type slis_alv_event.
data: gc_formname_top_of_page type slis_formname value 'TOP_OF_PAGE'.
data: gc_formname_end_of_page1 type slis_formname value 'END_OF_PAGE1'.
data: gc_formname_end_of_page2 type slis_formname value 'END_OF_PAGE2'.
data: gt_list_top_of_page type slis_t_listheader.
data: gt_list_end_of_page type slis_t_listheader.
************************************************************************
* AT SELECTION-SCREEN OUTPUT. *
************************************************************************
at selection-screen output.
loop at screen.
if ( rad1 = 'X' and screen-group1 = 'XY5' )
or ( rad1 = 'X' and screen-group1 = 'XY6' )
or ( rad1 = 'X' and screen-group1 = 'XY8' ) .
screen-invisible = '1'.
screen-input = '0'.
modify screen.
elseif ( rad2 = 'X' and screen-group1 = 'XY4' )
or ( rad2 = 'X' and screen-group1 = 'XY6' )
or ( rad2 = 'X' and screen-group1 = 'XY8' ) .
screen-invisible = '1'.
screen-input = '0'.
modify screen.
elseif ( rad3 = 'X' and screen-group1 = 'XY5' )
or ( rad3 = 'X' and screen-group1 = 'XY4' )
or ( rad3 = 'X' and screen-group1 = 'XY8' ) .
screen-invisible = '1'.
screen-input = '0'.
modify screen.
elseif ( rad4 = 'X' and screen-group1 = 'XY5' )
or ( rad4 = 'X' and screen-group1 = 'XY4' )
or ( rad4 = 'X' and screen-group1 = 'XY6' )
or ( rad4 = 'X' and screen-group1 = 'XY9' )
or ( rad4 = 'X' and screen-group1 = 'X11' )
or ( rad4 = 'X' and screen-group1 = 'X12' ).
screen-invisible = '1'.
screen-input = '0'.
modify screen.
endif.
endloop.
************************************************************************
* AT SELECTION-SCREEN . *
************************************************************************
at selection-screen.
if not p_tcode is initial.
select single * from tstc where tcode eq p_tcode.
if sy-subrc ne 0.
message e001(z353) with 'Transaction Code Does Not Exist'.
endif.
elseif not p_prog is initial.
select single * from tadir where pgmid = 'R3TR'
and object = 'PROG'
and obj_name = p_prog.
if sy-subrc ne 0.
message e002(z353) with 'Program Does Not Exist'.
endif.
elseif not p_func is initial.
select single * from enlfdir where funcname =
p_func.
if sy-subrc ne 0.
message e003(z353) with 'Function Module Does Not Exist'.
endif.
elseif not p_idoc is initial.
select single * from edifct where mestyp =
p_idoc.
if sy-subrc ne 0.
message e004(z353) with 'Message Type Does Not Exist'.
endif.
endif.
************************************************************************
* START-OF-SELECTION. *
************************************************************************
start-of-selection.
if rad3 = 'X'.
select single *
from enlfdir
where funcname = p_func.
select single *
from tadir
where pgmid = 'R3TR'
and object = 'FUGR'
and obj_name eq enlfdir-area.
move : tadir-devclass to v_devclass.
if sy-subrc ne 0.
perform trdir.
if trdir-subc eq 'F'.
perform fgroup.
endif.
endif.
perform uexits.
perform write_list1.
elseif rad2 = 'X'.
ws_pgnam = p_prog.
perform tadir.
clear ws_pgnam.
move : tadir-devclass to v_devclass.
if sy-subrc ne 0.
perform trdir.
if trdir-subc eq 'F'.
perform fgroup.
endif.
endif.
perform uexits.
perform write_list1.
elseif rad1 = 'X'.
select single *
from tstc
where tcode eq p_tcode.
if sy-subrc eq 0.
ws_pgnam = tstc-pgmna.
perform tadir.
endif.
move : tadir-devclass to v_devclass.
if sy-subrc ne 0.
perform trdir.
if trdir-subc eq 'F'.
perform fgroup.
endif.
endif.
perform uexits.
perform write_list1.
elseif rad4 = 'X'.
select single fctnam from edifct
into ws_func
where mestyp = p_idoc.
if sy-subrc eq 0.
select single *
from enlfdir
where funcname = edifct-fctnam.
select single *
from tadir
where pgmid = 'R3TR'
and object = 'FUGR'
and obj_name eq enlfdir-area.
move : tadir-devclass to v_devclass.
elseif sy-subrc ne 0.
perform trdir.
if trdir-subc eq 'F'.
perform fgroup.
endif.
endif.
perform uexits.
perform write_list1.
else.
format color col_negative intensified on.
write:/(95) 'Transaction Code Does Not Exist'.
endif.
*---------------------------------------------------------------------*
* FORM TADIR *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form tadir.
select single * from tadir where pgmid = 'R3TR'
and object = 'PROG'
and obj_name = ws_pgnam.
if sy-subrc ne 0.
write:/(95) 'PROGRAM Does Not Exist'.
endif.
endform.
*---------------------------------------------------------------------*
* FORM TRDIR *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form trdir.
select single * from trdir where name = tstc-pgmna.
endform.
*---------------------------------------------------------------------*
* FORM FGROUP *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form fgroup.
select single * from tfdir where pname = tstc-pgmna.
select single * from enlfdir where funcname =
tfdir-funcname.
select single * from tadir where pgmid = 'R3TR'
and object = 'FUGR'
and obj_name eq enlfdir-area.
move : tadir-devclass to v_devclass.
endform.
*---------------------------------------------------------------------*
* FORM UEXITS *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form uexits.
select * from tadir into table jtab
where pgmid = 'R3TR'
and object = 'SMOD'
and devclass = v_devclass.
select single * from tstct where sprsl eq sy-langu and
tcode eq p_tcode.
endform.
*---------------------------------------------------------------------*
* FORM write_list1 *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form write_list1.
if not jtab[] is initial.
loop at jtab.
select single * from modsapt
where sprsl = sy-langu and
name = jtab-obj_name.
jtab1-obj_name = jtab-obj_name.
jtab1-modtext = modsapt-modtext.
append jtab1.
endloop.
describe table jtab1.
ws_exits = sy-tfill.
perform f2001_populate_fieldcatalog changing i_fcat.
perform f2003_build_layout.
perform f2004_e_event using t_event.
perform f2005_call_alv.
else.
format color col_negative intensified on.
write:/(95) 'No User Exit exists'.
endif.
endform.
*---------------------------------------------------------------------*
* FORM f2001_populate_fieldcatalog *
*---------------------------------------------------------------------*
form f2001_populate_fieldcatalog
changing i_fcat_alv type slis_t_fieldcat_alv.
i_fieldcat-tabname = 'JTAB1'.
i_fieldcat-fieldname = 'OBJ_NAME'.
i_fieldcat-seltext_m = 'Modification Name'.
i_fieldcat-hotspot = '1'.
append i_fieldcat to i_fcat.
clear i_fieldcat.
i_fieldcat-tabname = 'JTAB1'.
i_fieldcat-fieldname = 'MODTEXT'.
i_fieldcat-seltext_m = 'Description'.
append i_fieldcat to i_fcat.
clear i_fieldcat.
i_fieldcat-tabname = 'I_EXITS'.
i_fieldcat-fieldname = 'FUNCNAME'.
i_fieldcat-seltext_m = 'FUNCTION EXIT NAME'.
if p_fexit = space.
i_fieldcat-no_out = 'X'.
endif.
append i_fieldcat to i_fcat1.
clear i_fieldcat.
i_fieldcat-tabname = 'I_EXITS'.
i_fieldcat-fieldname = 'STEXT'.
i_fieldcat-seltext_m = 'FUNCTION EXIT DESCRIPTION'.
if p_fexit = space.
i_fieldcat-no_out = 'X'.
endif.
append i_fieldcat to i_fcat1.
clear i_fieldcat.
i_fieldcat-tabname = 'I_EXITS'.
i_fieldcat-fieldname = 'BERNAME'.
i_fieldcat-seltext_m = 'SUBSCREEN NAME'.
if p_sexit = space.
i_fieldcat-no_out = 'X'.
endif.
append i_fieldcat to i_fcat1.
clear i_fieldcat.
i_fieldcat-tabname = 'I_EXITS'.
i_fieldcat-fieldname = 'STEXT1'.
i_fieldcat-seltext_m = 'SUBSCREEN DESCRIPTION'.
if p_sexit = space.
i_fieldcat-no_out = 'X'.
endif.
append i_fieldcat to i_fcat1.
clear i_fieldcat.
i_fieldcat-tabname = 'I_EXITS'.
i_fieldcat-fieldname = 'CUAFUN'.
i_fieldcat-seltext_m = 'MENU EXIT NAME'.
if p_mexit = space.
i_fieldcat-no_out = 'X'.
endif.
append i_fieldcat to i_fcat1.
clear i_fieldcat.
i_fieldcat-tabname = 'I_EXITS'.
i_fieldcat-fieldname = 'STEXT2'.
i_fieldcat-seltext_m = 'MENU EXIT DESCRIPTION'.
if p_mexit = space.
i_fieldcat-no_out = 'X'.
endif.
append i_fieldcat to i_fcat1.
clear i_fieldcat.
i_fieldcat-tabname = 'I_EXITS'.
i_fieldcat-fieldname = 'INCLTAB'.
i_fieldcat-seltext_m = 'NAME OF THE INCLUDE TABLE'.
if p_texit = space.
i_fieldcat-no_out = 'X'.
endif.
append i_fieldcat to i_fcat1.
clear i_fieldcat.
endform. " populate_fieldcatalog
*---------------------------------------------------------------------*
* FORM f2003_build_layout *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form f2003_build_layout.
clear i_layout.
i_layout-no_keyfix = 'X'. " to move key columns
i_layout-colwidth_optimize = 'X'.
i_layout-coltab_fieldname = 'LINECOLOR'.
endform.
*---------------------------------------------------------------------*
* FORM f2004_e_event *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> I_EVENT *
*---------------------------------------------------------------------*
form f2004_e_event changing i_event type slis_t_event .
data: gt_event type slis_alv_event.
gt_event-name = slis_ev_top_of_list.
gt_event-form = 'TOP_OF_PAGE'.
append gt_event to i_event.
gt_event-name = slis_ev_end_of_list.
gt_event-form = 'END_OF_PAGE1'.
append gt_event to i_event.
endform.
*---------------------------------------------------------------------*
* FORM f2005_e_event *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> I_EVENT *
*---------------------------------------------------------------------*
form f2005_e_event changing i_event type slis_t_event.
data: gt_event1 type slis_alv_event.
refresh : i_event.
gt_event1-name = slis_ev_top_of_list.
gt_event1-form = 'TOP_OF_PAGE'.
append gt_event1 to i_event.
gt_event1-name = slis_ev_end_of_list.
gt_event1-form = 'END_OF_PAGE2'.
append gt_event1 to i_event.
endform.
*---------------------------------------------------------------------*
* FORM f2005_call_alv *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form f2005_call_alv.
data: ws_text type lvc_title,
ws_text1 type lvc_title.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_bypassing_buffer = 'X'
i_callback_program = 'ZUSEREXIT_IDEN'
i_callback_user_command = 'F2006_USER_COMMAND'
i_callback_top_of_page = 'F3002_TOP_OF_PAGE'
i_grid_title = 'List of User-Exits'
is_layout = i_layout
it_fieldcat = i_fcat
it_events = t_event
tables
t_outtab = jtab1
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message e888(ztest) with 'Error in Function Module'.
endif.
clear ws_text.
endform.
*---------------------------------------------------------------------*
* FORM f2006_call_alv *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form f2006_call_alv.
data: ws_text type lvc_title,
ws_text1 type lvc_title.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_bypassing_buffer = 'X'
i_callback_program = 'ZUSEREXIT_IDEN'
i_callback_user_command = 'F2006_USER_COMMAND'
i_callback_top_of_page = 'F3002_TOP_OF_PAGE'
i_grid_title = 'List of User-Exits'
is_layout = i_layout
it_fieldcat = i_fcat1
it_events = t_event
tables
t_outtab = i_exits
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message e888(ztest) with 'Error in Function Module'.
endif.
clear ws_text.
endform.
*---------------------------------------------------------------------*
* FORM e06_comment_build *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> E06_LT_END_OF_PAGE *
*---------------------------------------------------------------------*
form e06_comment_build
using e06_lt_end_of_page type slis_t_listheader.
data: ls_line type slis_listheader.
data: ws_c_uname(200).
describe table jtab lines ws_exits.
concatenate 'No: Of Exits:' ws_exits into ws_c_uname.
ls_line-typ = 'S'.
ls_line-info = ws_c_uname.
append ls_line to e06_lt_end_of_page.
clear : ws_c_uname.
endform.
*---------------------------------------------------------------------*
* FORM e07_comment_build *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> E07_LT_END_OF_PAGE *
*---------------------------------------------------------------------*
form e07_comment_build
using e07_lt_end_of_page type slis_t_listheader.
data: ls_line type slis_listheader.
data: ws_c_uname(200).
describe table i_exits lines ws_fexits.
concatenate 'No: Of Exits:' ws_fexits into ws_c_uname.
ls_line-typ = 'S'.
ls_line-info = ws_c_uname.
append ls_line to e07_lt_end_of_page.
clear : ws_c_uname.
endform.
*---------------------------------------------------------------------*
* FORM f3002_top_of_page *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form f3002_top_of_page.
data: it_list_top_of_page type slis_t_listheader,
it_list_end_of_page type slis_t_listheader,
ls_line type slis_listheader.
data: ws_c_uname1(200).
if rad1 = 'X'.
concatenate 'Transaction Code -' p_tcode into ws_c_uname1.
elseif rad2 = 'X'.
concatenate 'PROGRAM -' p_prog into ws_c_uname1.
elseif rad3 = 'X'.
concatenate 'FUNCTION MODULE -' p_func into ws_c_uname1.
elseif rad4 = 'X'.
concatenate 'IDoc Message Type -' p_idoc into ws_c_uname1.
endif.
ls_line-typ = 'H'.
ls_line-info = ws_c_uname1.
append ls_line to it_list_top_of_page.
clear : ls_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = it_list_top_of_page.
endform. " f3002_build_event.
*---------------------------------------------------------------------*
* FORM end_of_page *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form end_of_page1.
refresh: gt_list_end_of_page.
perform e06_comment_build using
gt_list_end_of_page[].
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = ''
it_list_commentary = gt_list_end_of_page
i_end_of_list_grid = 1.
endform. "END_OF_PAGE
*---------------------------------------------------------------------*
* FORM end_of_page *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form end_of_page2.
refresh: gt_list_end_of_page.
perform e07_comment_build using
gt_list_end_of_page[].
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = ''
it_list_commentary = gt_list_end_of_page
i_end_of_list_grid = 1.
endform. "END_OF_PAGE
*---------------------------------------------------------------------*
* FORM f00421_user_command *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> R_UCOMM *
* --> RS_SELFIELD *
*---------------------------------------------------------------------*
form f2006_user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case rs_selfield-sel_tab_field.
when 'JTAB1-OBJ_NAME'.
p_modname = rs_selfield-value.
perform collect_exits.
refresh i_fcat1.
refresh gt_list_end_of_page.
perform f2001_populate_fieldcatalog changing i_fcat1.
perform f2003_build_layout.
perform f2005_e_event changing t_event.
perform f2006_call_alv.
endcase.
endform.
*---------------------------------------------------------------------*
* FORM collect_exits *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form collect_exits.
select * from modsap
where name = p_modname.
check modsap-member >< space.
case modsap-typ.
when 'E'.
clear function_exits.
function_exits-funcname = modsap-member.
select single * from tftit
where funcname = modsap-member and
spras = 'E'.
function_exits-stext = tftit-stext.
append function_exits.
when 'C'.
clear cua_codes.
call function 'MOD_SAP_MEMBER_PARTS'
exporting
member = modsap-member
typ = 'C'
importing
gprogname = cua_codes-cuaprog
cuacode = cua_codes-cuafun.
append cua_codes.
when 'S'.
clear subscreens.
call function 'MOD_SAP_MEMBER_PARTS'
exporting
member = modsap-member
typ = 'S'
importing
gprogname = subscreens-gdynprog
gdynnr = subscreens-gdynnr
bername = subscreens-bername
cprogname = subscreens-cdynprog
cdynnr = subscreens-cdynnr.
append subscreens.
when 'T'.
clear incl_tables.
incl_tables-incltab = modsap-member.
append incl_tables.
endcase.
endselect.
if not function_exits[] is initial.
loop at function_exits.
move-corresponding function_exits to i_exits.
if not subscreens[] is initial.
loop at subscreens.
move-corresponding subscreens to i_exits.
endloop.
endif.
if not incl_tables[] is initial." and
loop at incl_tables.
move-corresponding incl_tables to i_exits.
endloop.
endif.
append i_exits.
describe table i_exits.
ws_fexits = sy-tfill.
endloop.
endif.
endform.
*---End of Program
Regards,
Gayathri
04-04-2006 2:23 PM
Hi mrutyunjaya,
1. EDIFCT
This is the table.
2. U can also use the view VEDIEDIFCT.
regards,
amit m.
04-04-2006 2:27 PM
Hi,
IDoc processing FM's are stored in table <b>EDIFCT</b>,
may be some thing like this you need to do .
get the FM with the IDOC type from EDICT, then using the FM scan it for <b>CALL CUSTOMER-FUNCTION</b>, may be you can list out all such occurences as the exits(you should look or scan in FM main program "global search).
Regards
vijay
04-05-2006 11:49 AM
HI VIJAY
THANKS FOR YOUR KIND INPUTS,BUT I AM GETTING CONFUSE HOW TO SCAN CALL CUSTOMER-FUNCTION USING THE FM AND WHAT FM I HAVE TO USE FOR THAT.
CAN YOU GIVE SOME MORE INPUTS IN THIS ISSUE.
THANKS
MRUTYUNJAYA TRIPATHY
04-05-2006 11:55 AM
Hi,
first you need to get the FM's main program to do global search, using that Main program you can do a sumbit to
<b>RPR_ABAP_SOURCE_SCAN</b> or you can use READ REPORT syntax and read it and look for the call customer-function.
Regards
vijay
04-05-2006 11:58 AM
Hi,
Please refer this sample pgm.Something similar to your reqmt I suppose.Maybe it gives you an idea.
report zuserexit_iden
line-size 132 line-count 65(3)
no standard page heading.
type-pools : slis.
tables : tstc, "SAP Transaction Codes
tadir, "Directory of Repository Objects
modsapt, "SAP Enhancements - Short Texts
modact, "Modifications
trdir, "System table TRDIR
tfdir, "Function Module
enlfdir, "Additional Attributes for Function Modules
modsap, "SAP Extensions
tstct, "Transaction Code Texts
sscrfields, "Fields on selection screens
tftit, "Function Module Short Text
edifct. "IDoc: Assignment of FM to log.
data : jtab like tadir occurs 0 with header line.
data : begin of jtab1 occurs 0,
obj_name like tadir-obj_name ,
modtext like modsapt-modtext,
end of jtab1.
data : v_devclass like tadir-devclass,
p_modname like modsap-member.
data: ws_pgnam(40),
ws_exits(3) type c,
ws_fexits(3) type c,
ws_flag type c,
ws_func like edifct-fctnam.
************************************************************************
* SELECTION-SCREEN *
************************************************************************
selection-screen begin of block b1 with frame .
parameters: rad1 radiobutton group rad user-command ucom1 modif id xy1,
rad2 radiobutton group rad modif id xy2,
rad3 radiobutton group rad modif id xy3,
rad4 radiobutton group rad modif id xy7.
selection-screen end of block b1.
selection-screen skip 3.
parameters : p_tcode like tstc-tcode modif id xy4,
p_prog like tstc-pgmna modif id xy5,
p_func like tfdir-funcname modif id xy6,
p_idoc like vediedifct-mestyp modif id xy8.
selection-screen skip 2.
selection-screen begin of block b2 with frame .
parameters : p_texit as checkbox modif id xy9,
p_fexit as checkbox modif id x10,
p_sexit as checkbox modif id x11,
p_mexit as checkbox modif id x12.
selection-screen end of block b2.
************************************************************************
* INTERNAL TABLES *
************************************************************************
************ FOR ALV - GRID
data: i_fcat type slis_fieldcat_alv occurs 0, " fieldcatalog
i_fcat1 type slis_fieldcat_alv occurs 0,
i_fcat2 type slis_fieldcat_alv occurs 0,
i_fcat3 type slis_fieldcat_alv occurs 0,
i_fcat4 type slis_fieldcat_alv occurs 0,
i_layt type slis_layout_alv occurs 0, " layout
linecolor1 type slis_specialcol_alv.
*********** For collecting the types of Exits
data: begin of subscreens occurs 10,
gdynprog like mod0-gdynprog,
gdynnr(4) type n,
bername like mod0-bername,
cdynprog like mod0-cdynprog,
cdynnr(4) type n,
stext like mod0-stext,
end of subscreens.
data: begin of cua_codes occurs 10,
cuaprog like mod0-cuaprog,
cuafun like mod0-cuafun,
stext like rseu0_mod-l_text,
end of cua_codes.
data: begin of function_exits occurs 10,
funcname like mod0-funcname,
stext like tftit-stext,
end of function_exits.
data: begin of incl_tables occurs 10,
incltab like mod0-incltab,
end of incl_tables.
data: begin of i_exits occurs 0,
funcname like mod0-funcname,
stext like tftit-stext,
bername like mod0-bername,
stext1 like mod0-stext,
cuafun like mod0-cuafun,
stext2 like rseu0_mod-l_text,
incltab like mod0-incltab,
end of i_exits.
************************************************************************
* WORK AREAS *
************************************************************************
data: i_fieldcat like line of i_fcat,
i_layout like line of i_layt.
data: t_event type slis_t_event, " Event
t_uevent type slis_alv_event.
data: gc_formname_top_of_page type slis_formname value 'TOP_OF_PAGE'.
data: gc_formname_end_of_page1 type slis_formname value 'END_OF_PAGE1'.
data: gc_formname_end_of_page2 type slis_formname value 'END_OF_PAGE2'.
data: gt_list_top_of_page type slis_t_listheader.
data: gt_list_end_of_page type slis_t_listheader.
************************************************************************
* AT SELECTION-SCREEN OUTPUT. *
************************************************************************
at selection-screen output.
loop at screen.
if ( rad1 = 'X' and screen-group1 = 'XY5' )
or ( rad1 = 'X' and screen-group1 = 'XY6' )
or ( rad1 = 'X' and screen-group1 = 'XY8' ) .
screen-invisible = '1'.
screen-input = '0'.
modify screen.
elseif ( rad2 = 'X' and screen-group1 = 'XY4' )
or ( rad2 = 'X' and screen-group1 = 'XY6' )
or ( rad2 = 'X' and screen-group1 = 'XY8' ) .
screen-invisible = '1'.
screen-input = '0'.
modify screen.
elseif ( rad3 = 'X' and screen-group1 = 'XY5' )
or ( rad3 = 'X' and screen-group1 = 'XY4' )
or ( rad3 = 'X' and screen-group1 = 'XY8' ) .
screen-invisible = '1'.
screen-input = '0'.
modify screen.
elseif ( rad4 = 'X' and screen-group1 = 'XY5' )
or ( rad4 = 'X' and screen-group1 = 'XY4' )
or ( rad4 = 'X' and screen-group1 = 'XY6' )
or ( rad4 = 'X' and screen-group1 = 'XY9' )
or ( rad4 = 'X' and screen-group1 = 'X11' )
or ( rad4 = 'X' and screen-group1 = 'X12' ).
screen-invisible = '1'.
screen-input = '0'.
modify screen.
endif.
endloop.
************************************************************************
* AT SELECTION-SCREEN . *
************************************************************************
at selection-screen.
if not p_tcode is initial.
select single * from tstc where tcode eq p_tcode.
if sy-subrc ne 0.
message e001(z353) with 'Transaction Code Does Not Exist'.
endif.
elseif not p_prog is initial.
select single * from tadir where pgmid = 'R3TR'
and object = 'PROG'
and obj_name = p_prog.
if sy-subrc ne 0.
message e002(z353) with 'Program Does Not Exist'.
endif.
elseif not p_func is initial.
select single * from enlfdir where funcname =
p_func.
if sy-subrc ne 0.
message e003(z353) with 'Function Module Does Not Exist'.
endif.
elseif not p_idoc is initial.
select single * from edifct where mestyp =
p_idoc.
if sy-subrc ne 0.
message e004(z353) with 'Message Type Does Not Exist'.
endif.
endif.
************************************************************************
* START-OF-SELECTION. *
************************************************************************
start-of-selection.
if rad3 = 'X'.
select single *
from enlfdir
where funcname = p_func.
select single *
from tadir
where pgmid = 'R3TR'
and object = 'FUGR'
and obj_name eq enlfdir-area.
move : tadir-devclass to v_devclass.
if sy-subrc ne 0.
perform trdir.
if trdir-subc eq 'F'.
perform fgroup.
endif.
endif.
perform uexits.
perform write_list1.
elseif rad2 = 'X'.
ws_pgnam = p_prog.
perform tadir.
clear ws_pgnam.
move : tadir-devclass to v_devclass.
if sy-subrc ne 0.
perform trdir.
if trdir-subc eq 'F'.
perform fgroup.
endif.
endif.
perform uexits.
perform write_list1.
elseif rad1 = 'X'.
select single *
from tstc
where tcode eq p_tcode.
if sy-subrc eq 0.
ws_pgnam = tstc-pgmna.
perform tadir.
endif.
move : tadir-devclass to v_devclass.
if sy-subrc ne 0.
perform trdir.
if trdir-subc eq 'F'.
perform fgroup.
endif.
endif.
perform uexits.
perform write_list1.
elseif rad4 = 'X'.
select single fctnam from edifct
into ws_func
where mestyp = p_idoc.
if sy-subrc eq 0.
select single *
from enlfdir
where funcname = edifct-fctnam.
select single *
from tadir
where pgmid = 'R3TR'
and object = 'FUGR'
and obj_name eq enlfdir-area.
move : tadir-devclass to v_devclass.
elseif sy-subrc ne 0.
perform trdir.
if trdir-subc eq 'F'.
perform fgroup.
endif.
endif.
perform uexits.
perform write_list1.
else.
format color col_negative intensified on.
write:/(95) 'Transaction Code Does Not Exist'.
endif.
*---------------------------------------------------------------------*
* FORM TADIR *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form tadir.
select single * from tadir where pgmid = 'R3TR'
and object = 'PROG'
and obj_name = ws_pgnam.
if sy-subrc ne 0.
write:/(95) 'PROGRAM Does Not Exist'.
endif.
endform.
*---------------------------------------------------------------------*
* FORM TRDIR *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form trdir.
select single * from trdir where name = tstc-pgmna.
endform.
*---------------------------------------------------------------------*
* FORM FGROUP *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form fgroup.
select single * from tfdir where pname = tstc-pgmna.
select single * from enlfdir where funcname =
tfdir-funcname.
select single * from tadir where pgmid = 'R3TR'
and object = 'FUGR'
and obj_name eq enlfdir-area.
move : tadir-devclass to v_devclass.
endform.
*---------------------------------------------------------------------*
* FORM UEXITS *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form uexits.
select * from tadir into table jtab
where pgmid = 'R3TR'
and object = 'SMOD'
and devclass = v_devclass.
select single * from tstct where sprsl eq sy-langu and
tcode eq p_tcode.
endform.
*---------------------------------------------------------------------*
* FORM write_list1 *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form write_list1.
if not jtab[] is initial.
loop at jtab.
select single * from modsapt
where sprsl = sy-langu and
name = jtab-obj_name.
jtab1-obj_name = jtab-obj_name.
jtab1-modtext = modsapt-modtext.
append jtab1.
endloop.
describe table jtab1.
ws_exits = sy-tfill.
perform f2001_populate_fieldcatalog changing i_fcat.
perform f2003_build_layout.
perform f2004_e_event using t_event.
perform f2005_call_alv.
else.
format color col_negative intensified on.
write:/(95) 'No User Exit exists'.
endif.
endform.
*---------------------------------------------------------------------*
* FORM f2001_populate_fieldcatalog *
*---------------------------------------------------------------------*
form f2001_populate_fieldcatalog
changing i_fcat_alv type slis_t_fieldcat_alv.
i_fieldcat-tabname = 'JTAB1'.
i_fieldcat-fieldname = 'OBJ_NAME'.
i_fieldcat-seltext_m = 'Modification Name'.
i_fieldcat-hotspot = '1'.
append i_fieldcat to i_fcat.
clear i_fieldcat.
i_fieldcat-tabname = 'JTAB1'.
i_fieldcat-fieldname = 'MODTEXT'.
i_fieldcat-seltext_m = 'Description'.
append i_fieldcat to i_fcat.
clear i_fieldcat.
i_fieldcat-tabname = 'I_EXITS'.
i_fieldcat-fieldname = 'FUNCNAME'.
i_fieldcat-seltext_m = 'FUNCTION EXIT NAME'.
if p_fexit = space.
i_fieldcat-no_out = 'X'.
endif.
append i_fieldcat to i_fcat1.
clear i_fieldcat.
i_fieldcat-tabname = 'I_EXITS'.
i_fieldcat-fieldname = 'STEXT'.
i_fieldcat-seltext_m = 'FUNCTION EXIT DESCRIPTION'.
if p_fexit = space.
i_fieldcat-no_out = 'X'.
endif.
append i_fieldcat to i_fcat1.
clear i_fieldcat.
i_fieldcat-tabname = 'I_EXITS'.
i_fieldcat-fieldname = 'BERNAME'.
i_fieldcat-seltext_m = 'SUBSCREEN NAME'.
if p_sexit = space.
i_fieldcat-no_out = 'X'.
endif.
append i_fieldcat to i_fcat1.
clear i_fieldcat.
i_fieldcat-tabname = 'I_EXITS'.
i_fieldcat-fieldname = 'STEXT1'.
i_fieldcat-seltext_m = 'SUBSCREEN DESCRIPTION'.
if p_sexit = space.
i_fieldcat-no_out = 'X'.
endif.
append i_fieldcat to i_fcat1.
clear i_fieldcat.
i_fieldcat-tabname = 'I_EXITS'.
i_fieldcat-fieldname = 'CUAFUN'.
i_fieldcat-seltext_m = 'MENU EXIT NAME'.
if p_mexit = space.
i_fieldcat-no_out = 'X'.
endif.
append i_fieldcat to i_fcat1.
clear i_fieldcat.
i_fieldcat-tabname = 'I_EXITS'.
i_fieldcat-fieldname = 'STEXT2'.
i_fieldcat-seltext_m = 'MENU EXIT DESCRIPTION'.
if p_mexit = space.
i_fieldcat-no_out = 'X'.
endif.
append i_fieldcat to i_fcat1.
clear i_fieldcat.
i_fieldcat-tabname = 'I_EXITS'.
i_fieldcat-fieldname = 'INCLTAB'.
i_fieldcat-seltext_m = 'NAME OF THE INCLUDE TABLE'.
if p_texit = space.
i_fieldcat-no_out = 'X'.
endif.
append i_fieldcat to i_fcat1.
clear i_fieldcat.
endform. " populate_fieldcatalog
*---------------------------------------------------------------------*
* FORM f2003_build_layout *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form f2003_build_layout.
clear i_layout.
i_layout-no_keyfix = 'X'. " to move key columns
i_layout-colwidth_optimize = 'X'.
i_layout-coltab_fieldname = 'LINECOLOR'.
endform.
*---------------------------------------------------------------------*
* FORM f2004_e_event *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> I_EVENT *
*---------------------------------------------------------------------*
form f2004_e_event changing i_event type slis_t_event .
data: gt_event type slis_alv_event.
gt_event-name = slis_ev_top_of_list.
gt_event-form = 'TOP_OF_PAGE'.
append gt_event to i_event.
gt_event-name = slis_ev_end_of_list.
gt_event-form = 'END_OF_PAGE1'.
append gt_event to i_event.
endform.
*---------------------------------------------------------------------*
* FORM f2005_e_event *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> I_EVENT *
*---------------------------------------------------------------------*
form f2005_e_event changing i_event type slis_t_event.
data: gt_event1 type slis_alv_event.
refresh : i_event.
gt_event1-name = slis_ev_top_of_list.
gt_event1-form = 'TOP_OF_PAGE'.
append gt_event1 to i_event.
gt_event1-name = slis_ev_end_of_list.
gt_event1-form = 'END_OF_PAGE2'.
append gt_event1 to i_event.
endform.
*---------------------------------------------------------------------*
* FORM f2005_call_alv *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form f2005_call_alv.
data: ws_text type lvc_title,
ws_text1 type lvc_title.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_bypassing_buffer = 'X'
i_callback_program = 'ZUSEREXIT_IDEN'
i_callback_user_command = 'F2006_USER_COMMAND'
i_callback_top_of_page = 'F3002_TOP_OF_PAGE'
i_grid_title = 'List of User-Exits'
is_layout = i_layout
it_fieldcat = i_fcat
it_events = t_event
tables
t_outtab = jtab1
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message e888(ztest) with 'Error in Function Module'.
endif.
clear ws_text.
endform.
*---------------------------------------------------------------------*
* FORM f2006_call_alv *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form f2006_call_alv.
data: ws_text type lvc_title,
ws_text1 type lvc_title.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_bypassing_buffer = 'X'
i_callback_program = 'ZUSEREXIT_IDEN'
i_callback_user_command = 'F2006_USER_COMMAND'
i_callback_top_of_page = 'F3002_TOP_OF_PAGE'
i_grid_title = 'List of User-Exits'
is_layout = i_layout
it_fieldcat = i_fcat1
it_events = t_event
tables
t_outtab = i_exits
exceptions
program_error = 1
others = 2.
if sy-subrc <> 0.
message e888(ztest) with 'Error in Function Module'.
endif.
clear ws_text.
endform.
*---------------------------------------------------------------------*
* FORM e06_comment_build *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> E06_LT_END_OF_PAGE *
*---------------------------------------------------------------------*
form e06_comment_build
using e06_lt_end_of_page type slis_t_listheader.
data: ls_line type slis_listheader.
data: ws_c_uname(200).
describe table jtab lines ws_exits.
concatenate 'No: Of Exits:' ws_exits into ws_c_uname.
ls_line-typ = 'S'.
ls_line-info = ws_c_uname.
append ls_line to e06_lt_end_of_page.
clear : ws_c_uname.
endform.
*---------------------------------------------------------------------*
* FORM e07_comment_build *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> E07_LT_END_OF_PAGE *
*---------------------------------------------------------------------*
form e07_comment_build
using e07_lt_end_of_page type slis_t_listheader.
data: ls_line type slis_listheader.
data: ws_c_uname(200).
describe table i_exits lines ws_fexits.
concatenate 'No: Of Exits:' ws_fexits into ws_c_uname.
ls_line-typ = 'S'.
ls_line-info = ws_c_uname.
append ls_line to e07_lt_end_of_page.
clear : ws_c_uname.
endform.
*---------------------------------------------------------------------*
* FORM f3002_top_of_page *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form f3002_top_of_page.
data: it_list_top_of_page type slis_t_listheader,
it_list_end_of_page type slis_t_listheader,
ls_line type slis_listheader.
data: ws_c_uname1(200).
if rad1 = 'X'.
concatenate 'Transaction Code -' p_tcode into ws_c_uname1.
elseif rad2 = 'X'.
concatenate 'PROGRAM -' p_prog into ws_c_uname1.
elseif rad3 = 'X'.
concatenate 'FUNCTION MODULE -' p_func into ws_c_uname1.
elseif rad4 = 'X'.
concatenate 'IDoc Message Type -' p_idoc into ws_c_uname1.
endif.
ls_line-typ = 'H'.
ls_line-info = ws_c_uname1.
append ls_line to it_list_top_of_page.
clear : ls_line.
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
it_list_commentary = it_list_top_of_page.
endform. " f3002_build_event.
*---------------------------------------------------------------------*
* FORM end_of_page *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form end_of_page1.
refresh: gt_list_end_of_page.
perform e06_comment_build using
gt_list_end_of_page[].
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = ''
it_list_commentary = gt_list_end_of_page
i_end_of_list_grid = 1.
endform. "END_OF_PAGE
*---------------------------------------------------------------------*
* FORM end_of_page *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form end_of_page2.
refresh: gt_list_end_of_page.
perform e07_comment_build using
gt_list_end_of_page[].
call function 'REUSE_ALV_COMMENTARY_WRITE'
exporting
i_logo = ''
it_list_commentary = gt_list_end_of_page
i_end_of_list_grid = 1.
endform. "END_OF_PAGE
*---------------------------------------------------------------------*
* FORM f00421_user_command *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
* --> R_UCOMM *
* --> RS_SELFIELD *
*---------------------------------------------------------------------*
form f2006_user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case rs_selfield-sel_tab_field.
when 'JTAB1-OBJ_NAME'.
p_modname = rs_selfield-value.
perform collect_exits.
refresh i_fcat1.
refresh gt_list_end_of_page.
perform f2001_populate_fieldcatalog changing i_fcat1.
perform f2003_build_layout.
perform f2005_e_event changing t_event.
perform f2006_call_alv.
endcase.
endform.
*---------------------------------------------------------------------*
* FORM collect_exits *
*---------------------------------------------------------------------*
* ........ *
*---------------------------------------------------------------------*
form collect_exits.
select * from modsap
where name = p_modname.
check modsap-member >< space.
case modsap-typ.
when 'E'.
clear function_exits.
function_exits-funcname = modsap-member.
select single * from tftit
where funcname = modsap-member and
spras = 'E'.
function_exits-stext = tftit-stext.
append function_exits.
when 'C'.
clear cua_codes.
call function 'MOD_SAP_MEMBER_PARTS'
exporting
member = modsap-member
typ = 'C'
importing
gprogname = cua_codes-cuaprog
cuacode = cua_codes-cuafun.
append cua_codes.
when 'S'.
clear subscreens.
call function 'MOD_SAP_MEMBER_PARTS'
exporting
member = modsap-member
typ = 'S'
importing
gprogname = subscreens-gdynprog
gdynnr = subscreens-gdynnr
bername = subscreens-bername
cprogname = subscreens-cdynprog
cdynnr = subscreens-cdynnr.
append subscreens.
when 'T'.
clear incl_tables.
incl_tables-incltab = modsap-member.
append incl_tables.
endcase.
endselect.
if not function_exits[] is initial.
loop at function_exits.
move-corresponding function_exits to i_exits.
if not subscreens[] is initial.
loop at subscreens.
move-corresponding subscreens to i_exits.
endloop.
endif.
if not incl_tables[] is initial." and
loop at incl_tables.
move-corresponding incl_tables to i_exits.
endloop.
endif.
append i_exits.
describe table i_exits.
ws_fexits = sy-tfill.
endloop.
endif.
endform.
*---End of Program
Regards,
Gayathri