Application Development and Automation 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: 
Read only

Webhook like functionality

kjyothiraditya
Participant
0 Likes
3,689

Hi Experts,

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

13 REPLIES 13
Read only

Sandra_Rossi
Active Contributor
2,911

webhooks in what context?

Read only

rudramani
Participant
2,911

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

Read only

2,911

How are SAP Jam webhooks related to ABAP.?

Read only

0 Likes
2,911

Hi Sandra,

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

Read only

0 Likes
2,911

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

Read only

0 Likes
2,911

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!

Read only

kjyothiraditya
Participant
0 Likes
2,911

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.

Read only

kjyothiraditya
Participant
0 Likes
2,911

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

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,911

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

Read only

kjyothiraditya
Participant
0 Likes
2,911

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.

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,911

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

Read only

kjyothiraditya
Participant
0 Likes
2,911

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

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,911

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