Skip to Content

SAPUI5 Odata V4 model, filtering in combination with extend

Hi all,

We are developing an app using SAPUI5 and ODataV4 and we're facing the following issues:

1. When we bind model to view and want to present filtered list of "Circumstances" and also do extend to entity "CircumstanceText":

<List id="CircumstanceList"
    items="{
    	path: 'processModel>/Circumstance',
    	parameters: {
    		$expand: 'circumstanceText',
    		$orderby: 'sortOrder',
    		$filter: 'isActive eq true'
    	}
    }">
    <CustomListItem type="Navigation" press="onCircumstanceSelected">
        <HBox fitContainer="true">
            <core:Icon size="1.5rem" width="3rem" src="sap-icon://hint" press="onShowInfo"/>
            <VBox fitContainer="true" justifyContent="Center">
                <Text text="{path: 'processModel>circumstanceText/0/circumstanceName', type: 'sap.ui.model.type.String' }"/>
            </VBox>
        </HBox>
    </CustomListItem>
</List>

in browser console the following error is logged:

In Java backend logs, we found that this OData request creates following query:

SELECT FROM ProjectName::Process.Circumstance AS ROOT_ENTITY_ALIAS{
	circumstanceID AS ZZcircumstanceID,
	sortOrder AS ZZsortOrder,
	isActive AS ZZisActive,
	// Additional aliases...
	circumstanceText.{
		circTextID AS circumstanceTextZZcircTextID,
		language AS circumstanceTextZZlanguage,
		circumstanceName AS circumstanceTextZZcircumstanceName,
		// Additional aliases...
	}
} 
WHERE ( ROOT_ENTITY_ALIAS.isActive = true ) AND ROOT_ENTITY_ALIAS.circumstanceID IN (
	SELECT FROM ProjectName::Process.Circumstance{circumstanceID} 
		WHERE ( .isActive = true ) ORDER BY sortOrder ASC, circumstanceID ASC LIMIT 100 OFFSET 0 ) 
ORDER BY ZZsortOrder ASC, ZZcircumstanceID ASC, circumstanceTextZZcircTextID ASC

The issue here is in the subquery WHERE clause: .isActive = true (dot is unexpected).

CDS representation of entities looks like this:

entity Circumstance {
  key circumstanceID : type Integer;
   isActive : Boolean;
   sortOrder : Integer;
   .....
  circumstanceText : association[1, 0..*] to CircumstanceText on circumstaneText.circumstance.circumstanceID = circumstanceID;
};
entity CircumstanceText {
  key circTextID : Integer;
  language : String(2);
  circumstanceName : String(20);
  ....
};

So is this a bug or are we doing something wrong?


2. Issue: I know it is not directly related to previous question but it is closely connected:
- while implementing CDS artifacts we want to make use of user defined types. So if we would declare two user define type and change "Circumstance" entity like this:

type CircIdentifier : Integer;

entity Circumstance {
  key circumstanceID : type CircIdentifier;
   isActive : Boolean;
   sortOrder : Integer;
   ...
  circumstanceText : association[1, 0..*] to CircumstanceText on circumstaneText.circumstance.circumstanceID = circumstanceID;
};entity CircumstanceText {
  key circTextID : Integer;
  language : String(2);
  circumstanceName : String(20);
  ...
};

Then due to using user define type for Circumstace key ("key circumstanceID : type CircIdentifier;") we get the following error in browser console:

and no data is returned form the query..
Is this expected?

Thanks in advance for your time and help.

consolelog.jpg (73.3 kB)
consolelog2.jpg (100.8 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers