Hello Team,
I have two determination like below where I want to update admin fields,
determination AdminCreate on save { create; }
determination AdminUpdate on save { create, update; }
While creating instance, I want create admin fields should be populated and while updating instance, update admin fields should be populated but somehow it causes infinite loop and getting below dump
The application has indicated exception "LCX_ABAP_BEHV_DETVAL_ERROR" as the reason for the
termination:
Infinite loop caused by cyclical triggering of on-save determinations
I need to understand,
Thanks a lot.
Best Regards,
Muthu
Request clarification before answering.
Try to limit your determinations such that they are only triggered on field level.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks andre.fischer for your quick response.
Yes keeping trigger conditions on field level disappears the error but in my use case I want to populate these admin fields at the time of create & update.
I kept these fields as read only so from UI it will not get triggered while create/update instance.
Any suggestion here ?
For anyone else facing this same issue, I was able to avoid the infinite loop by using a Global Class with a Static Attribute to control if the Determination was already executed at least once.
Helper Class:
CLASS zcl_test_saver_helper DEFINITION
PUBLIC
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
CLASS-DATA:
already_saved TYPE abap_boolean.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS zcl_test_saver_helper IMPLEMENTATION.
ENDCLASS.Behavior Pool Method
METHOD update_timestamps.
IF zcl_test_saver_helper2=>already_saved EQ abap_false.
zcl_test_saver_helper2=>already_saved = abap_true.
READ ENTITIES OF ZI_Test1_S IN LOCAL MODE
ENTITY Test1
ALL FIELDS WITH CORRESPONDING #( keys )
RESULT DATA(lt_res).
MODIFY ENTITIES OF ZI_Test1_S IN LOCAL MODE
ENTITY Test1
UPDATE FIELDS ( UpdateDate )
WITH VALUE #( FOR key IN keys ( %tky = key-%tky
UpdateDate = cl_abap_context_info=>get_system_date( ) ) )
FAILED DATA(ls_failed)
REPORTED DATA(ls_reported).
ENDIF.
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Muthu,
why not just have determination AdminUpdate on save { create, update; } and in your determination, evaluate if AdminCreate fields are initial, to skip AdminUpdate fields and vice versa (When AdminCreate fields are not initial, to populate AdminUpdate fields)?
Regards,
Jessie
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can use the following annotations in your base view, the framework will then fill up the admin fields automatically.
@Semantics.user.createdBy: true
@Semantics.user.lastChangedBy : true
@Semantics.user.localInstanceLastChangedBy: true
@Semantics.systemDateTime.createdAt: true
@Semantics.systemDateTime.lastChangedAt: true
@Semantics.systemDateTime.LocalInstanceLastChangedAt: true
See example https://github.com/SAP-samples/abap-platform-fiori-feature-showcase/blob/ABAP-platform-cloud/src/%23...
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.