cancel
Showing results for 
Search instead for 
Did you mean: 

Call mutiple tables data in single OData service call

Former Member
0 Kudos

Hi,

We have created a ZBAPI same as standard BAPI "ALM_PM_NOTIFICATION_GETDETAIL" for creating an ODATA service. But we are facing problem while calling the data from multiple tables in a single query/entity while creating that ODATA service using SEGW.

Please guide me how can we do that or is this possible to do that.

Thanks,

Shrikant N.

Accepted Solutions (0)

Answers (2)

Answers (2)

SyambabuAllu
Contributor
0 Kudos

Hi Shrikant,

Yes,I am agree with above comments but performance issue will have some consideration for this scenario.

look into below link...

Thanks,

Syam

AshwinDutt
Active Contributor
0 Kudos

Hello Shrikant,

You mean to say BAPI is returning multiple tables and you have to get all those table data in one call ??

If this is the case you cannot get all the table data from that BAPI in one shot as you can map only 1 table as response table in GW.

Assuming you are passing inputs A & B to your BAPI and it is returning 2 tables in the response,

maintain a Parent entity ( dummy one ) and create association to those tables ( each table as different entity ).

This way you get all the tables data in one go as GW calls your RFC 2 times.

I mean to say you have 2 tables in the BAPI response , GW calls 2 times the same logic to get those 2 tables. i.e., Table 1 in 1st call and Table 2 in 2nd call.

Your URL would be looking like this its just an example :

http://<GW_Host>/sap/opu/odata/sap/<Service_Name>/<Parent>?$filter=A eq 'x' and B eq 'x'&$expand=Table1_Set,Table2_set

where Table1_Set and Table2_Set are your navigation properties which you would have defined.

Also note that here there is a performance trade-off here as GW calls 2 times the same logic and that is how GW calls BE on $expand.

Suggestion is to have separate FM's to get those tables separately so that data retrieval is fasted and there is no overhead.

Regards,

Ashwin

Former Member
0 Kudos

Hi,

Thanks for reply. Here as you say that it would be better to define separate FMs for calling the tables so will it be same as current scenario as again the Odata call will happen 2 times for both the tables from separate FMs. We are trying to create an mobile application based on the OData service, so my concern is overhead on the network calls happening from mobile device.

Thanks,

Shrikant

AshwinDutt
Active Contributor
0 Kudos

Hello Shrikant,

Yes. If you create association there will be 2 calls and if you create 2 separate FMs to retrieve data also you will have to make 2 different calls.

I don't see any other way apart from the above 2 approaches to get data in your scenario.

Regards,

Ashwin

former_member184867
Active Contributor
0 Kudos

Network overhead can be lowered significantly if you use

1. $expand : This will get you Parent Entity and its Child Entity and its Child Entity and so on in one network call. This can get you data from multiple tables in one call.

2. $select : To select only the required fields from the entity

3. $filter : To filter out dataset

4. $top and $skip for pagination

5. If needed implement deltatoken

6. $batch