cancel
Showing results for 
Search instead for 
Did you mean: 

ODATA Gateway Service

0 Kudos

Hello Expert,

I want to create Odata gateway service to READ Account detail with multiple importing parameter along with value range for that parameter for RFC/BOR object. How I will achieve this object please let me know.Its urgent.

Thank's

Accepted Solutions (1)

Accepted Solutions (1)

AshwinDutt
Active Contributor
0 Kudos

Hello,

Since u would like to pass range values to those key parameters, there would be single/multiple or null entries as part of GW response based on your input value. Considering that the method which is to be implemented is Get_Entity_Set/QUERY operation.

READ operation can hold one 1 entry as part of GW response when u implement Get_Entity / READ operation.

To perform a READ operation u need to implement Get_Entity method.

READ operation needs KEY's to be passed.

Response can have a single entry as part of response or null.

To perform a QUERY operation u need to implement Get_Entity_Set method.

QUERY operation needs FILTER's to be passed.

Response can have either single/multiple entries or null as part of response.

So decide what exactly u need to implement based on your use case Get_Entity/READ or Get_Entity_Set/QUERY operation.

However the steps are same as below.

1. Implement based on your requirement.

a. Get_Entity_Set / QUERY operation and map the fields accordingly in Service Builder and generate run-time objects.

OR

a. Get_Entity/ READ operation and map the fields accordingly in Service Builder and generate run-time objects.

2. In DPC_EXT class , Redefine below methods and just write ' EXIT ' and activate.

/IWBEP/IF_MGW_APPL_SRV_RUNTIME~CHANGESET_BEGIN

/IWBEP/IF_MGW_APPL_SRV_RUNTIME~CHANGESET_END

3. As per my knowledge the below are the operators supported by GW through URL.

EQ Equals

LE Less than or equal to

GE Greater than or equal to

NE Not equal to

GT Greater than

LT Less than


Other operators like CP etc... has to be handled explicitly in GW level in DPC_EXT class in respective methods by checking whether the input value contains ' * ' .

If the input contains ' * ' then u need to pass CP operator explicitly in the code level.


4. U need to Create a PAYLOAD to BATCH all the different operations in a single request :


Headers to be passed :


Content-Type :  multipart/mixed; boundary=batch

x-csrf-token : < pass the value >


Method :


POST


Sample URL :


http://<Host with the Port Num>/sap/opu/odata/sap/<Your Service Name>/$batch


Sample Payload -> example when u have two operations in 1 single request.


If Get_Entity / READ is implemented then below is the PAYLOAD :


--batch

Content-Type: application/http

Content-Transfer-Encoding: binary

GET get_data11(ImWhttype='C2',ImCountry='TH') HTTP/1.1

--batch

Content-Type: application/http

Content-Transfer-Encoding: binary

GET get_data11(ImWhttype='C1',ImCountry='TH') HTTP/1.1

--batch--

If Get_Entity_Set / QUERY is implemented then below is the PAYLOAD :

--batch

Content-Type: application/http

Content-Transfer-Encoding: binary

GET get_rec_types1?$format=json HTTP/1.1

--batch

Content-Type: application/http

Content-Transfer-Encoding: binary

GET get_order_details HTTP/1.1

--batch--

With this u must be able to implement what u r expecting.

Revert if any issues.

Regards,

Ashwin

0 Kudos

Hello Ashwin,

Thanks for your Reply and I have read your blog also regarding this.I have created odata  Query and read for Table as u told in  blog but it showing me all data from m database table.

I wanted to create for Remote enable function module.

Your Blog helped me lot!!!!!!!!!!

AshwinDutt
Active Contributor
0 Kudos

Hello Tasmin,

Debug and check why its returning all the results in DPC. Cross check the way u r sending Filter parameters i.e., if its as per the URI convention or not.

Regards,

Ashwin

0 Kudos

Hello Ashwin,

I solved using table but now I am unable to get using RFC/BOR please help me out.

AshwinDutt
Active Contributor
0 Kudos

Hello Tasnim,

Could you please share wat exactly is the problem u r facing ?

Kindly share some background info like how exactly u would like to pass your inputs to your RFC.

Are u passing inputs as range values to RFC?

It could be great If u can share your RFC input & output structures so that i get idea on wat u would actually want to do & i can can suggest for the same.

Regards,

Ashwin

Answers (2)

Answers (2)

GK817
Active Contributor
0 Kudos

Hello Tasnim,

You will have to use $filter option to achieve what you are trying to do.

Check the below links:

http://mysapgw.wordpress.com/2012/01/25/filter-string-how-to/

vijaybhaskarraju_vegesana
Active Participant
0 Kudos

Hi Tasnim,

Please refer to the below link..

Thanks,

Vijay V