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

Calling Function Module in Update Task !

Former Member
0 Likes
1,259

Hello,

I have created a function module (Z_FIRST) that read JIT Tables and update a Ztable with some flags. The same function module is also calling BAPI for goods movement.

I am calling the above function module (Z_FIRST) in another function module (Z_SECOND) with IN UPDATE TASK option. I have given the correct input parameters required by Z_FIRST to update the enteries in ZTABLE but I did not see any update in ZTABLE. Neither the goods movement happened. I am not sure where I am wrong.

Please see the sample code below for more information:

The function module Z_FIRST is called in Z_SECOND as written below:

CALL FUNCTION 'Z_FIRST' IN UPDATE TASK

EXPORTING

PRODN = V_JIT

EXTST = V_STATUS

The code in Z_FIRST is taking the values of V_JIT and V_STATUS and reading some database tables and ZTABLE. Based on some conditions it update some flags in ZTABLE.

If I run the function module Z_FIRST without giving IN UPDATE TASK option, it successfully update ZTABLE and does the Goods movement. But it is not doing the same in IN UPDATE TASK.

Could you please let me know where I am doing wrong.

Thanks

5 REPLIES 5
Read only

Former Member
0 Likes
723

some things you can check

1- is there a commit work in your first FM? that only will trigger the FM in update task.

2- Are you passing all the required parameters to the 2nd FM? are those 2 parameters you passing enough to find the entry in Z table and update that.

Read only

0 Likes
723

As MxG said, check the existence of "COMMIT WORK" first.

Without "IN UPDATE TASK", commit will be automatically performed if there is a dialog switch;

But with "IN UPDATE TASK", commit will ONLY be performed when statement "COMMIT WORK".

Read only

Former Member
0 Likes
723

You have to use explicit COMMIT WORK. after calling the such FM to complete SAP LUW.

Read only

Former Member
0 Likes
723

Hi ,

Commit work is required to be done when ever any update task is done to database .

You need to write "COMMIT WORK" at end of FM .

After COMMIT WORK Dialog Process is free to proceed with next user input .Final Part of SAP UW is done .

Your parameters must be correct otherwise without using "COMMIT WORK" records could not have been updated

Read only

Former Member
0 Likes
723

design change