Creating User Exits for Substitutions

3
Creating user exits for substitutions Skip to end of metadata  Attachments :3  Added by Rajneesh, last edited by Rajneesh on Mar !, "! #$ie% change & sho% comment 'o to start of metadata Substitutions can be used for $alidating data at the time of entry in SA( system) *his %iki can be used for creating custom user exits so that one can set his $alidations + conditions) ser exits are user defined -.RM routines that are used to calculate/replace $alues %ith in a substitution )0 ha$e sho%n demo for -0 but same steps %ith some minor modifications can be used for other areas too) What are substitutions? 1hene$er a data is entered in a system, $alidations are in$oked to check its integrity ).nce $alidations are done, one can substitute the entered $alue %ith some other $alue) *his gi$es you the opportunity of ha$ing the system $alidate $alues that are to be substituted) A substitution $alue can be numeric or a string) *he system first performs some $alidations and then substitutions) *ransactions used for substitutions are : GGB1 : Substitutions maintenance) OBBH : Acti$ation of -0 substitutions)  Substitutions can be performed using three %ays:  2)Constant $alues)  ")-ield -ield assignment)  3)ser exits) 0n this %iki 0 ha$e sho%n substitutions implemented using custom user exits) Steps for creating user exits for substitutions. *he exits used for substitutions are stored in a 0nclude progr am)R''4S is a standard include gi$en by SA( for user exits for substitutions) So for creating custom user exits, one has to copy this include to a 565 #Custom namespace& program) Step1 : Create a copy of include RGGBS !let say "#$S# )*he length of the name you choose should not exceed 7 characters) Step% : &efine your user exit in the 'OR( routine G$#)$*+#)#+#,$S -ith the correct exit type $*+#S/ 0R(2. exits name 8 52225) exitsparam 8 c9exit9param9none) exitstitle 8 text2) 'i$e any suitable text for your exit  A((;<= exits) 0nclude the ;>0* <AM; , (ARAM and *0*?; in the form ';*9;>0*9*0*?;S )*his form ';*9;>0*9*0*?;S contains name and titles of all a$ailable standar d exits) ;$ery ne% exit need to be added to this from) .ne has to spe cify a

Transcript of Creating User Exits for Substitutions

Page 1: Creating User Exits for Substitutions

7/23/2019 Creating User Exits for Substitutions

http://slidepdf.com/reader/full/creating-user-exits-for-substitutions 1/3

Creating user exits for substitutions

Skip to end of metadata

•  Attachments:3

•  Added by Rajneesh, last edited by Rajneesh on Mar !, "! #$ie% change&

• sho% comment

'o to start of metadata

Substitutions can be used for $alidating data at the time of entry in SA( system) *his %iki can be used for creating

custom user exits so that one can set his $alidations + conditions) ser exits are user defined -.RM routines that

are used to calculate/replace $alues %ith in a substitution )0 ha$e sho%n demo for -0 but same steps %ith some minor

modifications can be used for other areas too)

What are substitutions?

1hene$er a data is entered in a system, $alidations are in$oked to check its integrity ).nce $alidations are done,

one can substitute the entered $alue %ith some other $alue) *his gi$es you the opportunity of ha$ing the system

$alidate $alues that are to be substituted) A substitution $alue can be numeric or a string) *he system first performs

some $alidations and then substitutions)

*ransactions used for substitutions are :

GGB1  : Substitutions maintenance)

OBBH : Acti$ation of -0 substitutions)

 Substitutions can be performed using three %ays:

 2)Constant $alues)

 ")-ield -ield assignment)

 3)ser exits)

0n this %iki 0 ha$e sho%n substitutions implemented using custom user exits)

Steps for creating user exits for substitutions.

*he exits used for substitutions are stored in a 0nclude program)R''4S is a standard include gi$en by SA( for

user exits for substitutions) So for creating custom user exits, one has to copy this include to a 565 #Custom

namespace& program)

Step1 : Create a copy of include RGGBS !let say "#$S#)*he length of the name you choose should not

exceed 7 characters)

Step% : &efine your user exit in the 'OR( routine G$#)$*+#)#+#,$S -ith the correct exit type $*+#S/

0R(2.

exitsname 8 52225)

exitsparam 8 c9exit9param9none)

exitstitle 8 text2) 'i$e any suitable text for your exit

 A((;<= exits)

0nclude the ;>0* <AM; , (ARAM and *0*?; in the form ';*9;>0*9*0*?;S )*his form ';*9;>0*9*0*?;S contains

name and titles of all a$ailable standard exits) ;$ery ne% exit need to be added to this from) .ne has to specify a

Page 2: Creating User Exits for Substitutions

7/23/2019 Creating User Exits for Substitutions

http://slidepdf.com/reader/full/creating-user-exits-for-substitutions 2/3

parameter type to enable the code generation program to determine correctly ho% to generate the user exit call ,i)e)

@o% many and %hat kind of paramter#s& are used in the user exit) *he follo%ing parameter types exist:

*(; =escription

 C9;>0*9(ARAM9<.<; se no parameter except 49R;S?* ) 0f you do not %ant to substitute a field,

use this parameter in the substitution ) C9;>0*9(ARAM9-0;?= se one field as param) ;xactly one field is substituted)

C9;>0*9(ARAM9C?ASS se a type as parameter)

Step3: Create a 'OR( for your exit -hich -ill define its  functionality)

0n form ';*9;>0*9*0*?;S %e ha$e define our ;>0*<AM; as 52225) So %ee need to create a -.RM %ith name

222 %hich %ill define the functionality of our user exit) @ere 0 am taking a simple example of populating the 0tem *ext

#4S;'S'*>*&)

BB

B -.RM 222 B

BB

B (opulate 0tem *ext #4S;'S'*>*&BB

-.RM 222)

  =A*A: %l9a%key *(; bkpfa%key)

  C.<S*A<*S: c9asterisk *(; c A?; 5B5,

  c9hypen *(; c A?; 55)

  C?;AR %l9a%key)

B Remo$ing leading Deros

  CA?? -<C*0.< 5C.<;RS0.<9;>0*9A?(@A9.*(*5

  ;>(.R*0<'

  input 8 bkpfa%key

  0M(.R*0<'

  output 8 %l9a%key)

B Set the item text

  C.<CA*;<A*; c9asterisk bsegDuonr c9hypen %l9a%key 0<*. bsegsgtxt)

;<=-.RM) 222

ou need to be cautious %hen %riting code for your user exit) <o dialog boxes, %arning messages, information or

error messages must be issued in an exit) =o not use any A4A( commands that cause you to lea$e the exit directly,

for example ?;A; *. SCR;;<) 0n the includes of the substitution exits, you must not use the commands M.=0-,

0<S;R* or =;?;*; in the internally used structures such as 4S;' or 4E(-) *hese structures are interpreted

internally as database tables because they are defined by a *A4?;S statement) As a result, the system %rites,

deletes or changes database records if you use the commands mentioned abo$e) *his can cause serious

inconsistencies and problems in the document processing) 0f you %ant to change field contents in the exit type

C9;>0*9(ARAM9C?ASS, you should make the changes in the internal table 4..?9=A*A #for example

4.??9=A*A4S;'&)

Step 4:Run transaction GC*% to update +(G to use your ne- progra5 instead of Standard S0 progra5 for

substitution exits)

Page 3: Creating User Exits for Substitutions

7/23/2019 Creating User Exits for Substitutions

http://slidepdf.com/reader/full/creating-user-exits-for-substitutions 3/3

 Alternati$ely you can use S(R. for updating 0M') Run S(R. -inancial Accounting #<e%& Special (urpose

?edger 4asic Settings ser ;xits Maintain Client Specific ser ;xits)

pdate the program name R''4R %ith your ne% program 6*;S* for application area '4?S) <o% you can

use this user exit for substitutions)

 

Ho- to use custo5 user exit for a substitution?

'o to transaction ''42)@ere you can createFchange a substitution ) 0 am not going in detail for creating a

substitution )Specify the user exit#@ighlighted area in red& for a field that is to be substituted buy your exit )

 Also you can see the list of all the user exit on pressing -G on the highlighted area in red) 0f your user exit is in acti$estate, then it %ill be $isible there) .nce you ha$e done the changes ,Sa$e it) <o% your user exit %ill be in$oked

automatically for that field)