07-17-2019 4:53 PM
Hi Experts,
Is there any functionality similar to webhooks or can sap provide such functionality.
07-18-2019 5:31 AM
07-18-2019 7:05 AM
A Webhook is nothing but an HTTP/HTTPS call. In ABAP too, we can do HTTP calls, find an example below:
"setting request method
lo_http_client->request->set_method('GET').
"adding headers
lo_http_client->request->set_header_field( name = 'Accept' value = 'application/json' ).
lo_http_client->request->set_header_field( name = 'Authorization' value = lv_auth ).
"Available Security Schemes for productive API Endpoints
"OAuth 2.0
CALL METHOD lo_http_client->send
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
http_invalid_timeout = 4
OTHERS = 5.
IF sy-subrc = 0.
CALL METHOD lo_http_client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 5.
ENDIF.
IF sy-subrc = 1.
"error handling
ev_response = 'http_communication_failure'.
ELSEIF sy-subrc = 2.
ev_response = 'http_invalid_state'.
ELSEIF sy-subrc = 3.
ev_response = 'http_processing_failed'.
ELSEIF sy-subrc = 0.
response = lo_http_client->response->get_cdata( ).
*WRITE: 'response: ', response.
ev_response = response.
ELSE.
ev_response = 'Unknown Error'.
ENDIF.
Still, ABAP provides other Webhooks functionality. Read ABAP Webhook documentation for more: https://help.sap.com/viewer/u_collaboration_dev_help/2e53b94ae1af43ca97c343a2bba684eb.html
07-18-2019 7:46 AM
07-19-2019 11:17 AM
Hi Sandra,
SAP Jam provides its webhooks and the same can be either implemented either in ABAP, MTA application or UI5 directly.
07-19-2019 1:00 PM
oh ok, but no need to overcomplexify your answer then 😉
07-19-2019 3:29 PM
Hi Sandra,
User to User the complexity level differs. I believe the one who is asking Webhooks must get to know the code to implement it too.
Thanks!
07-18-2019 3:19 PM
Thanks for your responses. However I would like to suggest SAP to provide a hook or enhancement after every transaction to be able to communicate the change to external system. Also I understand that we are not changing a single table, but a number of tables data gets changed in a transaction. But we have to do an implicit enhancement or something similar to achieve the same. Instead of SAP could provide this functionality, it would be better is what I am thinking. Also yes again we have challenges as data could be changed from tcode or a bapi which may have different implementation.
07-18-2019 3:21 PM
Yes this is in the context of web application. Buti am thinking if any similar thing exists for on premise application/tcode
07-18-2019 3:57 PM
I just know IDocs via XML HTTP. But maybe there are more recent technologies in S/4HANA...
07-18-2019 4:08 PM
Yes with 7.5+ versions, we have json classes and rest classes. But I am talking about the BAdi/exit so that it would be easier like before, commit work and after rather than writing implicit enhancement.
07-19-2019 1:03 PM
Okay, but why don't you use IDocs, it's the way that SAP transfers the changes to external systems. Use the HTTP port, and that's done. Isn't it like "webhooks or [...] such functionality"?
07-19-2019 2:35 PM
Yes, We are using IDocs only. But if we have to transfer only part of the data rather than full data, it becomes somewhat tedious. Also in IDoc, i think it is asynchronous when communicating with non-SAP system
07-19-2019 3:33 PM
The action of sending IDocs is a one-way interface, so it can be asynchronous. If you need a synchronous communication, it means that you want to interact and so you have to choose a BAdI or an Enhancement Option. Doing a custom web call is then not an issue anymore (be careful, there's an implicit database commit).