Difference between Update function module and Regular function module

by | Apr 23, 2020 | ABAP Differences

Home » SAP » ABAP » ABAP Differences » Difference between Update function module and Regular function module

Preface – This post is part of the Differences in ABAP for Interviews series.

Introduction

Before discussing the difference between Update function module and Regular function module in SAP ABAP, let’s have a short introduction of the two.

Function modules are procedures that have a set of re-usable statements with importing, exporting parameters, etc. They are created in ABAP workbench using the Function Module Builder. They play an important role in updating and in the interaction between different SAP systems, between SAP systems and remote systems through remote calls.

There are 3 Processing types of function module:

  1. Regular Function Module
  2. Remote-Enabled Function Module
  3. Update Module

Regular Function Module

Regular Function Module and Update Function module consists of a block of statements that are made available globally all over the SAP landscape.

Update Module

The Update function module is a function module for which the processing type property of the function builder is set to Update Module. This function module is not executed immediately but is scheduled for execution in a special work process called update work process. For this purpose, the name of the update function module along with the actual parameter is registered in the database table VBLOG as a log record.

Syntax to register the function module to the log table:

CALL FUNCTION <function_name> IN UPDATE TASK

[EXPORTING p1 = a1 … fn = an] [TABLES  f1 = a1 … fn = an

 The actual execution of the program is triggered by the COMMIT WORK statement. The values of the actual parameters are received by the formal parameter of the function module from the VBLOG table. After registration of the function module, if the COMMIT WORK is not triggered then the function module is not executed and the entries are deleted from the log table when the program ends.

The regular function module does not need to be registered to be called. This is executed immediately whenever a call to this function module is made. Sy-subrc can be checked for success and failure.

Syntax to call a Regular function module:

CALL FUNTION  <function_name>

[EXPORTING  p1 = a1 … fn = an] [IMPORTING  f1 = a1 … fn = an] [CHANGING   f1 = a1 … fn = an] [TABLES     f1 = a1 … fn = an] [EXCEPTIONS e1 = r1 … en = rn

[ERROR_MESSAGE = rE] [OTHERS = ro]].

Now, let’s have a look at their difference.

Difference between Update function module and Regular function module

Update Function ModuleRegular Function Module
It needs to be registered first in the log tableThere is no need to register
It is executed when COMMIT WORK statement is triggered.It is executed immediately when a call is made to this function.
Sy-subrc is undefined after executionSy-subrc can be checked after the execution

 

Author

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Author