Skip to Content
0

Transform SAP BW Queries into OData Service problem

May 18, 2017 at 09:56 AM

107

avatar image

I have followed belowed topic to generate an odata service on Netweaver Gateway.

https://blogs.sap.com/2012/12/08/transform-sap-bw-queries-into-odata-service-generation-and-activation/

Here is service metadata :

<?xml version="1.0" encoding="UTF-8"?>


-<edmx:Edmx xmlns:sap="http://www.sap.com/Protocols/SAPData" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" Version="1.0">




-<edmx:DataServices m:DataServiceVersion="2.0">




-<Schema xml:lang="tr" xmlns="http://schemas.microsoft.com/ado/2008/09/edm" sap:schema-version="1" Namespace="ZOS_TEST004_SRV">




-<EntityType sap:content-version="1" sap:semantics="aggregate" Name="ZRPA_M16_ZRPA_M16_Q114_GUNResult">




-<Key>


<PropertyRef Name="ID"/>


</Key>


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


<Property Name="TotaledProperties" Type="Edm.String" sap:aggregation-role="totaled-properties-list"/>


<Property Name="A1ZPERS_ID" Type="Edm.String" sap:aggregation-role="dimension" sap:filterable="false" sap:label="Tanım" sap:text="A1ZPERS_ID" MaxLength="20"/>


<Property Name="A20MATERIAL__0RPA_WGH1" Type="Edm.String" sap:aggregation-role="dimension" sap:label="Reyon" sap:text="A10MATERIAL__0RPA_WGH1" MaxLength="9"/>


<Property Name="A10MATERIAL__0RPA_WGH1" Type="Edm.String" sap:filterable="false" sap:label="Tanım" MaxLength="20"/>


<Property Name="A20RT_LOCATIO" Type="Edm.String" sap:aggregation-role="dimension" sap:label="Mağazacılık lok." sap:text="A50RT_LOCATIO" MaxLength="4"/>


<Property Name="A50RT_LOCATIO" Type="Edm.String" sap:filterable="false" sap:label="Orta uzunlukta tanım" MaxLength="40"/>


<Property Name="A20CALDAY" Type="Edm.String" sap:aggregation-role="dimension" sap:label="Takvim günü" MaxLength="10"/>


<Property Name="A20CALYEAR" Type="Edm.String" sap:aggregation-role="dimension" sap:label="Takvim yılı" MaxLength="4"/>


<Property Name="A744AADNOFADDO65XHUNZPO562" Type="Edm.Double" sap:aggregation-role="measure" sap:label="Toplam Satış"/>


<Property Name="A744AADNOFADDO65XHUNZPOBHM" Type="Edm.Double" sap:aggregation-role="measure" sap:label="Toplam Satış -1"/>


<Property Name="A744AADNOFADDO65XHUNZPOHT6" Type="Edm.Double" sap:aggregation-role="measure" sap:label="SAP Satış"/>


<Property Name="A744AADNOFADDO65XHUNZPOO4Q" Type="Edm.Double" sap:aggregation-role="measure" sap:label="POS Satış"/>


<Property Name="A744AADNOFADDO65XHUNZPP0RU" Type="Edm.Double" sap:aggregation-role="measure" sap:label="Ticari Satış"/>


<Property Name="A744AADNOFADDO65XHUNZPP73E" Type="Edm.Double" sap:aggregation-role="measure" sap:label="Satış Mağaza POS2"/>


<Property Name="A744AADNOFADDO65XHUNZPPDEY" Type="Edm.Double" sap:aggregation-role="measure" sap:label="Satış Mağaza SAP2"/>


<Property Name="A744AADNOFADDO65XHUNZPPJQI" Type="Edm.Double" sap:aggregation-role="measure" sap:label="Perakende Satış"/>


<Property Name="A744AADNOFADDO65XHUNZPPQ22" Type="Edm.Double" sap:aggregation-role="measure" sap:label="Budget - Sales"/>


<Property Name="A744AADNOFADDO65XHUNZPPWDM" Type="Edm.Double" sap:aggregation-role="measure" sap:label="Budget-Sales 1"/>


<Property Name="A744AADNOFADDO65XHUNZPQ2P6" Type="Edm.Double" sap:aggregation-role="measure" sap:label="Budget - Sales"/>


<Property Name="A744AADNOFADDO65XHUNZPOUGA" Type="Edm.Int32" sap:aggregation-role="measure" sap:label="Sayac"/>


<Property Name="A744AADNOFADDO7C9T5YBYGZE2" Type="Edm.Int32" sap:aggregation-role="measure" sap:label="Sayac - exit"/>


<Property Name="A744AADNOFADDO65XHUNZPQ90Q" Type="Edm.Int32" sap:aggregation-role="measure" sap:label="Prim-reyon"/>


<Property Name="A744AADNOFADDO65XHUNZPQFCA" Type="Edm.Int32" sap:aggregation-role="measure" sap:label="Prim-Sayac- Gun"/>


</EntityType>




-<EntityType sap:content-version="1" sap:semantics="parameters" Name="ZRPA_M16_ZRPA_M16_Q114_GUNParameters">




-<Key>


<PropertyRef Name="AZPERS_ID"/>


</Key>


<Property Name="AZPERS_ID" Nullable="false" Type="Edm.String" sap:filterable="false" sap:label="Personel ID" sap:text="P36D180AB9F5D32E3C13F0AFBD711FAD9" MaxLength="143" sap:parameter="mandatory"/>


<NavigationProperty Name="AZPERS_IDDetails" ToRole="FromRole_AZPERS_IDToListOfValues" FromRole="ToRole_AZPERS_IDToListOfValues" Relationship="ZOS_TEST004_SRV.AZPERS_IDToListOfValues"/>


<NavigationProperty Name="Results" ToRole="ToRole_ZRPA_M16_ZRPA_M16_Q114_GUNParametersToRe" FromRole="FromRole_ZRPA_M16_ZRPA_M16_Q114_GUNParametersToRe" Relationship="ZOS_TEST004_SRV.ZRPA_M16_ZRPA_M16_Q114_GUNParametersToRe"/>


</EntityType>




-<EntityType sap:content-version="1" Name="AZPERS_ID">




-<Key>


<PropertyRef Name="ID"/>


</Key>


<Property Name="ID" Nullable="false" Type="Edm.String" sap:label="Personel ID" sap:text="Value" MaxLength="143" sap:updatable="false" sap:creatable="false"/>


<Property Name="Value" Type="Edm.String" sap:filterable="false" sap:updatable="false" sap:creatable="false"/>


</EntityType>




-<Association sap:content-version="1" Name="AZPERS_IDToListOfValues">


<End Type="ZOS_TEST004_SRV.AZPERS_ID" Role="FromRole_AZPERS_IDToListOfValues" Multiplicity="1"/>


<End Type="ZOS_TEST004_SRV.ZRPA_M16_ZRPA_M16_Q114_GUNParameters" Role="ToRole_AZPERS_IDToListOfValues" Multiplicity="*"/>




-<ReferentialConstraint>




-<Principal Role="FromRole_AZPERS_IDToListOfValues">


<PropertyRef Name="ID"/>


</Principal>




-<Dependent Role="ToRole_AZPERS_IDToListOfValues">


<PropertyRef Name="AZPERS_ID"/>


</Dependent>


</ReferentialConstraint>


</Association>




-<Association sap:content-version="1" Name="ZRPA_M16_ZRPA_M16_Q114_GUNParametersToRe">


<End Type="ZOS_TEST004_SRV.ZRPA_M16_ZRPA_M16_Q114_GUNParameters" Role="FromRole_ZRPA_M16_ZRPA_M16_Q114_GUNParametersToRe" Multiplicity="1"/>


<End Type="ZOS_TEST004_SRV.ZRPA_M16_ZRPA_M16_Q114_GUNResult" Role="ToRole_ZRPA_M16_ZRPA_M16_Q114_GUNParametersToRe" Multiplicity="*"/>


</Association>




-<EntityContainer Name="ZOS_TEST004_SRV_Entities" sap:supported-formats="atom json xlsx" m:IsDefaultEntityContainer="true">


<EntitySet sap:content-version="1" Name="ZRPA_M16_ZRPA_M16_Q114_GUN" sap:updatable="false" sap:creatable="false" sap:deletable="false" EntityType="ZOS_TEST004_SRV.ZRPA_M16_ZRPA_M16_Q114_GUNParameters"/>


<EntitySet sap:content-version="1" Name="AZPERS_IDSet" sap:updatable="false" sap:creatable="false" sap:deletable="false" EntityType="ZOS_TEST004_SRV.AZPERS_ID"/>


<EntitySet sap:content-version="1" Name="ZRPA_M16_ZRPA_M16_Q114_GUNResults" sap:updatable="false" sap:creatable="false" sap:deletable="false" EntityType="ZOS_TEST004_SRV.ZRPA_M16_ZRPA_M16_Q114_GUNResult" sap:addressable="false"/>




-<AssociationSet sap:content-version="1" Name="ZRPA_M16_ZRPA_M16_Q114_GUNParametersToRe" sap:updatable="false" sap:creatable="false" sap:deletable="false" Association="ZOS_TEST004_SRV.ZRPA_M16_ZRPA_M16_Q114_GUNParametersToRe">


<End Role="FromRole_ZRPA_M16_ZRPA_M16_Q114_GUNParametersToRe" EntitySet="ZRPA_M16_ZRPA_M16_Q114_GUN"/>


<End Role="ToRole_ZRPA_M16_ZRPA_M16_Q114_GUNParametersToRe" EntitySet="ZRPA_M16_ZRPA_M16_Q114_GUNResults"/>


</AssociationSet>




-<AssociationSet sap:content-version="1" Name="AZPERS_IDToListOfValues_AssocSet" sap:updatable="false" sap:creatable="false" sap:deletable="false" Association="ZOS_TEST004_SRV.AZPERS_IDToListOfValues">


<End Role="FromRole_AZPERS_IDToListOfValues" EntitySet="AZPERS_IDSet"/>


<End Role="ToRole_AZPERS_IDToListOfValues" EntitySet="ZRPA_M16_ZRPA_M16_Q114_GUN"/>


</AssociationSet>


</EntityContainer>


<atom:link xmlns:atom="http://www.w3.org/2005/Atom" href="http://KTFIORIDEV.KOCTAS.COM.TR:8000/sap/opu/odata/SAP/ZOS_TEST004_SRV/$metadata" rel="self"/>


<atom:link xmlns:atom="http://www.w3.org/2005/Atom" href="http://KTFIORIDEV.KOCTAS.COM.TR:8000/sap/opu/odata/SAP/ZOS_TEST004_SRV/$metadata" rel="latest-version"/>


</Schema>


</edmx:DataServices>


</edmx:Edmx>

When I try to get data from result entity giving an obligatory field required error .

/sap/opu/odata/SAP/ZOS_TEST004_SRV/ZRPA_M16_ZRPA_M16_Q114_GUNResults

<?xml version="1.0" encoding="utf-8"?><error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><code>BRAIN/629</code><message xml:lang="en">Specify a value for variable ZVAR_ZPERS_ID_002</message><innererror><application><component_id/><service_namespace>/SAP/</service_namespace><service_id>ZOS_TEST004_SRV</service_id><service_version>0001</service_version></application><transactionid>6BB03BE7BA07F12180DC005056997F55</transactionid><timestamp>20170518095739.1870000</timestamp><Error_Resolution><SAP_Transaction>Run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details</SAP_Transaction><SAP_Note>See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)</SAP_Note></Error_Resolution><errordetails><errordetail><code>BRAIN/629</code><message>Specify a value for variable ZVAR_ZPERS_ID_002</message><propertyref/><severity>error</severity><target/></errordetail><errordetail><code>/IWBEP/CX_MGW_BUSI_EXCEPTION</code><message/><propertyref/><severity>error</severity><target/></errordetail></errordetails></innererror></error>
 

It is ok , that's mean I have pass obligatory field to get data. But When I pass the obligatory field as a filter , I am getting an error below .

/sap/opu/odata/SAP/ZOS_TEST004_SRV/ZRPA_M16_ZRPA_M16_Q114_GUNResults?$filter=ID eq '00000004'

<?xml version="1.0" encoding="utf-8"?><error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><code>BRAINOLAPAPI/153</code><message xml:lang="en">Syntax error: Syntax Error : {FILTER(ID<<<, row 10, item: 10</message><innererror><application><component_id/><service_namespace>/SAP/</service_namespace><service_id>ZOS_TEST004_SRV</service_id><service_version>0001</service_version></application><transactionid>11B03BE74E68F13E80DC005056997F55</transactionid><timestamp>20170518095506.5390000</timestamp><Error_Resolution><SAP_Transaction>Run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details</SAP_Transaction><SAP_Note>See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)</SAP_Note></Error_Resolution><errordetails><errordetail><code>BRAINOLAPAPI/153</code><message>Syntax error: Syntax Error : {FILTER(ID<<<, row 10, item: 10</message><propertyref/><severity>error</severity><target/></errordetail><errordetail><code>/IWBEP/CX_MGW_BUSI_EXCEPTION</code><message/><propertyref/><severity>error</severity><target/></errordetail></errordetails></innererror></error><br>

Thanks in Advance.

Onur.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
ONUR SARA May 18, 2017 at 01:36 PM
0

Hi All,

Problem solved.

Here is a document about using of OData parameters for BEx queries .
https://help.sap.com/saphelp_nw74/helpdata/en/c9/384c774bcc4837b84bee3679520fb4/content.htm

Now I can get data like this :
/sap/opu/odata/SAP/ZOS_TEST005_SRV/ZRPA_M16_ZRPA_M16_Q114_GUN(AZPERS_ID='00000308')/Results?$format=json

Thanks.
Onur

Share
10 |10000 characters needed characters left characters exceeded