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

Subroutine

Former Member
0 Likes
313

Hi Guys,

Can we add update task calls to subroutine. If yes then kindly tell me the process in brief.

Regards

Rahul

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
294

<b>Answer:</b>

Yes, we can do this.

For this we have to use <b>perform on commit</b> statement.

This statement registers the subroutine directly specified using subroutine in the same program. The subroutine is not executed immediately, but a flag is set for execution when one of the statements COMMIT WORK or ROLLBACK WORK (since Release 6.10) is reached.

The registered subroutines are executed if the statement COMMIT WORK or ROLLBACK WORK is executed in their work process and before update function modules registered using CALL FUNCTION ... IN UPDATE TASK. Subroutines that are registered during execution of an update function module for COMMIT are executed at the end of the update in the update work process i.e.

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.

1 REPLY 1
Read only

Former Member
0 Likes
295

<b>Answer:</b>

Yes, we can do this.

For this we have to use <b>perform on commit</b> statement.

This statement registers the subroutine directly specified using subroutine in the same program. The subroutine is not executed immediately, but a flag is set for execution when one of the statements COMMIT WORK or ROLLBACK WORK (since Release 6.10) is reached.

The registered subroutines are executed if the statement COMMIT WORK or ROLLBACK WORK is executed in their work process and before update function modules registered using CALL FUNCTION ... IN UPDATE TASK. Subroutines that are registered during execution of an update function module for COMMIT are executed at the end of the update in the update work process i.e.

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.