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: 

CMOD and SMOD

Former Member
0 Kudos

Hi Experts.

I have three basic questions.

1. What is CMOD

2. What is SMOD

3. How to find enhancements if Tcode is known.

Thanks.

Ravi

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Ravi,

CMOD: means it stores all the enhancements for perticular project.

SMOD: means it stores all the enhancements related to perticular package.

If you know the t-code then go to system>status by the menu path and find out the program name and package.

go to SE80 and give that package name and press enter.Then it will display all the enhancements related to that package. Find out required exit by seeing the comments and all.

OR

please execute this code.

report zuserexit no standard page heading.

tables : tstc, tadir, modsapt, modact, trdir, tfdir, enlfdir.

tables : tstct.

data : jtab like tadir occurs 0 with header line.

data : field1(30).

data : v_devclass like tadir-devclass.

parameters : p_tcode like tstc-tcode obligatory.

select single * from tstc where tcode eq p_tcode.

if sy-subrc eq 0.

select single * from tadir where pgmid = 'R3TR'

and object = 'PROG'

and obj_name = tstc-pgmna.

move : tadir-devclass to v_devclass.

if sy-subrc ne 0.

select single * from trdir where name = tstc-pgmna.

if trdir-subc eq 'F'.

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.

endif.

endif.

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.

format color col_positive intensified off.

write:/(19) 'Transaction Code - ',

20(20) p_tcode,

45(50) tstct-ttext.

skip.

if not jtab[] is initial.

write:/(95) sy-uline.

format color col_heading intensified on.

write:/1 sy-vline,

2 'Exit Name',

21 sy-vline ,

22 'Description',

95 sy-vline.

write:/(95) sy-uline.

loop at jtab.

select single * from modsapt

where sprsl = sy-langu and

name = jtab-obj_name.

format color col_normal intensified off.

write:/1 sy-vline,

2 jtab-obj_name hotspot on,

21 sy-vline ,

22 modsapt-modtext,

95 sy-vline.

endloop.

write:/(95) sy-uline.

describe table jtab.

skip.

format color col_total intensified on.

write:/ 'No of Exits:' , sy-tfill.

else.

format color col_negative intensified on.

write:/(95) 'No User Exit exists'.

endif.

else.

format color col_negative intensified on.

write:/(95) 'Transaction Code Does Not Exist'.

endif.

at line-selection.

get cursor field field1.

check field1(4) eq 'JTAB'.

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

call transaction 'SMOD' and skip first screen.

Hope this helps you, reply for queries, Shall post you the updates.

Regards.

Kumar. .

5 REPLIES 5

Former Member
0 Kudos

Hi Ravi,

CMOD: means it stores all the enhancements for perticular project.

SMOD: means it stores all the enhancements related to perticular package.

If you know the t-code then go to system>status by the menu path and find out the program name and package.

go to SE80 and give that package name and press enter.Then it will display all the enhancements related to that package. Find out required exit by seeing the comments and all.

OR

please execute this code.

report zuserexit no standard page heading.

tables : tstc, tadir, modsapt, modact, trdir, tfdir, enlfdir.

tables : tstct.

data : jtab like tadir occurs 0 with header line.

data : field1(30).

data : v_devclass like tadir-devclass.

parameters : p_tcode like tstc-tcode obligatory.

select single * from tstc where tcode eq p_tcode.

if sy-subrc eq 0.

select single * from tadir where pgmid = 'R3TR'

and object = 'PROG'

and obj_name = tstc-pgmna.

move : tadir-devclass to v_devclass.

if sy-subrc ne 0.

select single * from trdir where name = tstc-pgmna.

if trdir-subc eq 'F'.

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.

endif.

endif.

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.

format color col_positive intensified off.

write:/(19) 'Transaction Code - ',

20(20) p_tcode,

45(50) tstct-ttext.

skip.

if not jtab[] is initial.

write:/(95) sy-uline.

format color col_heading intensified on.

write:/1 sy-vline,

2 'Exit Name',

21 sy-vline ,

22 'Description',

95 sy-vline.

write:/(95) sy-uline.

loop at jtab.

select single * from modsapt

where sprsl = sy-langu and

name = jtab-obj_name.

format color col_normal intensified off.

write:/1 sy-vline,

2 jtab-obj_name hotspot on,

21 sy-vline ,

22 modsapt-modtext,

95 sy-vline.

endloop.

write:/(95) sy-uline.

describe table jtab.

skip.

format color col_total intensified on.

write:/ 'No of Exits:' , sy-tfill.

else.

format color col_negative intensified on.

write:/(95) 'No User Exit exists'.

endif.

else.

format color col_negative intensified on.

write:/(95) 'Transaction Code Does Not Exist'.

endif.

at line-selection.

get cursor field field1.

check field1(4) eq 'JTAB'.

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

call transaction 'SMOD' and skip first screen.

Hope this helps you, reply for queries, Shall post you the updates.

Regards.

Kumar. .

Former Member
0 Kudos

hi,

CMOD is used to carry out the project,where you have to provide the enhancement name.

SMOD is used basically for finding the user exit,but it can be done using CMOD also,but here you can test your enhancement also.

to find the user exit you can run this program

REPORT YUSEREXIT .

tables : tstc, tadir, modsapt, modact, trdir, tfdir, enlfdir.

tables : tstct.

data : jtab like tadir occurs 0 with header line.

data : field1(30).

data : v_devclass like tadir-devclass.

parameters : p_tcode like tstc-tcode obligatory.

select single * from tstc where tcode eq p_tcode.

if sy-subrc eq 0.

select single * from tadir where pgmid = 'R3TR'

and object = 'PROG'

and obj_name = tstc-pgmna.

move : tadir-devclass to v_devclass.

if sy-subrc ne 0.

select single * from trdir where name = tstc-pgmna.

if trdir-subc eq 'F'.

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.

endif.

endif.

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.

format color col_positive intensified off.

write:/(19) 'Transaction Code - ',

20(20) p_tcode,

45(50) tstct-ttext.

skip.

if not jtab[] is initial.

write:/(95) sy-uline.

format color col_heading intensified on.

write:/1 sy-vline,

2 'Exit Name',

21 sy-vline ,

22 'Description',

95 sy-vline.

write:/(95) sy-uline.

loop at jtab.

select single * from modsapt

where sprsl = sy-langu and

name = jtab-obj_name.

format color col_normal intensified off.

write:/1 sy-vline,

2 jtab-obj_name hotspot on,

21 sy-vline ,

22 modsapt-modtext,

95 sy-vline.

endloop.

write:/(95) sy-uline.

describe table jtab.

skip.

format color col_total intensified on.

write:/ 'No of Exits:' , sy-tfill.

else.

format color col_negative intensified on.

write:/(95) 'No User Exit exists'.

endif.

else.

format color col_negative intensified on.

write:/(95) 'Transaction Code Does Not Exist'.

endif.

at line-selection.

get cursor field field1.

check field1(4) eq 'JTAB'.

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

call transaction 'SMOD' and skip first screen.

Former Member
0 Kudos

What is the difference between SMOD and CMOD?

CMOD is the Project Management of SAP Enhancements (i.e., SMOD Enhancements). SMOD contains the actual enhancements and CMOD is the grouping of those SMOD enhancements.

User exits (Function module exits) are exits developed by SAP. The exit is implementerd as a call to a function module. The code for the function module is written by the developer. You are not writing the code directly in the function module, but in the include that is implemented in the function module.

The naming standard of function modules for function module exits is:

EXIT_<program name><3 digit suffix>

The call to a functionmodule exit is implemented as:

CALL CUSTOMER.-FUNCTION ❤️ digit suffix>

For Example:

The program for transaction VA01 Create salesorder is SAPMV45A

1. If you search for CALL CUSTOMER-FUNCTION program SAPMV45A you will find ( Among other user exits):

CALL CUSTOMER-FUNCTION '003'

exporting

xvbak = vbak

xvbuk = vbuk

xkomk = tkomk

importing

lvf_subrc = lvf_subrc

tables

xvbfa = xvbfa

xvbap = xvbap

xvbup = xvbup.

The exit calls function module EXIT_SAPMV45A_003

2. How to find user exits

Display the program where you are searching for and exit and search for CALL CUSTOMER-EXIT

If you know the Exit name, go to transaction CMOD. Choose menu Utillities->SAP Enhancements.

Enter the exit name and press enter.

You will now come to a screen that shows the function module exits for the exit.

or use this ABAP program to search for user exits :-

Finding the user-exits of a SAP transaction code

3. Using Project management of SAP Enhancements

You want to create a project to enhance transaction VA01

- Go to transaction CMOD

- Create a project called ZVA01

- Choose the Enhancement assign radio button and press the Change button

In the first column enter V45A0002 Predefine sold-to party in sales document . Note that an enhancement can only be used for 1 project. If the enhancement is allready in use, and error message will be displayed

- Press Save

- Press Components. You can now see that enhancement uses user exit EXIT_SAPMV45A_002.

- Double Click on the exit.

Now the function module is displayed. Double click on include ZXVVAU04 in the function module

Insert the following code into the include: E_KUNNR = '2155'.

Activate the include program. Go back to CMOD and activate the project.

Goto transaction VA01 and create a salesorder. Note that Sold-to-party now automatically is "2155"

Here is the difference.

SMOD- SAP Modification(Used by SAP Developers for creating the enhancements)

CMOD- Customer Modification(Used by the Customers to implement the enhancements created by the SAP Developers)

see this link

http://help.sap.com/saphelp_nw04/helpdata/en/eb/3e7ceb940e11d295df0000e82de14a/content.htm

http://www.sap-img.com/abap/what-is-the-difference-between-smod-and-cmod.htm

http://www.sap-img.com/abap/field-exits-smod-cmod-questions-and-answers.htm

http://www.easymarketplace.de/userexit.php?Area=4soi

Message was edited by:

sunil kumar

Former Member
0 Kudos

Hi Ravi,

<b>CMOD</b> is the Project Management of SAP Enhancements (i.e., SMOD Enhancements), it stores all the enhancements for particular project.

<b>SMOD</b> contains the actual enhancements and CMOD is the grouping of those SMOD enhancements, means it stores all the enhancements related to particular package. It is used basically for finding the user exit, but it can be done using CMOD also, but here you can test your enhancement also.

Use the following prog. it will fetch the Exits as well as BADI's for that T Code.

&----


*& Report Z_USEREXIT_DISPLAY

&----


REPORT Z_USEREXIT_DISPLAY

NO STANDARD PAGE HEADING

LINE-SIZE 200 MESSAGE-ID ZZ.

&----


  • T A B L E D E C L A R A T I O N S *

&----


TABLES: TFTIT,

E071,

E070.

&----


  • S T R U C T U R E D E C L A R A T I O N S *

&----


TYPES: BEGIN OF X_TSTC,

TCODE TYPE TCODE,

PGMNA TYPE PROGRAM_ID,

END OF X_TSTC.

TYPES: BEGIN OF X_TADIR,

OBJ_NAME TYPE SOBJ_NAME,

DEVCLASS TYPE DEVCLASS,

END OF X_TADIR.

TYPES: BEGIN OF X_SLOG,

OBJ_NAME TYPE SOBJ_NAME,

END OF X_SLOG.

TYPES: BEGIN OF X_FINAL,

NAME TYPE SMODNAME,

MEMBER TYPE MODMEMBER,

INCLUDE(15), "Include name

END OF X_FINAL.

&----


  • I N T E R N A L T A B L E D E C L A R A T I O N S *

&----


DATA: IT_TSTC TYPE STANDARD TABLE OF X_TSTC WITH HEADER LINE.

DATA: IT_TADIR TYPE STANDARD TABLE OF X_TADIR WITH HEADER LINE.

DATA: IT_JTAB TYPE STANDARD TABLE OF X_SLOG WITH HEADER LINE.

DATA: IT_FINAL TYPE STANDARD TABLE OF X_FINAL WITH HEADER LINE.

&----


  • V A R I A B L E S D E C L A R A T I O N S *

&----


  • U S E R I N P U T S S C R E E N *

&----


&----


  • S E L E C T I O N S C R E E N *

&----


SELECTION-SCREEN: BEGIN OF BLOCK BLK01 WITH FRAME TITLE TEXT-T01.

PARAMETERS: P_TCODE LIKE TSTC-TCODE OBLIGATORY.

SELECTION-SCREEN END OF BLOCK BLK01.

&----


  • S t a r t o f S e l e c t i o n *

&----


START-OF-SELECTION.

PERFORM GET_TCODES. "Get Tcodes

PERFORM GET_OBJECTS. "Get Objects

&----


  • E n d o f S e l e c t i o n *

&----


END-OF-SELECTION.

PERFORM DISPLAY_RESULTS. "Display Results

&----


*& Form get_tcodes

&----


  • Get Tcodes

----


FORM GET_TCODES.

SELECT TCODE

PGMNA

INTO TABLE IT_TSTC

FROM TSTC

WHERE TCODE = P_TCODE.

IF SY-SUBRC = 0.

SORT IT_TSTC BY TCODE.

ENDIF.

ENDFORM. " get_tcodes

&----


*& Form get_objects

&----


  • Get Objects

----


FORM GET_OBJECTS.

DATA: L_FNAME LIKE RS38L-NAME,

L_GROUP LIKE RS38L-AREA,

L_INCLUDE LIKE RS38L-INCLUDE,

L_NAMESPACE LIKE RS38L-NAMESPACE,

L_STR_AREA LIKE RS38L-STR_AREA.

DATA: V_INCLUDE LIKE RODIOBJ-IOBJNM.

DATA: E_T_INCLUDE TYPE STANDARD TABLE OF ABAPSOURCE WITH HEADER

LINE.

DATA: L_LINE TYPE STRING,

L_TABIX LIKE SY-TABIX.

IF NOT IT_TSTC[] IS INITIAL.

SELECT OBJ_NAME

DEVCLASS

INTO TABLE IT_TADIR

FROM TADIR FOR ALL ENTRIES IN IT_TSTC

WHERE PGMID = 'R3TR' AND

OBJECT = 'PROG' AND

OBJ_NAME = IT_TSTC-PGMNA.

IF SY-SUBRC = 0.

SORT IT_TADIR BY OBJ_NAME DEVCLASS.

SELECT OBJ_NAME

INTO TABLE IT_JTAB

FROM TADIR FOR ALL ENTRIES IN IT_TADIR

WHERE PGMID = 'R3TR' AND

OBJECT = 'SMOD' AND

DEVCLASS = IT_TADIR-DEVCLASS.

IF SY-SUBRC = 0.

SORT IT_JTAB BY OBJ_NAME.

ENDIF.

ENDIF.

ENDIF.

*- Get UserExit names

LOOP AT IT_JTAB.

SELECT NAME

MEMBER

INTO (IT_FINAL-NAME, IT_FINAL-MEMBER)

FROM MODSAP

WHERE NAME = IT_JTAB-OBJ_NAME AND

TYP = 'E'.

APPEND IT_FINAL.

CLEAR IT_FINAL.

ENDSELECT.

ENDLOOP.

*- Process it_final contents.

LOOP AT IT_FINAL.

L_TABIX = SY-TABIX.

CLEAR: L_FNAME,

L_GROUP,

L_INCLUDE,

L_NAMESPACE,

L_STR_AREA.

L_FNAME = IT_FINAL-MEMBER.

CALL FUNCTION 'FUNCTION_EXISTS'

EXPORTING

FUNCNAME = L_FNAME

IMPORTING

GROUP = L_GROUP

INCLUDE = L_INCLUDE

NAMESPACE = L_NAMESPACE

STR_AREA = L_STR_AREA

EXCEPTIONS

FUNCTION_NOT_EXIST = 1

OTHERS = 2.

IF SY-SUBRC = 0.

IF NOT L_INCLUDE IS INITIAL.

*- Get Source code of include.

CLEAR: V_INCLUDE, E_T_INCLUDE, E_T_INCLUDE[].

V_INCLUDE = L_INCLUDE.

CALL FUNCTION 'MU_INCLUDE_GET'

EXPORTING

I_INCLUDE = V_INCLUDE

TABLES

E_T_INCLUDE = E_T_INCLUDE.

IF SY-SUBRC = 0.

LOOP AT E_T_INCLUDE.

IF E_T_INCLUDE-LINE CS 'INCLUDE'.

CLEAR L_LINE.

L_LINE = E_T_INCLUDE-LINE.

CONDENSE L_LINE NO-GAPS.

TRANSLATE L_LINE USING '. '.

L_LINE = L_LINE+7(9).

IT_FINAL-INCLUDE = L_LINE.

MODIFY IT_FINAL INDEX L_TABIX TRANSPORTING INCLUDE.

ENDIF.

ENDLOOP.

ENDIF.

ENDIF.

ENDIF.

ENDLOOP.

ENDFORM. " get_objects

&----


*& Form display_results

&----


  • Display Results

----


FORM DISPLAY_RESULTS.

FORMAT COLOR COL_HEADING.

WRITE:/1(150) SY-ULINE.

WRITE:/ SY-VLINE,

2(23) 'Extension Name',

24 SY-VLINE,

25(39) 'Exit Name',

64 SY-VLINE,

65(74) 'Description',

140 SY-VLINE,

141(9) 'Include',

150 SY-VLINE.

WRITE:/1(150) SY-ULINE.

FORMAT RESET.

SORT IT_FINAL BY NAME MEMBER.

LOOP AT IT_FINAL.

CLEAR TFTIT.

SELECT SINGLE STEXT

INTO TFTIT-STEXT

FROM TFTIT

WHERE SPRAS = 'EN' AND

FUNCNAME = IT_FINAL-MEMBER.

WRITE:/ SY-VLINE,

IT_FINAL-NAME COLOR COL_KEY, 24 SY-VLINE,

25 IT_FINAL-MEMBER, 64 SY-VLINE,

65 TFTIT-STEXT, 140 SY-VLINE,

141 IT_FINAL-INCLUDE, 150 SY-VLINE.

WRITE:/1(150) SY-ULINE.

ENDLOOP.

ENDFORM. " display_results

Hope this resolves your query.

Reward all the helpful answers.

Regards

0 Kudos

1. SMOD is used for identifying the components of Customer-Exits and to read the documentation.

2. CMOD is used for implementation of Customer-Exits.

3. Find the package of that T-code and find corresponding Customer-Exits in SE84 or SMOD.