DDIC structure

Odata service implementation for GET_ENTITY

Pre-requisites

1.SAP user id with developer access
2.abap skill 
3.Odata service created using SEGW.(If you dont know how to Please refer  my previous post step-by-step-gateway-odata-service)
4.GET_ENTITYSET implemented already.(If you dont know how to Please refer  my previous post http://www.techippo.com/2015/10/odata-service-implementation-for.html)
        The GET_ENTITY method is implemented to get details of a single entry in the entityset.We pass the key values of an entityset entry and get back single entry.In our example we will be passing carrid of flight entityset and get back only details relevant to the passed carrid.

Steps
1.Go to SEGW .Open created service node.Expand Service Implementation node.Right click on GetEntity(Read) and click on Go to Abap Workbench.
 


2.You will get an information message that method is not implemented. Click OK.




3.You will now land on class builder with ****_DPC_EXT opened.We write our code in this class.Expand methods node.expand inherited methods node.Right click on FLIGHTSET_GET_ENTITY and click redefine.



4.Paste the code to get details of the flight inside method(FLIGHTSET_GET_ENTITY) and activate it.The internal table IT_KEY_TAB of type /IWBEP/T_MGW_NAME_VALUE_PAIR contains key name value pair.we simply access it and write a select query.




5.We are good to go .Now check your service in browser or gateway client.



If you enjoyed this post, I’d be grateful if you’d help it spread by sharing.Thank you! See you soon

2 comments :

Powered by Blogger.