Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Webhook like functionality

kjyothiraditya
Participant
0 Kudos

Hi Experts,

Is there any functionality similar to webhooks or can sap provide such functionality.

13 REPLIES 13

Sandra_Rossi
Active Contributor

webhooks in what context?

rudramani
Participant

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

How are SAP Jam webhooks related to ABAP.?

0 Kudos

Hi Sandra,

SAP Jam provides its webhooks and the same can be either implemented either in ABAP, MTA application or UI5 directly.

0 Kudos

oh ok, but no need to overcomplexify your answer then 😉

0 Kudos

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!

kjyothiraditya
Participant
0 Kudos

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.

kjyothiraditya
Participant
0 Kudos

Yes this is in the context of web application. Buti am thinking if any similar thing exists for on premise application/tcode

Sandra_Rossi
Active Contributor
0 Kudos

I just know IDocs via XML HTTP. But maybe there are more recent technologies in S/4HANA...

kjyothiraditya
Participant
0 Kudos

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.

Sandra_Rossi
Active Contributor
0 Kudos

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"?

kjyothiraditya
Participant
0 Kudos

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

Sandra_Rossi
Active Contributor
0 Kudos

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).