on 01-17-2022 7:24 AM
Hello Experts,
I am new to CAP and have requirement to consume trial balance API ( https://api.sap.com/api/C_TRIALBALANCE_CDS/overview) for the entity C_TrialBalance. In this entity, if we see, it has a navigation property called Results and I have to consume the service as it is given in the "business documentation" of this API here. Putting the snapshot of the sample URL here:
https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/C_TRIALBALANCE_CDS/C_TRIALBALANCE(P_FromPostingDate=datetime'2018-01-01T00%3A00%3A00',P_ToPostingDate=datetime'2018-12-31T00%3A00%3A00')/Results?
%24filter=Ledger%20eq%20'0L'%20and%20CompanyCode%20eq%20'1010'&%24select=CompanyCode,GLAccount,StartingBalanceAmtInCoCodeCrcy_F
,DebitAmountInCoCodeCrcy_F,CreditAmountInCoCodeCrcy_F,EndingBalanceAmtInCoCodeCrcy_F
What I did so far:-
1. Created srv->Catalog-Service.cds file with the entity definition from C_TRIALBALANCE & C_TRIALBALANCEResults entity.
2. Created srv->Catalog-Service.js file with the implementation to call READ on C_TRIALBALANCE.
3. Package.json is all in place with the destination created.
Of course, this is incomplete. I am not sure what do I write code to have the call given as in the above URL with navigation properties filtered and main entity queried with date values.
Kindly help.
Thanks & Regards
Srinivas Rao.
I would suggest you download the Metadata of the service from:
/sap/opu/odata/sap/C_TRIALBALANCE_CDS/$metadata
and then follow the documentation at Consuming Services. You should notice that you're calling a View with Parameters. Maybe you get some help from Views with Parameters. I think this answer: CAP: How to properly pass parameters to a View when consumed programmatically (Node.js) should help you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.