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

Update Task Function Module

Former Member
0 Likes
620

Hi All,

I am trying to update my custom tables using Update Task function module.

FM update task

Insert table A

Insert table B

endFM.

In main program.

Call FM in Update Task.

If sy-subrc = 0.

Commit work.

Endif.

To this FM if I pass a record which already exist in table A. Still the system sets Sy-subrc = 0 after execution of FM. Because of this I am unable to identify whether update is successful or not.

Please help.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
556

Hi Vimal,

Just specifying IN UPDATE TASK will not return any return code to your program as this FM will not run in the same LUW as your program does.

Regards,

John.

3 REPLIES 3
Read only

Former Member
0 Likes
557

Hi Vimal,

Just specifying IN UPDATE TASK will not return any return code to your program as this FM will not run in the same LUW as your program does.

Regards,

John.

Read only

Clemenss
Active Contributor
0 Likes
556

Vimal,

if the INSERT tries to insert an existing key, check for sy-subrc = 4 in the function module, raise an error (duplicate key) and the iupdate process is aborted - you will get express message.

It might be better to

first lock the table

then check the existence of key

then call update function (update process will unlock).

Regards,

Clémens

Read only

Former Member
0 Likes
556

Hi Clémens,

Thanks for the reply. Actually I am going to run this program in batch mode. Will this cause any issue if I raise an exception & if I get express message. Will the processing will be normal for other records.

Thanks,

Vimal