cancel
Showing results for 
Search instead for 
Did you mean: 

Update task

former_member193771
Contributor
0 Kudos
111

I need to perform an update (to a transparent database table) in a workflow step as a background task, and as im new to workflow, i need some help.

regards,

sukumar.

Accepted Solutions (1)

Accepted Solutions (1)

former_member186746
Active Contributor
0 Kudos

Hi Sukumar,

Just as Jocelyn said,

If this is to update standard SAP master data, or similar.

And you have found a BAPI chances are that this BAPI is used in a method for the business object.

E.g. for employee data, in transaction SWO1, you'll find BUS1065 which you can use to alter data. And for material master, I think it's BUS1000 ( just search in the texts in SWO1 for BUS*)

Kind regards, Rob Dielemans

former_member193771
Contributor
0 Kudos

Sorry for providing very less information, guys we are looking to enhance the object afvc_netw with a new method which updates the user fields in the table afvu.

sukumar.

former_member186746
Active Contributor
0 Kudos

Hi sukumar kumar,

SAP discourages to update tables directly.

I did check briefly to see if altering table AFVU is used in any function module or bapi, but this is not the case.

It is a table of type A with maintenance allowed with restrictions. So it´s not a high risk to update this table, via a custom method.

Kind regards, Rob Dielemans

former_member193771
Contributor
0 Kudos

well guys, is it a good idea to do the update task via a transaction which calls a custom screen, in which the data is entered and the user saves the data which updates the database table.

Answers (1)

Answers (1)

Jocelyn_Dart
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Sukumar,

I'm assuming you have done at least some workflow training?

You just need some way to update your table that you can call from your object method, and a terminating event or exception to confirm that its done.

The usual approach is to call a BAPI to perform the actual update. Of course if its a custom table you can just code the update into the method directly if you wish. Don't forget to call BAPI_TRANSACTION_COMMIT if the BAPI doesn't include commit handling itself.

You do need to consider error handling. If you are calling a BAPI or equivalent it should give an error message if there is any problem, in which case you raise an exception in your method. The other approach is to use the database update to generate an event, e.g. object.updated, and then have your background task listen for that terminating event to confirm that the work has been done.

The most common approach is to generate the event using change documents using transaction SWED, assuming updating your table results in a change document.

Whatever you do - DON'T assume that the update is always successful, and DO make sure that either success (via a terminating event) or failure (via a method exception) is reported to the workflow - otherwise your workflow will appear to have worked when it has actually failed.

Regards,

Jocelyn