on 08-27-2018 2:08 AM
Hi,
Thanks to Christoph in this answer
Answer to Deep dive 12 question
I'm able to build and run the module. I have another question, it'd better to raise new one instead of commenting in the old question.
I see there are some issues with $skip, $top and $orderby.
The $skip, $top and $orderby do not work properly.
For example:
a. https://<host>/odata/v2/CrudService/BusinessPartner?$top=1&$skip=1
The service doesn't return any data.
b. https://<host>/odata/v2/CrudService/BusinessPartner?$top=2&$skip=1
If $skip < $top like in this case, it returns only one record, not 2 records.
How can I resolve this issue because it will affect the pagination?
c. https://<host>/odata/v2/CrudService/BusinessPartner?$orderby=BusinessPartner desc
The returned data is not sorted by the criteria.
When I debug by Web IDE, it see that the variable queryResponse has the returned data but it doesn't show up on the screen.
I've run these operations directly with /sap/opu/odata/sap/API_BUSINESS_PARTNER and it returns correct data.
Is this a bug, a defect or something I misunderstand here?
How can I resolve it since I can't debug deeper?
Thanks
Tri
At the moment the CAP custom handlers themselves apply the top & skip options.
Meaning when the S/4HANA SDK does the filtering towards the S/4 System, the retrieved BuPAs are correct, however the custom handler then applies the same filters a second time leading to these incorrect results.
I just tested the S4HANA SDK filter & top in a normal servlet -> works as expected.
You can verify this by removing all the filtering through the S/4HANA Cloud SDK and check for correct results.
However, this ist not the ideal solution because it means that the custom handler always retrieve all BuPAs first and then does client side filtering. To overcome this, a custom logic may be applied:
Two options that I can think of:
1) Add the skip value to the top value supplied by CAP.
Example 1
top = 10 & skip = 2
S/4HANA call: top = 12 and skip = 0
Example 2
top = 10 & skip = 0
S/4HANA call: top = 10 and skip = 0
2) You could generate dummy classes that are being skipped anyways and only retrieving the necessary BuPAS. So you would pass on the correct skip and top, but would add n= skip Bupas in the beginning that are being skipped
We are getting in contact with CAP responsible persons to address this behavior and to provide a better solution.
Best Regards,
Daniel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.