Search code examples
odatabapisap-gateway

OData vs BAPI in SAP environment


Whatever we can do with OData, we can able to do using BAPI right?

So,what's the main thing which OData is having compared to BAPIs ?

Please let me know your views


Solution

  • BAPI

    • SAP-proprietary
    • Based on RFC, an SAP-proprietary protocol
    • Fixed input structure (no URL with flexible query parameters)
    • Fixed output structure (structures, tables, but not a dynamic number of each)
    • Manual documentation describes the service's structure for humans only
    • Conclusion: Good for connecting SAP systems to each other

    OData

    • Open Standard
    • Based on REST, the web's de facto standard protocol for app integration
    • Flexible query language (filter, sort, expand, associate, search)
    • Flexible output (entity, entity set, expanded entity)
    • Metadata document explains service structure in machine-readable format
    • Conclusion: Good for connecting SAP systems to SAPUI5 and similar UIs

    The main thing OData gains over BAPIs are flexibility, open standards, and machine-readability. This may come at the price of speed.

    This comparison is slightly off. While BAPI was invented to connect servers, OData is rather used to connect servers to clients. Even though OData's inventors may have had server connections in mind, pure REST has become the de facto standard for connecting this level. It would therefore be cleaner to compare BAPI to REST, and maybe related standards such as web services.

    It is possible to emulate OData over a BAPI interface: (URL query) string in, (JSON result) string out. You could therefore conclude that the two are equivalent in terms of power. However, the underlying protocol is different, and systems are more likely to recognize the HTTP protocol underneath REST than SAP's proprietary RFC protocol.