Application Development and Automation 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: 
Read only

user exit

Former Member
0 Likes
430

Hi freinds,

I am working first time on user exit.

How can I validate any field from standard transaction code.

4 REPLIES 4
Read only

Former Member
0 Likes
408

hope this link will help u

http:www.ficoexpertonline.com/downloads/User%20ExitsWPedit.doc

http://www.google.co.in/search?hl=en&q=validateanyfield%2Bstandardtransactioncode%2Buserexit%2Babap&meta=

do reward if useful

Read only

Former Member
0 Likes
408

Hi,

U can see the above code to validating the particular field in transaction:

Userexit is a methodology using which we can add our custom code in the SAP Standard transaction without disturbing the SAP Standard code. SAP will provide enhancement for one transaction. We can have more then one enhancement. Enhancement is a container with a set of userexits. SAP will provide only definition of the exit. Which does not contain any standard code. In the relevant transaction program SAP will their exit as a standard. The Userexit needs to be implemented inorder to provide a custom logic to serve business requirement.

SMOD: It is used to find the enhancement related to different applications.

CMOD: It is used to implement the userexit.

There are 4 types of exits available:

1) Function-module Exits,

2) Menu exits,

3) Screen exits and

4) Field exits.

1) Functionmodule exits:

These exits are used to provide additional functionality to SAP standard transaction. By default SAP is not provided this functionality.

For Example my requirement is, when user create or change customer and the customer belongs to US Country the Industry sector (brsch) field is not empty.

Step1: Find the enhancement. For that one goes to SMOD.

Click on F4 on Enhancement. We Search for enhancement. In this case we can found the enhancement by giving the Description: mast. We got the enhancement as

SAPMF02D: User exits: Customer master data.

(Or)

We find the enhancement at transaction level,

Go to XD01 transaction click on System/Status/double click on Program name

In this program we search for “CALL customer-function’. We get the all related exits the starts with EXIT_enhancementname_Threedigitnumber. Sometimes it Will not an enhancement name.

Step2: Go to CMOD create the custom project.

Click on Enhancement assignments button

Give the Enhancement name: SAPMF02D

Step 3: Click on Components button. Under that we found the one function module:

EXIT_ SAPMF02D_001. Double Click on that function module. In the Source code tab of this function module SAP provide the one Zinclude. SAP doesn’t know our requirement. In this Zinclude we provide our own custom logic to make of the parameters provided in import, export and tables section.

We write the following code:

IF i_kna1-land1 = 'US' AND

i_kna1-brsch = ' ‘.

MESSAGE e001 (f2) WITH ‘ Industry sector should not be blank for US Customers’.

ENDIF.

Step4: SAVE, CHECH and ACTIVATE the Cutsom project.

Step5: Now go to XD01 Transaction We perform our requirement. After we don’t want that requirement go to CMOD and deactivated the custom project.

If it is helpful rewards points

Regards

Pratap.M

Read only

Former Member
0 Likes
408

Hi Amar,

follow the link,

http://www.saptechnical.com/Tutorials/ExitsBADIs/UserExits/page1.htm

Find User exits with TCode

By Roshini

Selection Text: P_TCODE: Transaction Code to Search

Text Symbols: 001 - Enter the Transaction Code that you want to search through for a User Exit

REPORT z_find_userexit NO STANDARD PAGE HEADING.

*&----


*

*& Enter the transaction code that you want to search through in order

*& to find which Standard SAP® User Exits exists.

*&----


*

*&----


*

*& Tables

*&----


*

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

tstct. "Transaction Code Texts

*&----


*

*& Variables

*&----


*

DATA : jtab LIKE tadir OCCURS 0 WITH HEADER LINE.

DATA : field1(30).

DATA : v_devclass LIKE tadir-devclass.

*&----


*

*& Selection Screen Parameters

*&----


*

SELECTION-SCREEN BEGIN OF BLOCK a01 WITH FRAME TITLE text-001.

SELECTION-SCREEN SKIP.

PARAMETERS : p_tcode LIKE tstc-tcode OBLIGATORY.

SELECTION-SCREEN SKIP.

SELECTION-SCREEN END OF BLOCK a01.

*&----


*

*& Start of main program

*&----


*

START-OF-SELECTION.

  • Validate Transaction Code

SELECT SINGLE * FROM tstc

WHERE tcode EQ p_tcode.

  • Find Repository Objects for transaction code

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 = enlfdir-area.

MOVE : tadir-devclass TO v_devclass.

ENDIF.

ENDIF.

  • Find SAP® Modifications

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.

  • Take the user to SMOD for the Exit that was selected.

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.

Thanks&Regards,

Phani.