Application Development and Automation 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: 
Read only

Difference between Call function in update task and Perform on commit

Former Member
0 Likes
6,295

Hai ,

<i><b>Can u please help with a real time scenario when using Call function in update task and commit work (commit work and wait).</b></i>I got ito the threads where its explained individually but coulnt get on to real time...

Is it reccommeded to use call func in update task while huge data savig is there as bcos it il update VBLOG table it may occupy more memory..

So where we should use "<b>on commit</b>" and "<b>Update task</b>".

Can u help with "Starting new tas" also...with example scenario.....

Thanks & regards

Neeraj

1 ACCEPTED SOLUTION
Read only

Former Member
1,555

Neeraj,

To call a function module directly, use CALL FUNCTION IN UPDATE TASK directly in your code.

CALL FUNCTION 'FUNCTMOD' IN UPDATE TASK EXPORTING...

The system then logs your request and executes the function module when the next COMMIT WORK statement is reached. The parameter values used to execute the function module are those current at the time of the call.

a = 1.

CALL FUNCTION 'UPD_FM' IN UPDATE TASK EXPORTING PAR = A...

a = 2.

CALL FUNCTION 'UPD_FM' IN UPDATE TASK EXPORTING PAR = A...

a = 3.

COMMIT WORK.

Here, the function module UPD_FM is performed twice in the update task: the first time, with value 1 in PAR, the second time with value 2 in PAR.

************************************************

You can also put the CALL FUNCTION IN UPDATE TASK into a subroutine and call the subroutine with:

PERFORM SUBROUT ON COMMIT.

If you choose this method, the subroutine is executed at the commit. Thus the request to run the function in the update task is also logged during commit processing. As a result, the parameter values logged with the request are those current at the time of the commit.

a = 1.

PERFORM F ON COMMIT.

a = 2.

PERFORM F ON COMMIT.

a = 3.

COMMIT WORK.

FORM f.

CALL FUNCTION 'UPD_FM' IN UPDATE TASK EXPORTING PAR = A.

ENDFORM.

In this example, the function module UPD_FM is carried out with the value 3 in PAR. The update task executes the function module only once, despite the two PERFORM ON COMMIT statements. This is because a repeatedly registered one can only be executed once in the case of COMMIT WORK. The subroutine itself, containing the function module call, may not have parameters.

The method described here is not suitable for use inside dialog module code.

Pls. MArk if useful

2 REPLIES 2
Read only

Former Member
1,556

Neeraj,

To call a function module directly, use CALL FUNCTION IN UPDATE TASK directly in your code.

CALL FUNCTION 'FUNCTMOD' IN UPDATE TASK EXPORTING...

The system then logs your request and executes the function module when the next COMMIT WORK statement is reached. The parameter values used to execute the function module are those current at the time of the call.

a = 1.

CALL FUNCTION 'UPD_FM' IN UPDATE TASK EXPORTING PAR = A...

a = 2.

CALL FUNCTION 'UPD_FM' IN UPDATE TASK EXPORTING PAR = A...

a = 3.

COMMIT WORK.

Here, the function module UPD_FM is performed twice in the update task: the first time, with value 1 in PAR, the second time with value 2 in PAR.

************************************************

You can also put the CALL FUNCTION IN UPDATE TASK into a subroutine and call the subroutine with:

PERFORM SUBROUT ON COMMIT.

If you choose this method, the subroutine is executed at the commit. Thus the request to run the function in the update task is also logged during commit processing. As a result, the parameter values logged with the request are those current at the time of the commit.

a = 1.

PERFORM F ON COMMIT.

a = 2.

PERFORM F ON COMMIT.

a = 3.

COMMIT WORK.

FORM f.

CALL FUNCTION 'UPD_FM' IN UPDATE TASK EXPORTING PAR = A.

ENDFORM.

In this example, the function module UPD_FM is carried out with the value 3 in PAR. The update task executes the function module only once, despite the two PERFORM ON COMMIT statements. This is because a repeatedly registered one can only be executed once in the case of COMMIT WORK. The subroutine itself, containing the function module call, may not have parameters.

The method described here is not suitable for use inside dialog module code.

Pls. MArk if useful

Read only

0 Likes
1,555

Hai,

Thanks for the reply....

I have a scenario in which i have to update a header table and a item table ...

Header has just one record to updated and there's good amount of data to updated/inserted to the item table...

If Iam using<b> "in update task"</b> for updating item table will it use more memory and reduce performance as it'l also go and update the VBLOG cluster table...

So is it better recomended to use<b> "on commit"</b>

Please help.

Thanks and regards

Neeraj