on 2024 Jun 10 11:10 AM
After days of reading documentation, blogs and tutorials... I'm still no step further in what I was expecting to be a pretty straight-forward scenario. I must be missing something obvious, but what?
On our S/4HANA Public Edition development system, I have created an application job to automatically create credit memos. Works like a charm, up until the moment that I actually need to create the credit memo. Of course we want to use the available public API to do so.
There is a default communication arrangement for this API (SAP_COM_0158), which has INBOUND services linked. Makes sense, since I want to call this service to create the credit memo in SAP. That sounds indeed like an inbound interface. It should not matter whether I call it from an actual external system (like BTP) or in this case from the embedded ABAP environment. As far as S/4 is concerned, it is inbound.
This tutorial seems to come closest to what I want to achieve:
Implement an Outbound Service Call in SAP BTP, ABAP environment for an OData Service via Service Con...
Several components are required to make this work. We have a communication scenario ZCS_CREDIT_MEMO, in which I point to outbound service ZOBS_CREDIT_MEMO_REST. Then there is the consumption model ZCM_CREDIT_MEMO, based on the EDMX file from the business hub. It provides me with example code.
To get the destination, static method CREATE_BY_COMM_ARRANGEMENT is being called. Following the tutorial, I enter the communication scenario and the outbound service. This results in an exception. Apparently not the values SAP is expecting. I've tried several combinations of objects, so far nothing works.
DATA(lo_destination) = cl_http_destination_provider=>create_by_comm_arrangement(
comm_scenario = 'ZCS_CREDIT_MEMO'
service_id = 'ZOBS_CREDIT_MEMO_REST' ).
In the debugger I can see the query to retrieve the communication arrangements uses table aps_ca_d_root as a basis. Unfortunately, this being public cloud, I cannot view the contents of that table to see what is actually there. That would be helpful in finding what I should provide the method.
In case I enter the communication arrangement as 'comm_scenario', the system does find the communication arrangement itself, but then filters on available outbound services. Which it does not have, since it's meant for inbound. Once again, no result, which results in the exception.
This has to be incredibly basic. What step am I missing here? Thanks in advance for the help!
why do you want to call the system itself remotely? Isn't there a local API that you can use? I found the https://api.sap.com/bointerface/I_CREDITMEMOREQUESTTP business object interface. Did you consider using this?
Best regards
Kai
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kai,
Calling the public API was with a possible move to BTP in mind. If I program everything as it should work on BTP, that move would be a lot easier. And since I found tutorials that seemed to do something like it, with a lot of the objects and steps in line with expectations, I was convinced I was on the right track. It appears I found myself in a rabbit hole which I couldn't back out of.
The local API makes much more sense, not sure why that wasn't the method that popped up. Possibly because I was searching for the wrong thing.
Thanks for the insight! I'll get back to making this process work 🙂
Kind regards,
Egbert
User | Count |
---|---|
62 | |
12 | |
7 | |
7 | |
7 | |
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.