cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Android SDK - CDS view published as OData

marco_paroti
Explorer
0 Kudos
459

Hi all,

We have defined a CDS view and published it as an OData service.

@OData.publish: true

This service is in the mobile services as destination. Now we would like to add this service to the SAP Android SDK

Based on the metadata, the SAP Android SDK generates the Java definition of the request:

public ZCDS1Type getZCDS1Type(final DataQuery query)

The generated definition returns a single item instead of a list of items as it usually generates and returns.

The request itself returns a list of items, that is correct.

Only this definition is incorrect and it generates a crash inside the app since the definition does not match the returned type.

com.sap.cloud.mobile.odata.QueryResultException: getRequiredEntity: result value (with type Z_CDS1_CDS.Z_CDS1Type*) is not an entity value. It is a list with 340 items.

Android Studio 3.6.3

SAP Android SDK 2.1.1

Does something have to be adjusted in the CDS view?

Or in the OData service?

Or how can we fix this bug?

Thank you.

Best regards,

Marco

View Entire Topic
grabz
Advisor
Advisor
0 Kudos

We found the given method via a ticket, but updating it here too:

    public @androidx.annotation.NonNull @org.jetbrains.annotations.NotNull java.util.List<com.sap.cloud.android.odata.zstam_cds_matclas_cds_entities.@org.jetbrains.annotations.NotNull ZSTAMCDSMATCLASType> getZstamCdsMatclas() { 
return this.getZstamCdsMatclas(null, null, null);
}

more readable version:

public @NonNull @NotNull List<@NotNull ZSTAMCDSMATCLASType> getZstamCdsMatclas() { 
return this.getZstamCdsMatclas(null, null, null);
}