cancel
Showing results for 
Search instead for 
Did you mean: 

SAP BYD update extension field values retroactively

YanGerzon
Participant
0 Kudos

Hi,

When adding an extension field to an object through the SDK, what is then the best way to update its values for all instances that existed before the creation of the extension field?

Say i add one to customers that contains the customer's ID, what is the best way to then update the extension field's value in all customers that already exist?

Accepted Solutions (1)

Accepted Solutions (1)

VVancalbergh
Contributor

Usually you would do this with a Mass Data Run. But you can't make an MDR on std objects.

If the amount of objects in the BO are small enough you could make a custom BO with a single instance and an action that goes over all the objects. But if there are too many objects, the action will time out.

You can "solve" this with making an MDR for your customer BO.

In my experience I had the best result with:

- Add two special extension fields: "UpdateFields" type Indicator, "LastUpdated" type GLOBAL_DateTime.

- Add a trigger OnBeforeSave that, if UpdateFields is true, you update the new extension fields (perhaps only if they're empty). Then you disable UpdateFields and update LastUpdated.

- (now it gets weird) Then you make an OData webservice for the std object. Be sure to attach it to a work center.

- Then you grab your favorite scripting language (I used C#), do a read of all objects and you set UpdateFields to true for each object. Pay attention to logging and error-handling because an object may be locked by another user or process.

This can be daunting if you've never done it before. But once you do you can use this for all the extension fields of that object and you can easily expand it to other objects.

YanGerzon
Participant
0 Kudos

Yeah Iver been doing it with Odata and external scripting...

I was hoping there was some "in house" way of doing it.
Thanks.

Answers (0)