cancel
Showing results for 
Search instead for 
Did you mean: 

Function Import via Eclipse Kepler

Former Member
0 Kudos

Hi,

We are trying to implement function import using eclipse kepler SAP Platform Tools.  We created a stored procedure with name GetStudentName as below.

CREATE PROCEDURE GetStudentName(

@studentid INT    --Input parameter ,  Studentid of the student

)             

AS

BEGIN

    SELECT FirstName+' '+LastName As FullName FROM MarkList WHERE StudentID=@studentid

   

END

We created ODataModel with entity types and function imports with the same name as stored procedure created before.

The deployed service document looks like below

<edmx:Edmx xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" Version="1.0">

<edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:sap="http://www.sap.com/Protocols/SAPData"xmlns:ux="http://www.sap.com/Protocols/OData4SAP/UX" xmlns:gp="http://www.sap.com/Protocols/SAPData/GenericPlayer" m:DataServiceVersion="1.0">

<Schema xmlns="http://schemas.microsoft.com/ado/2008/09/edm" Namespace="MarkOdataModel">

<EntityType Name="Exam">

<Key>

<PropertyRef Name="StudentID"/>

</Key>

<Property Name="StudentID" Type="Edm.String" Nullable="false"/>

<Property Name="FirstName" Type="Edm.String"/>

<Property Name="LastName" Type="Edm.String"/>

<Property Name="Subject" Type="Edm.String"/>

<Property Name="Marks" Type="Edm.String"/>

</EntityType>

<EntityType Name="PhoneBook">

<Key>

<PropertyRef Name="PhoneBookID"/>

</Key>

<Property Name="PhoneBookID" Type="Edm.String" Nullable="false"/>

<Property Name="Name" Type="Edm.String"/>

<Property Name="Address" Type="Edm.String"/>

<Property Name="PhoneNo" Type="Edm.String"/>

</EntityType>

<EntityType Name="MarksView">

<Key>

<PropertyRef Name="StudentID"/>

</Key>

<Property Name="StudentID" Type="Edm.String" Nullable="false"/>

<Property Name="FirstName" Type="Edm.String"/>

<Property Name="LastName" Type="Edm.String"/>

<Property Name="Subject" Type="Edm.String"/>

<Property Name="Marks" Type="Edm.String"/>

</EntityType>

<EntityContainer Name="default" m:IsDefaultEntityContainer="true">

<EntitySet Name="MarkList" EntityType="MarkOdataModel.Exam"/>

<EntitySet Name="PhoneBook" EntityType="MarkOdataModel.PhoneBook"/>

<EntitySet Name="MARKVIEW4" EntityType="MarkOdataModel.MarksView"/>


<FunctionImport Name="GetStudentName" m:HttpMethod="GET">

<Parameter Name="studentid" Type="Edm.Int16" MaxLength="0" Precision="0" Scale="0"/>

</FunctionImport>


</EntityContainer>

</Schema>



Now we are trying to access https://xxx.xxx.x.xxx:8083/gateway/odata/SAP/SAP_TESTSERVICE;v=1/GetStudentName?$studentid=1011

We are getting the following error:


<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">

<code/>

<message xml:lang="en-US">Requested entity could not be found.</message>

</error>



Please help us to resolve this issue?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Using $filter on service created, we are successful in making simple queries.

for example

store.executeReadEntitySet("tablename" +  "?$filter=status+eq+'active'"

                  , null);

we are able to make complex queries too

$filter=x eq 'a' and y eq 'b' and z eq 'c'


Now we are trying with table join.

Please clarify that this can be done through SAP NetWeaver Gateway 2.0 only?

Jitendra_Kansal
Product and Topic Expert
Product and Topic Expert
0 Kudos