I want to write a custom Fiori, using an oData Service to call the data out of my SAP system.
Using the SEGW transaction, I already set up a service to return a flat structure based on the VBAK table. Using that knowledge, I could develop an EntitySet for each object type and call them if needed. However, I would to reduce my database calls to just one statement. All relevant data should be provided at once.
Now, I ask myself: How to provide nested data in one call? Lets say, for each entry in VBAK, I would like to have a nested array of related VBAP entries.
My questions are:
- How to define the described data model in DDIC?
- How to setup the described data model in SEGW?
- How to reimplement the method in my service implemetation class?
If I had coded the structure in ABAP, it might look like that:
TYPES: BEGIN OF vbakvbap,
vbap TYPE vbap OCCURS 0.
INCLUDE TYPE vbak.
TYPES: END OF vbakvbap.
DATA: lt_vbakvbap TYPE TABLE OF vbakvbap.
I have only a brief knowledge of ABAP and even less of SEGW, so every hint is welcome.