Вы находитесь на странице: 1из 3

To create a function module, you first need to start the Function Builder.

Choose Tools
ABAP Workbench, Function Builder. For more information about creating function
modules, refer to the ABAP Workbench Tools documentation.
To be able to call a function module in an update ork process, you must flag it in the
Function Builder. When you create the function module, set the Process Type attribute to
one of the folloing !alues"

Update with immediate start
#et this option for high priority $%&'%( functions that run in a shared $#AP )*W(.
These functions can be restarted by the update task in case of errors.
Update w. imm. start, no restart
#et this option for high priority $%&'%( functions that run in a shared $#AP )*W(.
These functions may not be restarted by the update task.
Update with delayed start
#et this option for lo priority $%&+%( functions that run in their on update
transactions. These functions can be restarted by the update task in case of errors.
To display the attributes screen in the Function Builder, choose ,oto Administration.
Defining the Interface
Function modules that run in the update task ha!e a limited interface"
-esult parameters or e.ceptions are not alloed since update/task function
modules cannot report on their results.
0ou must specify input parameters and tables ith reference fields or reference
structures defined in the ABAP 1ictionary.
Calling Update Functions
Synchronous or Asynchronous Processing?
Function modules that run in the update task can run synchronously or asynchronously.
0ou determine this by the form of the commit statement you use"
C!!I" #$%
This is the standard form, hich specifies asynchronous processing. 0our
program does not ait for the re2uested functions to finish processing.
C!!I" #$% A&D #AI"
This form specifies synchronous processing. The commit statement aits for the
re2uested functions to finish processing. Control returns to your program after all
high priority $&'( function modules ha!e run successfully.
The A31 WA4T form is con!enient for sitching old programs to synchronous
processing ithout ha!ing to re/rite the code. Functionally, using A31 WA4T
for update/task updates is 5ust the same as dialog/task updates ith P6-F7-8
73 C7884T.
Parameter 'alues at ()ecution
4n ABAP, you can call update/task function modules in to different ays. The ay you
choose determines hat parameter !alues are used hen the function module is actually
e.ecuted. Parameter !alues can be set either at the time of the CA)) F*3CT473
statement, or at the time of the C7884T W7-9. The folloing sections e.plain.
Calling *pdate Functions 1irectly
Adding *pdate Task Calls to a #ubroutine.
The e.amples in these sections sho asynchronous commits ith C7884T W7-9.
Calling Update Functions Directly
To call a function module directly, use CA)) F*3CT473 43 *P1AT6 TA#9 directly
in your code.
CA** FU&C"I& +FU&C"!D+ I& UPDA"( "AS% (,P$"I&-...
The system then logs your re2uest and e.ecutes the function module hen the ne.t
C7884T W7-9 statement is reached. The parameter !alues used to e.ecute the
function module are those current at the time of the call.
a : '.
CA)) F*3CT473 ;*P1<F8; 43 *P1AT6 TA#9 6=P7-T43, PA- : A...
a : +.
CA)) F*3CT473 ;*P1<F8; 43 *P1AT6 TA#9 6=P7-T43, PA- : A...
a : >.
C7884T W7-9.
?ere, the function module *P1<F8 is performed tice in the update task" the first time,
ith !alue ' in PA-, the second time ith !alue + in PA-.
Adding Update."as/ Calls to a Su0routine
0ou can also put the CA)) F*3CT473 43 *P1AT6 TA#9 into a subroutine and call
the subroutine ith"
P($F$! SU1$U" & C!!I".
4f you choose this method, the subroutine is e.ecuted at the commit. Thus the re2uest to
run the function in the update task is also logged during commit processing. As a result,
the parameter !alues logged ith the re2uest are those current at the time of the commit.
a : '.
P6-F7-8 F 73 C7884T.
a : +. P6-F7-8 F 73 C7884T.
a : >. C7884T W7-9. F7-8 f.
CA)) F*3CT473 ;*P1<F8; 43 *P1AT6 TA#9 6=P7-T43, PA- : A.
631F7-8.
4n this e.ample, the function module *P1<F8 is carried out ith the !alue > in PA-.
The update task e.ecutes the function module only once, despite the to P6-F7-8 73
C7884T statements. This is because a repeatedly registered one can only be e.ecuted
once in the case of C7884T W7-9. The subroutine itself, containing the function
module call, may not ha!e parameters.
The method described here is not suitable for use inside dialog module code.

Вам также может понравиться