cancel
Showing results for 
Search instead for 
Did you mean: 

Netweaver Gateway : Multiple Output Tables : Odata

former_member325225
Participant
0 Kudos
917

Hi,

I have created a RFC in ECC system. The RFC reads certain values and returns data in three output tables. The corresponding data model has been created in netweaver gateway.

When the portal application is trying to consume this service, it has to specify a particular table in the odata. Thus, to get the data of the three tables, the portal application is hitting the SAP database 3 times.

Could anyone please advise, how can we get the data for all the 3 tables in one go.

Regards,

Jiten

View Entire Topic
0 Kudos

Hi Jiten,

I'm facing a similar situation. Do you finally know how to achieve that? It's possible with SAP Gateway or it's a misunderstood of GW architecture?

Thanks in advance.

David.

former_member325225
Participant
0 Kudos

Hi David,

This could be achieved using the READ Operation.

1. perform the READ operation for the entity set or the collection with the key input values.

This would provide you with the URLs for the specific tables.

2. Using these URLs you can retrieve the individual table data.

http://help.sap.com/saphelp_nw70ehp1/helpdata/en/f6/152975ec4d411aa192a0de339ffd91/content.htm

Thanks,

Jiten

0 Kudos

Thanks Jiten,

we are able to get several tables data using $expand, but (as we are using "Map To Data Source" in get_entity operation) Gateway is calling the RFC one time for each table. What we need (for performance reasons) is to get information of all RFC tables at one single call.

I think that it might be possible using GET_EXPANDED_ENTITY but i'm not sure about it and I want to find another "standard" solution.

Regards,

former_member325225
Participant
0 Kudos

Hi David,

Yes, the RFC would be called once for each of the tables - i.e. multiple calls to the same RFC.

$expand would be effective only when the method GET_EXPANDED_ENTITY and GET_EXPANDED_ENTITYSET have been implemented.

GET_EXPANDED_ENTITY and GET_EXPANDED_ENTITYSET could be useful to retrieve inline data (or nested table data)

I will try to explain with the example of Sales Orders. Lets say we want to write an RFC that retrieves Sales Orders related data based on certain input criteria.

Now, each sales order will have One Header and Multiple Line Item data. Also the result of the RFC could be multiple Sales Orders - i.e. multiple sales Orders. Refer the below image. It is one output table that contains Sales Order data. Further, each record has inline item data (or nested table with item records).

So, if we need to retrieve Sales Order data and Item data in one read, we need to implement GET_EXPANDED_ENTITY and GET_EXPANDED_ENTITYSET where you would populate the complex output structure.

The output XML(on using $expand in the URL) would have following structure

(Please note this is a pseudo XML for understanding purpose only)

<Sales Order # 1>

      <Item # 1>1</Item # 1>

     <Item # 2>2</Item # 2>

     <Item # 3>3</Item # 3>

</Sales Order # 1>

<Sales Order # 2>

     <Item # 1>4</Item # 1>

     <Item # 2>5</Item # 2>

</Sales Order # 2>

<Sales Order # 3>

     <Item # 1>6</Item # 1>

     <Item # 2>7</Item # 2>

     <Item # 3>8</Item # 3>

     <Item # 4>9</Item # 4>

</Sales Order # 3>

<Sales Order # 4>

     <Item # 1>10</Item # 1>

     <Item # 2>11</Item # 2>

     <Item # 3>12</Item # 3>

</Sales Order # 4>

Now in the above example, nested table for item data is as good as a field in the output structure.

Now, this gives me an idea!! 🙂

Based on this example, theoretically we can have multiple nested tables as fields of the output structure. So multiple table read in one RFC call should be possible if you have all the output tables as nested tables in the output structure. So, the output structure would still be a table with only one record and all the actual output tables would be nested tables. Please see the example below.

This would be an output structure with field  named "Data" and nested tables.

As you can see Table # 1, Table # 2 and Table # 3 are as good as field like "Data" in the output structure.

I think using this approach you should be able to get the data of all the output tables in one RFC fetch.

I have not tried it practically, but yes theoretically, I think you should be able to meet your requirement using the above mentioned approach.

Try it. I believe this should work.

Please check and let me know your findings or observations.

Thanks,

Jiten

former_member325225
Participant
0 Kudos

Hi David,

This is in addition to my earlier comment.

Here's some more useful information on $expand:

http://msdn.microsoft.com/en-us/library/gg309461.aspx

The information on $expand available on this link would help you to expand multiple relationships(for multiple output tables).

Thanks,

Jiten

Former Member
0 Kudos

This doesn't help if you are accessing multiple enitities on the basis of accessing the parent - who says the navigation would go down to children? Why would you need to know all child values for a given collection?

I cannot understand, if you wrote the RFC in question, why you have written it to provide 3 concurrent feeds. That is simply wrong. Each resource should be granular ( one set of operation functions for each entity )  and then you can decide if some means of improving performance can be designed.

If you were using IW_BEP this would be more of a possibility, but you have made your own constraints here.

Regards

RS