Skip to Content
Author's profile photo Pradeep Kumar N

Performance best practice with Mass enabled event

Hi,

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”:

BO.PNG

2) Created UIs:
OWL: To display data

QAF and OIF : To edit data

3) Created AfterModify event without Mass enabling on Account node to determine the AccountName:
AfterModifySingle.PNG

ABSL Script: To determine AccountName for the current AcctID

This is done by querying on BusinessPartner passing AcctID to get AccountName:

AfterModifySingleScript.PNG

4) Created Webservice “ManageSales2In” to create data into the Sales2 Business Object:

Note: Here AcctName is not selected because this would be determined in the AfterModify event
Webservice.png

Tested the webservice using SOAP UI:
Request to create Sales2 with OrderID = 2 and with Account node containing AcctID GCBAC20123, GCITC20124 and GCITC20125

WebserviceSingleRequestRuntime.PNG

Had placed breakpoint at Sales2->Account->AfterModify event, this event is hit 3 times:

first time: for AcctID GCBAC20123:
AfterModifySingle1.PNG

second time: for AcctID GCIT20124:

AfterModifySingle2.PNG

third time for AcctID GCITC20125:

AfterModifySingle3.PNG

With successfull Webservice response:

WebserviceSingleResponse.PNG

5) OWL shows the created data:
OWL2.PNG

6) OIF shows the child items data:
OIF2.PNG

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:

AfterModifyMass.PNG

2) Tried to create data with webservice:
WebserviceMassRequestRuntime.PNG

3) AfterModify event is hit only once instead of 3 times:

Now all the three Account data with AcctID GCGBAC20123, GCBAC20124 and GCBAC20125 are passed to the AfterModify event togather:
AfterModifyMassScript.PNG

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.

Thanks, Pradeep.

Assigned Tags

      6 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Kumar Raj Moorthy
      Kumar Raj Moorthy

      Thanks Pradeep for this very useful blog.

      Author's profile photo Fred K
      Fred K

      Thanks , Pradeep.

      Really helpful.

      Author's profile photo Nandyappa Naveen Kumar
      Nandyappa Naveen Kumar

      Thanks a lot pradeep..Really helpful in performance tuning 🙂

      Author's profile photo Gustavo Togni
      Gustavo Togni

      This is amazing. Thanks a lot!

      Author's profile photo Praveen Srivastava
      Praveen Srivastava

      Very nice 🙂

      Thank you Pradeep

      Author's profile photo BalReddy Allam
      BalReddy Allam

      Thanks Pradeep for this Informative blog