C4C Coding Performance Optimization

C4C Coding Performance Optimization

SAP C4C SDK Performance Optimization

In order to develop smooth and fast processes with SAP Cloud Applications Studio you need to follow certain best practices. These practices help in code optimization and decrease execution time.

Some of the best practices are listed below:

a. Avoid Dump: If a code is written to navigate using association then you should check if the association has some data using “IsSet()” function before navigating via association. This will prevent the dump. 

Ex. Following code checks if BusinessPartnerVisitingInformation node is set for customer to avoid dump.

b. High Association Retrieves: Retrieving an association takes more time than accessing a node. Too many association retrieves slows down the system performance.

c. Trace Statements: Trace statements are used to calculate the time taken by a piece of code. They are helpful in optimizing the code but we should remove trace statements from production tenant as if slows down the performance.

d. Empty Create() calls: While creating records of a BO from ABSL using “elementsof” functionality creating the instance of BO first and updating the fields later causes update calls & bufferflushes which increases the execution time of code.

e. Excessive use of Where() calls: The Where()  call converts directly into for-each loop which increases execution time of code and slows down the system performance.

f. Parallel Processing in MDRO: If parallel processing is not turned on in MDRO than it will take more time to execute the background job. Execution window for a MDRO is 10 hours, if the time execution exceeds more than 10 hours than the run is terminated.

g. Action not mass enabled: If the ABSL action is not mass enabled than it will run every-time for each instance. It is helpful to MDRO actions where large number of instances are executed.

h. MDRO Design/Query inside ABSL: If the ABSL action code of MDRO has query than it run for each instance which will result in slow system performance. We can use query inside MDRO definition to improve the system performance as it remove unnecessary query execution in MDRO bonded action.

i. Lazy load UI components: This property can be enabled while adding embedded components in standard screens. This results in faster loading times of the records as data of EC gets loaded when it is displayed.

j. Buffered Retrieves: Retrieves should be used instead of queries anywhere as they take less time for execution.

k. Reuse Library: Calling a reuse library in a loop will slow down the system performance.

l. Enable Operation Clubbing: This feature allows clubbing of multiple UI resources and result in faster performance.