on 11-19-2015 3:08 PM
Hi All,
I have implemented GET_ENTITYSET method and I would like to invoke this method with IT_KEY_TAB filled.
Does anybody help how should I invoke GET_ENTITYSET method where I have values in IT_KEY_TAB?
I tried /sap/opu/odata/sap/ZGW_EPM_SALES_ORDER_SRV/SalesOrder(SoID='500000002') but it is invoking GET_ENTITY method and passing IT_KEY_TAB there but I want to invoke GET_ENTITYSET method.
Entity Set - SalesOrder in my case and Key is SoID.
MetaData -
<?xml version="1.0" encoding="utf-8" ?>
</EntityType>
</EntityType>
</Association>
</AssociationSet>
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>
Regards,
Sid
Hello Sid,
To invoke Get Entity Set method you need to pass inputs as filters and read those filters.
/sap/opu/odata/sap/ZGW_EPM_SALES_ORDER_SRV/SalesOrder?$filter=SoID eq '500000002'
DATA: my_filter_options TYPE/iwbep/t_mgw_select_option,
my_filter_options =io_tech_request_context->get_filter( )->get_filter_select_options( ).
To invoke Get Entity method you need to pass inputs as key's and read those keys.
/sap/opu/odata/sap/ZGW_EPM_SALES_ORDER_SRV/SalesOrder(SoID='500000002')
DATA: lt_keys TYPE/iwbep/t_mgw_tech_pairs.
lt_keys =io_tech_request_context->get_keys( ).
I am not sure why you would still need keys to be read when you are already sending input as filters and can be read with above mentioned code for Get Entity Set.
Regards,
Ashwin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Very old post, but it's the first google result when searching for "IT_KEY_TAB" and "GET_ENTITYSET" so I thought it was worth submitting a helpful answer...
In cases where you're navigating a 1-to-many association (for example if your path was something like ".../OrderSet('10001234')/Items") then the keys from the source entityset (in my example, OrderId 10001234) will be passed in IT_KEY_TAB, and not as a filter value.
So if your service implements such a 1-to-many association you should take care to implement your selection logic based on the given key, and you can use that association to test it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Siddharth,
I will not repeat same thing again to use Filters for sending values to Gateway Service as suggested by Ashwin Dutt R and Gowtham Raja M
Let me tel you how you can use this Filter Option and make your application work:
See below code :
var filterJson = [],
pTypeFilterJson = [];
var oFilter1 = new sap.ui.model.Filter("<your field name1>", sap.ui.model.FilterOperator.EQ, custID);
filterJson.push(oFilter1);
var oFilter2 = new sap.ui.model.Filter("<your field name2>", sap.ui.model.FilterOperator.EQ, ordID);
filterJson.push(oFilter2);
var allFilter = new sap.ui.model.Filter(filterJson, true); //true will add AND condition in betewwn parameter if you want OR condition then pass false.
//Finally set Filter
oComponent.setFilter(allFilter, true);
//If you want to navigate to some other View use below lines else you are done for UI5 changes.
var router = new sap.ui.core.UIComponent.getRouterFor(this);
router.navTo("order_listing");
Now lets see how you can access these parameters in your Gateway methods:
Go to your *DPC_EXT method.
use below code to get Filter values
Data:
lt_filters TYPE /iwbep/t_mgw_select_option,
ls_filter TYPE /iwbep/s_mgw_select_option, " MGW Framework: Selection
Option Parameters for db selects
*-->get filter
lt_filters = io_tech_request_context->get_filter( )->get_filter_select_options( ).
lt_filters will get all your Filter values which you have send.
Now you can read values from lt_filters as below
READ TABLE lt_filters WITH TABLE KEY property = '<Parameter Name>' INTO ls_filter.
if sy-subrc is initial.
// your code will be here
endif.
Thanks-
Abhishek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Siddharth,
In the URL you are giving the inputs with in phrases,so that it will call get_entity.... In order to proceed with get_entityset method, the url inputs should be given with filter options as Ashwin said.
Thanks,
Gowtham
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.