Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8430

Re: What do 'GetEntitySet (Query)' & 'GetEntity (Read)' do.

$
0
0

Thanks a lot Ekansh.

 

 

I have now almost implemented both getEntitySet() & also getEntity() methods.

 

 

getEntitySet() is working fine when I use below URL.

 

 

http://<Netweaver Gateway domain>:8000/sap/opu/odata/sap/ZUI5_SAMPLEUSERINFO_SRV/UserInfoSampleSet

 

 

I have also implemented getEntity() method to read a particular record. Below is the code which I have written inside getEntity() method.

 

 

******************

 

 

method USERINFOSAMPLESE_GET_ENTITY.

 

 

data : ls_key_tab   TYPE /iwbep/s_mgw_name_value_pair,

        lc_userInfo_struct type ZUSERINFO_STRUCT,

        lc_userId type zuser_info-zuserid,

        lc_addr type zuser_info-zaddr,

        lc_userinfo_it TYPE  zuser_info.

 

 

READ TABLE it_key_tab WITH KEY name = 'USERID' INTO ls_key_tab.

 

 

lc_userId = ls_key_tab-value.

 

 

select single * from zuser_info into lc_userinfo_it where zuserid = lc_userId.

IF sy-subrc = 0.

   er_entity-zuserid = lc_userinfo_it-zuserid.

   er_entity-zaddr = lc_userinfo_it-zaddr.

   er_entity-zcountry = lc_userinfo_it-zcountry.

ENDIF.

 

 

   endmethod.

 

 

**************************

 

 

But now when I try below URL to get particular record, I am getting below error.

 

 

http://<Netweaver Gateway domain>:8000/sap/opu/odata/sap/ZUI5_SAMPLEUSERINFO_SRV/UserInfoSampleSet('123098')

 

 

***********************

 

 

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

<code>SY/530</code>

<message xml:lang="en">Resource not found for segment 'UserInfoSample'</message>

<innererror>

<transactionid>54A9A66FDD4A0A1CE10000000A298945</transactionid>

<timestamp>20150114132244.6908050</timestamp>

<Error_Resolution>

<SAP_Transaction>

Run transaction /IWFND/ERROR_LOG on SAP NW 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>/IWBEP/CX_MGW_BUSI_EXCEPTION</code>

<message>Resource not found for segment 'UserInfoSample'</message>

<propertyref/>

<severity>error</severity>

</errordetail>

</errordetails>

</innererror>

</error>


Viewing all articles
Browse latest Browse all 8430

Trending Articles