Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to know about the User_Exit being called in MB31

former_member143179
Participant
0 Kudos

Dear Sir,

Kindly guide us about the steps to be followed , for knowing that which USER_EXIT are being called during the MB31 transaction .

Also request you to kindly guide us about the steps to be followed in debugging of transaction MB31 .

We assure to give full points for the suggested solution pl .

Rgds

B Mittal

2 REPLIES 2

Former Member
0 Kudos

Hi,

Check the code below. This will give you the list of Active User Exits.

Hope this helps.

&----


*& Report Y_TEST_USER_EXIT

*&

&----


*&

&& This report displays all the active customer enhancements in the

*& system and also displays whether they are active or implemented

&----


REPORT Y_TEST_USER_EXIT.

*Data decleration

types: begin of s_function,

fname like MOD0-FUNCNAME,

ftext like tftit-stext,

impl,

active,

example,

end of s_function.

TYPEs : BEGIN OF display_str,

project type modact-name,

enhancement type modact-member,

fm type modsap-member,

status type char20,

END OF display_str.

constants: c_true type char4 value 'True'.

data : lt_member type table of modact-member,

ls_member like LINE OF lt_member,

lt_fm type table of modsap-member,

ls_fm like LINE OF lt_fm,

lt_modname type table of modact-name,

ls_modname like line of lt_modname,

lt_display type TABLE OF display_str,

ls_display like LINE OF lt_display,

ls_function type s_function,

field1(30).

START-OF-SELECTION.

*Select active customer enhancement.

select name from modattr into ls_modname

where status = 'A'.

append ls_modname to lt_modname.

CLEAR ls_modname.

ENDSELECT.

if lt_modname is INITIAL.

WRITE / 'no active enhancements'.

endif.

*Determine the details about the customer enhancement.

LOOP AT lt_modname INTO ls_modname.

CLEAR : ls_display.

SELECT member from modact into ls_member where name = ls_modname.

select member from modsap into ls_fm where name = ls_member and typ = 'E'.

ls_display-project = ls_modname.

ls_display-enhancement = ls_member.

ls_display-fm = ls_fm.

clear : ls_function.

ls_function-fname = ls_fm.

perform get_impl_status USING ls_function.

if ls_function-impl = 'X'.

ls_display-status = 'Implemented'.

ELSE.

ls_display-status = 'Active'.

endif.

APPEND ls_display to lt_display.

endselect.

ENDSELECT.

ENDLOOP.

*Displaying results

format color = 1.

write : 'Please double-click on the object for follow-on action'.

new-LINE. uline.

write : 'Customer Project', at 30 'SAP Enhancement', at 60 'Exit Func Mod', at 100 'Active/Implem'.

ULINE.

format color = 0.

loop at lt_display into ls_display.

new-LINE.

write : ls_display-project, at 30 ls_display-enhancement, at 60 ls_display-fm,

at 100 ls_display-status.

ENDLOOP.

*For calling transaction CMOD / SMOD / SE37.

at line-selection.

get cursor field field1.

CASE field1.

WHEN 'LS_DISPLAY-PROJECT'.

set parameter id 'MON_KUN' field sy-lisel(10).

call transaction 'CMOD' and skip first screen.

WHEN 'LS_DISPLAY-ENHANCEMENT'.

set parameter id 'MON' field sy-lisel+29(10).

call transaction 'SMOD' and skip first screen.

WHEN 'LS_DISPLAY-FM'.

set parameter id 'LIB' field sy-lisel+59(30).

call transaction 'SE37' and skip first screen.

WHEN OTHERS.

message 'Click on the right place.' TYPE 'I'.

ENDCASE.

*&----


**& Form get_impl_status

*&----


*

*This FORM checks whether an EXIT FM is implemented or not

*

*

*----


form get_impl_status using p_function type s_function.

data : l_mand LIKE tfdir-mand,

l_incl_names TYPE smod_names OCCURS 1 WITH HEADER LINE.

l_incl_names-itype = 'C'.

APPEND l_incl_names.

CLEAR l_mand.

SELECT SINGLE mand FROM tfdir INTO l_mand WHERE funcname = p_function-fname.

IF sy-subrc = 0 AND l_mand(1) = 'C'.

p_function-active = 'X'.

*l_status-active = c_true.

ELSE.

p_function-active = ' '.

*l_status-inactive = c_true.

ENDIF.

CALL FUNCTION 'MOD_FUNCTION_INCLUDE'

EXPORTING

funcname = p_function-fname

TABLES

incl_names = l_incl_names

EXCEPTIONS

OTHERS = 4.

IF sy-subrc = 0.

LOOP AT l_incl_names.

SELECT SINGLE name FROM trdir INTO l_incl_names-iname

WHERE name = l_incl_names-iname.

IF sy-subrc = 0.

p_function-impl = 'X'.

ELSE.

p_function-impl = ' '.

ENDIF.

ENDLOOP.

ENDIF.

endform. "get_impl_status

Also Check the code posted by me in the lonk below ,to get the List of available User exits and Badi for a particular tcode . very useful program.

Hope it helps.

Manish

former_member585060
Active Contributor
0 Kudos

Hi,

These steps should enable you to find any BADI related to any transaction in a matter of minutes.

u2022 Go to the transaction SE37 to find your function module.

u2022 Locate the function SXV_GET_CLIF_BY_NAME.

u2022 Put a breakpoint there.

u2022 Now open a new session.

u2022 Go to your transaction MB31.

u2022 It will stop in this function.

u2022 Double click on the function field EXIT_NAME.

u2022 That will give you name of the BADI that is provided in your transaction .

u2022 Again execute and it stop again and fill with new BADI name if any

u2022 Repeat the same step and you come to know how many BADI exist.

u2022 If you want to know at diffenet screens, what are all BADIs,.

u2022 Run the Transaction.

u2022 Open the above said FM and place a breakpoint.

u2022 Now click on the Tab or screen for which you want to see

any BADIs.

u2022 It will stop, if that screen has any BADI.

Regards

Bala Krishna

Edited by: Bala Krishna on Sep 6, 2008 10:00 AM