Application Development 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: 

Working in update task mode

Former Member
0 Kudos

HI,

What is the advantage of working in update task ?

if i want to work on update task without using function module how can i do so?

what is the advantage on regular commit work command.

BR

Michael

1 ACCEPTED SOLUTION

former_member555112
Active Contributor
0 Kudos

Hi,

There are no advantages or disadvantages of working in an update task.

Sometimes there might be a requirement that you have to do further processing only if the current processing was successful.

For example.

When I create an Handling Unit via HU02; i want that a Transfer order to be created immediately for this HU once the HU is created.

An option for me now is to create the transfer order in the UPDATE task.

This is because teh UPDATE task will be triggered as soon as COMMIT work occurs.

So i am sure that my transfer order will be created when the HU is created.

For more details on UPDATE task you can read the SAP documentation by doing F1 help on COMMIT WORK.

Regards,

Ankur Parab

6 REPLIES 6

former_member555112
Active Contributor
0 Kudos

Hi,

There are no advantages or disadvantages of working in an update task.

Sometimes there might be a requirement that you have to do further processing only if the current processing was successful.

For example.

When I create an Handling Unit via HU02; i want that a Transfer order to be created immediately for this HU once the HU is created.

An option for me now is to create the transfer order in the UPDATE task.

This is because teh UPDATE task will be triggered as soon as COMMIT work occurs.

So i am sure that my transfer order will be created when the HU is created.

For more details on UPDATE task you can read the SAP documentation by doing F1 help on COMMIT WORK.

Regards,

Ankur Parab

0 Kudos

Hi ankur,

so commit work is called update task ,so what is the diffrence between commit work and commit

work and wait ?

and how can i do update without update task .

Best Regards

Michael

0 Kudos

Hi,

Basically SAP does all the updates in an UPDATE task.

So on execution of COMMIT WORK statement; the update task begins and the data is uploaded in the database.

Suppose you want to do something only when the data has been actually posted then you make use of COMMIT WORK and WAIT.

In this case the processing will continue only after all the updates have happened.

Regards,

Ankur Parab

0 Kudos

Hi Commit work updates Database and jump to the next statement immediately whereas Commit work and wait, waits for sometime before jumping to next statement.

Sometime because of the increased Netwrok Traffic, Database updates might take some time and hence you might want your next statement to wait a bit before moving to next statement.

For eg: One of your Function Module is creating a Document in SAP database and your second statement is trying to access that document, now because of the heavy netwro traffic you may want your second statement to wait a bit before trying to access the newly created SAP Document and hence you would use here Commit work and wait.

Update Task is required when your database update is dependent on some other databse update or for a bundle update. For eg: I want to store the additional information in a ZTABLE, for a customer during the sales Order creation witrh ref to the sales order number, now i would be writing my code in the sales order exit and writing my Insert into ZTABLE inside the Function Module with Update task. This would ensure that the entry in the ZTABLE would only go when the database update happening for the sales order creation and hence I would save myself from a database inconsistency where I may have a Sales Order data inserted in the ZTABLE but the same Sales Order Number might not exists.

Hope it helps.

0 Kudos

Hi AJAY,

Thanks,

How i use it ? if i don't want to use it via FM (in update task) there is another way?

how it influence on the performance ?

BR

Michael

0 Kudos

Hi Michael,

You can also use synchronous update ( COMMIT WORK AND WAIT ) via PERFROM ON COMMIT statement. This bundling method is similar to function modules, but has different technical background. Call FM in UPDATE TASK require additional table where it must be registered (before accual call) whereas PERFROM ON COMMIT does not. On the other hand data to such subroutine can't be called via subroutine parameters. Such subroutine can work only with global data of the program where it is called.

Suppose we have


FORM update_my_tables.   "not interface allowed here (no parameters)
   "some updates here
ENDFORM.

"now when you call it even twice or three times, it will be executed only once
PERFORM update_my_tables ON COMMIT.
PERFORM update_my_tables ON COMMIT.

"if COMMIT WORK is reached it will executed update_my_tables synchronously (so as it would be called like COMMIT WORK AND WAIT)
"here however you use only COMMIT WORK
COMMIT WORK.

For more information and graphical ilustration refer [SAP LUW|http://help.sap.com/saphelp_46c/helpdata/en/41/7af4bfa79e11d1950f0000e82de14a/frameset.htm]

Regards

Marcin