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: 

a addition question about update task

Former Member
0 Kudos
172

Hi, everybody.

I have ask a question about update task yesterday, do you remeber?

I assign several update/insert actions in a function, and call it in a update task way.

As there are several tables should be deal with, if return an error, how to know which table update/insert is failed in this update task.

it looks like this:

function XXXXX

insert talbeA ....

update tableB .... (if there is an error)

end function.

call function XXXX in update task.

commit work and wait.

if sy-subrc <> 0 .

....

if failed, how can I know the error is due to tableB?

As the function can't return anything in update task mode by parameter, I try some crossing-program mechansim.

I used the Import/export(both ABAP memory and cluster mode), try to use export in funcion to trap(export a flag after every update/insert), and import trap result after commit. when result successful, trap is correct,but when error occur, the import is also null.

Can anyone give me some suggestion, in which way I can get I want. by which technology?

Any suggestion is welcome.

thanks a lot

3 REPLIES 3

Former Member
0 Kudos
46

Hi Zhenglin,

This is not really possible when using the CALL FUNCTION ... IN UPDATE TASK.

As I stated in the previous thread, all checking is supposed to occur prior to the UPDATE FM call, and therefore you really shouldn't have to check the success of the UPDATE FM. Therefore SAP doesn't really provide the capability of diagnosing failures (other than sy-subrc ne 0) from the calling program. Transaction SM13 is provided for this, and usually should only be available to system administrators.

As you are using the COMMIT WORK AND WAIT command, can I suggest that if you really want to know the details of the update, that you just call your function normally (without the IN UPDATE TASK) addition and either raise exceptions or set a return parameter which you can interpret in your calling program. The results for the update will be the same, but you will get the benefit of error handling plus it will be more efficient (only one work process involved, not two).

Hope that helps.

Brad

Former Member
0 Kudos
46

Thanks, Brad.

As I have tried several ways in this two days, it looks no way to get the more details datebase operation error in a update task.

So, you are right, Brad, I think the better way is do all of the validation work before update/insert(business check), and get the sy-subrc after update/insert(datebase operate result).

At last, it seems I should negotiate with my client to make him abandon the requirement.

0 Kudos
46

No problems Zhenglin,

Can you please close the thread.

As stated earlier its really helpful if you do.

You have two options:

1. Against your original post you have "solved it on my own"

2. Against any of other peoples responses, you have "solved problem".

Thanks,

Brad