Symptom
You are getting a frontend UI exception while clicking on the custom button created for a custom action. And you want to know how a create function in an action of a standard BO or Custom Bo works inside a loop.
Use case: You are receiving an exception during the create operation for which you have written a script from SDK. You may also receive below errors:
- Your system is currently unavailable
- Connection to partner timed out after 580 seconds
- Please try resuming your work. If you still face issues, report an incident
- sap.b.controller.event.PostRequest
Environment
SAP Buisness ByDesign
SAP Cloud for Customer
SAP Business ByDesign
Reproducing the Issue
-
Login to UI.
- Perform the relevant actions which will trigger the SDK code for create action.
- An exception will occur after a speculated time.
Cause
This happens if the actions takes longer than the permitted time to execute. Actions called from the UI are allotted only 580 seconds to execute and if this time exceeds it will results in frontend exception.
The time for create loop increases record by record is, the actual create ( committing to the database ) does not occur as and when the create is called in the ABSL script, but instead the instances to be created are stored in a buffer. The creates only happen if the entire ABSL script has ran successfully.
Create performed inside loops are slow as consistency checks are performed on the previous node instances stored that have also been created ( which are stored in the buffer mentioned above ). In each iteration of the loop, checks need to be performed on all the existing entities in the buffer and hence, the more the number of iterations with create, the slower the script will execute.
Resolution
You have to re-visit your code to provide more parameters to restrict the values or execute the entries in smaller batches. You may also consider any of the below approaches:-
1. A background job such as an MDRO can be used to execute the action being performed in the current BeforeSave script
2. Split the logic in such a way that fewer iterations need to be covered each time the script executes.
Keywords
Exception during UI action Create sales quotes failed from SDK Connection to partner timed out after 580 seconds Please try resuming your work. If you still face issues, report an incident sap.b.controller.event.PostRequest Your system is currently unavailable , KBA , connection to partner timed out , limit 580s , exception in ui due to create loop , AP-RC-BDS-SCR , ByDesign Studio Scripting (ABSL) , AP-RC-BDS-BO , ByDesign Studio BO definition/generation , Problem