on 02-14-2024 12:51 AM
I tried to insert a record in the ( draft table and the persistent ) of the child entity while calling the 'early Numbering' function
but it did not work .
My Requirement is to show the approvers of the request while creating it .
Can any one help ?
You can use determination on modify ( create; ), it will be called directly after the root record will be created and create the initial child records (approvals) from there:
determination setInitialApprovals on modify { create; }
METHOD setInitialApprovals.
READ ENTITIES OF ZI_ONCALL_ROOT IN LOCAL MODE
ENTITY ONCALL
FIELDS ( guid ) WITH CORRESPONDING #( keys )
RESULT DATA(lt_oncall).
LOOP AT lt_oncall ASSIGNING FIELD-SYMBOL(<fs_oncall>).
MODIFY ENTITIES OF ZI_ONCALL_ROOT IN LOCAL MODE
ENTITY ONCALL
CREATE BY \_Approvers
FROM VALUE #( ( %key = <fs_oncall>-%key
%target = VALUE #( ( %cid = 'CID_DUMMY'
UserName = 'USER01'
%control-UserName = if_abap_behv=>mk-on
ApprovalName = 'Jon Doe'
%control-ApprovalName = if_abap_behv=>mk-on ) ) ) )
MAPPED DATA(lt_mapped)
FAILED DATA(lt_failed)
REPORTED DATA(lt_reported).
ENDLOOP.
ENDMETHOD.
Side Effects are supported in S4/HANA onPremise depending of the version in backend and frontend.
Frontend Side Effects are supported anyway, you can make them as following:
<Annotation Term="Common.SideEffects" Qualifier="Entity_Approvers">
<Record Type="Common.SideEffectsType">
<PropertyValue Property="SourceProperties">
<Collection>
<PropertyPath>Status</PropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="TargetEntities">
<Collection>
<NavigationPropertyPath>_Approvers</NavigationPropertyPath>
</Collection>
</PropertyValue>
</Record>
</Annotation>
The _Approvals data will be refreshed when the value of field "Status" is changed.
You can set the Status field value (or any other field) in the same determination to trigger side effects.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What exactly did not work by creating child records in draft?
Did you create them using EML create by association?
Actually on your screenshot the object is already created in draft so there should be no problem to create child records on this step.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.