03-24-2009 9:29 AM
Hi all,
In function module, in the attribute section, what exactly does the update module in the processing type mean. I did not get the clear picture though I have gone through the SDN. During which circumstances we choose the the update option.
regards,
Mani
03-24-2009 3:48 PM
Exactly as Pradeep said. It is basically used to bundle distributed updates within different programs spots, to one place (in FM).
Such FM would store all the UPDATE/INSERT/DELETE statements which otherwise you would write in some program place. Now when system reaches CALL FUNCTION 'XXX' IN UDPDATE TASK it doesn't go inside. Instead in registeres this XXX FM in VBLOG table (you can see update tasks in SM13) to be executed later. Now when in program it reaches COMMIT WORK statement, it looks into that table and calls each registered functions.
The aim is to either COMMIT all the changes at once, or ROLLBACK them all. This means that if inside one of any FM these statements are encountered system writes changes to DB permanently. Next it clears VBLOG table (so no FM are registered for change anymore) and continues the program.
This is the most common and safe way to make changes to DB within one [SAP LUW|http://help.sap.com/saphelp_46c/helpdata/en/41/7af4bfa79e11d1950f0000e82de14a/frameset.htm]. There is also other way of doing the same within distributed subroutines which are also described in this document.
But if you are asking yourself what is the reason for use of such bundling techniques. It is because [DB LUW|http://help.sap.com/saphelp_46c/helpdata/en/41/7af4bca79e11d1950f0000e82de14a/frameset.htm] differes from the SAP LUW. It is just a smaller part of the latter and is used to submit changes (permanently) in DB after each UPDATE/INSERT/DELETE. In case of later errors during DB update you could then no longer restore previous state of DB with ROLLBACK. That's why SAP created its own SAP LUW.
The real time example would be debiting money from one account and transferring this amount to different account. In such case first you would debit account (UPDATE) but DB would perfrom COMMIT. Now, if for some reason (i.e. loosing the connection) next UPDATE (transferring them to target account) would not be reached, were would be your money? SAP LUW easily solves this issue:)
Hope this is more clear now.
Regards
Marcin
03-24-2009 9:33 AM
03-24-2009 2:28 PM
Hi..
Update Function Modules are used for SAP Logical Unit of Work. This function modules are triggered when an Explicit or Implicit COMMIT WORK is encountered.
Best Regards,
Pradeep.
03-24-2009 2:40 PM
03-24-2009 3:48 PM
Exactly as Pradeep said. It is basically used to bundle distributed updates within different programs spots, to one place (in FM).
Such FM would store all the UPDATE/INSERT/DELETE statements which otherwise you would write in some program place. Now when system reaches CALL FUNCTION 'XXX' IN UDPDATE TASK it doesn't go inside. Instead in registeres this XXX FM in VBLOG table (you can see update tasks in SM13) to be executed later. Now when in program it reaches COMMIT WORK statement, it looks into that table and calls each registered functions.
The aim is to either COMMIT all the changes at once, or ROLLBACK them all. This means that if inside one of any FM these statements are encountered system writes changes to DB permanently. Next it clears VBLOG table (so no FM are registered for change anymore) and continues the program.
This is the most common and safe way to make changes to DB within one [SAP LUW|http://help.sap.com/saphelp_46c/helpdata/en/41/7af4bfa79e11d1950f0000e82de14a/frameset.htm]. There is also other way of doing the same within distributed subroutines which are also described in this document.
But if you are asking yourself what is the reason for use of such bundling techniques. It is because [DB LUW|http://help.sap.com/saphelp_46c/helpdata/en/41/7af4bca79e11d1950f0000e82de14a/frameset.htm] differes from the SAP LUW. It is just a smaller part of the latter and is used to submit changes (permanently) in DB after each UPDATE/INSERT/DELETE. In case of later errors during DB update you could then no longer restore previous state of DB with ROLLBACK. That's why SAP created its own SAP LUW.
The real time example would be debiting money from one account and transferring this amount to different account. In such case first you would debit account (UPDATE) but DB would perfrom COMMIT. Now, if for some reason (i.e. loosing the connection) next UPDATE (transferring them to target account) would not be reached, were would be your money? SAP LUW easily solves this issue:)
Hope this is more clear now.
Regards
Marcin
03-24-2009 4:01 PM
John asked as below:
In function module, in the attribute section, what exactly does the update module in the processing type mean
U hv given explannation for CALL FUNCTION 'XXX' IN UDPDATE TASK
So, pls. clarify me that, both r same?
THANQ
03-24-2009 4:18 PM
Yes its all about the same thing. Update module in attributes of FM simply flags the FM not to be executed directly , hence can be only be excuted in update work process (using IN UPDATE TASK addition when calling FM) or in dialog work process (using SET UPDATE TASK LOCAL statement).
Regards
Marcin
03-24-2009 4:22 PM