Performance best practice with Mass enabled event
I would like to explain the performance improvement that could be achieved with mass enabled event with the following example scenario:
Created Business Object Sales2 with child node Account having cardinality 0 to n, this child node has two elements AcctID and AcctName,
where AcctID is input by the user and AcctName is determined in the AfterModify event automatically.
Data is created via Webservice create request.
In the Part1 would explain how Sales2 data is created without mass enabled AfterModify event on node Account, and in
Part2 would explain how Sales2 data is created with mass enabled event.
Part1 : Without mass enabled AfterModify event
1) Created a Business Object named “Sales2”:
2) Created UIs:
OWL: To display data
QAF and OIF : To edit data
ABSL Script: To determine AccountName for the current AcctID
This is done by querying on BusinessPartner passing AcctID to get AccountName:
4) Created Webservice “ManageSales2In” to create data into the Sales2 Business Object:
Tested the webservice using SOAP UI:
Request to create Sales2 with OrderID = 2 and with Account node containing AcctID GCBAC20123, GCITC20124 and GCITC20125
Had placed breakpoint at Sales2->Account->AfterModify event, this event is hit 3 times:
second time: for AcctID GCIT20124:
third time for AcctID GCITC20125:
With successfull Webservice response:
Summary: Webservice create request invokes AfterModify event 3 times
Part2: With Mass Enabled AfterModify event
Deleted the Sales2->Account->AfterModify event created in Step 3) above and made it Mass enabled:
1) Mass enabled AfterModify:
3) AfterModify event is hit only once instead of 3 times:
Summary: Webservice create request invokes AfterModify event only once
Advantages of having mass enabled event in this case:
1) Rount trip is reduced to once instead of three times, that is AfterModify is called only once instead of 3 times
2) Code inside the mass enabled event could be bundled, that is
Query “qryAcct.Execute” inside the mass enabled event is called once instead of three times
3) Can access all items easily, that is in the same call we can check all the items without additional effort,
example we could check for duplicates for AcctID
Hence, webservice create operation performance would improve.
Note: This mass enabled event would also be useful for Internal communication, file input etc.