Skip to Content
0
Apr 23, 2020 at 11:12 AM

Odata service call issue

40 Views

First thing is when we define properties of entity set, its never with respect to a database table but an internal table (probably of a BAPI) Now you tick key attribute in properties as take an example F1 - KEY F2 - KEY F3 - KEY V1 - VALUE In database table we always have one value with respect to one key . But in itab same (F1+F2+F3) can have V1,V2,V3 ... Vn values as no constraints are restricted.

If i query like : http://url.companyid.com:8000/sap/opu/odata/sap/ZSERVICE/ZCOSTCENTRESET(KOKRS='1000',GJAHR='2019',PERBL_F='000',PERBL_T='000',VERSN='0',KSGRU='1092') i am forecefully directed to GET_ENTITY method as i passed key values .But ...

In this case i can get output format as column of record from internal table. KOKRS - 2019 GJAHR - 2019 PERBL_F = '000' PERBL_T = '000' VERSN = '0' KSGRU = '1092' SUBOBJNR 10001 KOKRS - 2019 GJAHR - 2019 PERBL_F = '000' PERBL_T = '000' VERSN = '0' KSGRU = '1092' SUBOBJNR 10002 (Two values of same key) Problem is now if i am restricted to pass query as parameter this way then only and only function GET_ENTITY will trigger which will give me only a single record (but i have multiple) Further for GET_ENTITY_SET i can not pass any parameter which will unnecessary pull full data and i need to apply filters later. example : http://url.companyid.com:8000/sap/opu/odata/sap/ZSERVICE/ZCOSTCENTRESET How to work with this situation to optimally get data ? Suppose i use three header field as parameter for input in my fiori app through which i need to obtain detail using odata query.Does that mean i cant attain multiple records as everytime i will be directed to get_entity and not get_entityset ? Regards, Aditya