on 02-07-2020 6:51 PM
Hi,
We have developed an ABAP application programming model fiori app (cds, bopf, fiori elements list report) on premise S4H 1809 FPS 0.
An action on the root node creates an entity of the subnode 1:n and change the status of the root node.
The action is visible in the fiori app object page and can be used but after the call to the action the field status of the root node is refreshed but the table on the object page binded to subnode is not refreshed.
We tried to solve using side effects with following annotation but the subnode list is refreshed only when ENTER is pressed.
<Annotation Term="Common.SideEffects" Qualifier="changeStatus">
<Record>
<PropertyValue Property="TargetEntities">
<Collection>
<NavigationPropertyPath>to_Voti</NavigationPropertyPath>
</Collection>
</PropertyValue>
<PropertyValue Property="SourceProperties">
<Collection>
<PropertyPath>Status</PropertyPath>
</Collection>
</PropertyValue>
</Record>
</Annotation>
<Annotation Term="Common.SideEffects">
<Record Type="Common.SideEffectsType">
<PropertyValue Property="TriggerAction" Path="Vota_ac"/>
<PropertyValue Property="TargetEntities">
<Collection>
<NavigationPropertyPath>to_Voti</NavigationPropertyPath>
</Collection>
</PropertyValue>
</Record>
</Annotation>
TriggerAction property is deprecated and not documented.
Thank you for help
Sam
Hi all,
at first you need to take a look into Metadata.xml and look into the area "EntityContainer" - there you find the Name of the "Entity" for your action (I know - it sounds strange).
<EntityContainer Name="cds_zsd_operation_Entities" m:IsDefaultEntityContainer="true" sap:message-scope-supported="true" sap:supported-formats="atom json xlsx">
<EntitySet Name="ConfirmOperation" EntityType="cds_zsd_operation.ConfirmOperation" sap:creatable="false" sap:updatable="false" sap:deletable="false" sap:content-version="1"/>
....
</EntityContainer>
You need the name of the EntitySet and the Name of the EntityContainer and also the "Namespace" that will be used under "annotations/annotation.xml" - you can also define an alias in this file.
<edmx:Reference Uri="/sap/opu/odata/sap/ZMY_OperationService/$metadata">
<edmx:Include Namespace="cds_zsd_operation" Alias="operation" />
</edmx:Reference>
And finally the annotation itself (also in annotation.xml) - important is the "_it" at the beginning, if you want to reload via an association.
<Annotations Target="operation.cds_zsd_operation_Entities/ConfirmOperation">
<Annotation Term="Common.SideEffects" Qualifier="ReloadOnConfirmation">
<Record Type="Common.SideEffectsType">
<PropertyValue Property="TargetEntities">
<Collection>
<NavigationPropertyPath>_it/to_TempConfirmation</NavigationPropertyPath>
<NavigationPropertyPath>_it/to_OrderConfirmation</NavigationPropertyPath>
</Collection>
</PropertyValue>
</Record>
</Annotation>
</Annotations>
Works as expected on 1909 FP2.
Regards
Sören
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sören,
what changes Do I need to apply if my Action is executed when the header entity is selected in the table of the list page and changes an attribute of the header entity? I have defined two SelectionVariants based on the changed attribute. What I want to achieve is that after executing the action the list should be refreshed so that the changed entry is not shown anymore.
CU
Gregor
hello Samuele,
I recently faced the same situation/issue as the one your reported here which was very frustrating.
As I have not found any documentation of solution, I am posting here the details of what I have implemented successfully :
Step 1: deactivate the action button from the exposed CDS:
with this, the Import function are still available in the service (segw), but not displayed in the fiori app
Step 2: create the action button as an extension in the fiori app (i did it with webide)
Step3: (the interesting part :p) combine the function call and the refresh in your extended object controller with a code similar to this :
- go to the file ObjectPageExt.controller.js
- you should have an empty function onClickAction<yourCDS>Header1: function (oEvent) { }
- apply the following code replacing <xxx> by the appropriate context
var bindingContext = this.getView().getBindingContext();
var oModel = bindingContext.getModel();
var property = bindingContext.getProperty("<yourParam>");
var that = this;
//busy on
this._busyDialog = new sap.m.BusyDialog({});
this._busyDialog.open();
oModel.callFunction("/<yourImportFunction>", {
method: "POST",
urlParameters: {
"<yourParam>": property
},
success: function(oData, oResponse) {
oModel.refresh(true);
that._busyDialog.close();
sap.m.MessageBox.success("successMsg", {});
},
error: function(error) {
oModel.refresh(true);
that._busyDialog.close();
sap.m.MessageBox.error("error msg", {});
}
});
nota : I am not a developer.. this code can certainly be improved 😉
nota 2: in my context, I needed to be able to get one value of the current binding in order to pass as a parameter to the import function. you might have to adapt to the appropriate signature of your function.
nota 3: I have included a notion of busyindicator as my function call was taking a few secs.
hope this answer will be useful
rgds
Damien
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Damien, tu as oublié le petit bouton [CODE] pour formater ton code 😉
Fred
User | Count |
---|---|
61 | |
9 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.