cancel
Showing results for 
Search instead for 
Did you mean: 

Fiori Elements side effects on actions

SamueleBarzaghi
Participant

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

breinelt
Explorer
0 Kudos

Hello Sam,

did you find a solution for this problem? We're facing the same issu.

Thanks.

Bettina

SamueleBarzaghi
Participant
0 Kudos

Hi Bettina,

Unfortunately no.

In the meantime we upgraded to 1909 FPS2 and new SAPUI5, I will check if it solved and let you know.

Bye

Sam

Sschlegel
Participant
0 Kudos

Hi Samuele,

I am also on 1909 FPS1 with the same problem - I pray for some good news of you 🙂

Regards

Sören

Accepted Solutions (0)

Answers (2)

Answers (2)

Sschlegel
Participant

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

Florian_Kube
Participant
0 Kudos

Thank you! It works 🙂

gregorw
Active Contributor
0 Kudos

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

damienwyzeon
Discoverer

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

FredericGirod
Active Contributor

Damien, tu as oublié le petit bouton [CODE] pour formater ton code 😉

Fred