banner



How To Find Bapi In Sap Abap

REST.

JSON.

These are the technologies yous need when writing modern spider web applications. And that is what makes it and then hard to use SAP together with mod web applications: Currently you merely go REST from SAP with Gateway, simply not JSON. OData comes from Microsoft and support is not as broad spread as someone expects. How OData does looks similar? You can try information technology out by downloading the Gateway Trial from SCN or use the online demo organization. To experiment with Gateway the usual flight example from SAP tin can be used.

To get the details of a specific flight:

http://gateway trial server:port/sap/opu/sdata/iwfnd/RMTSAMPLEFLIGHT/FlightCollection(carrid='AA',connid='0017′,fldate='20110601′)

Data returned from Gateway:

/wp-content/uploads/2012/05/1gwodata_104244.jpg

Instead of existence able to use the data exposed by Gateway past the widely used Javascript frameworks like jQuery you demand to find a OData plugin. Of course you can utilise SAP UI5, just what when you are forced to utilize jQuery, Sencha, Dojo or something else?

That'south a problem with SAP and ABAP in general: y'all have to wait until SAP implements missing functionality or someone posts it on Code Exchange or some other platform, and because of the limit resources bachelor in the ABAP ecosystem this can have a while, costs some (serious amount of) coin or will never happen. That'southward where we can be happy that SAP also embraces the use of Java. Every bit Coffee was made for the internet in that location is a huge Coffee community out there that most probably already developed a tool that fits your needs.

For exposing data as JSON in a Rest-total way the tool available is: Bailiwick of jersey

Afterward Jersey transformed the data, the response looks like:

/wp-content/uploads/2012/05/1bapijson_104245.jpg

Bailiwick of jersey needs Java 6 and runs in a servlet container. Every bit NetWeaver CE >= seven.ii fulfills these requirements, Jersey can be used to transform Java objects into JSON and expose them using Residual. NW CE comes with a framework for creating composite applications (CAF) that can consume BAPIs. CAF uses standard J2EE technology similar JCA and Beans. This bean can be used by Jersey to automatically extract the data, transform it into JSON and make information technology accessible using REST.

Consuming a BAPI using CAF tin can be done with no coding involved at all as CAF comes with some nice wizards. Just map the input and output parameters and the lawmaking will exist generated including the edible bean that tin can be used to collaborate with the BAPI. In the Jersey web application the URL and protocol get divers:

          @Get @Path("getFlight/carrid/{carrid}/connid/{connid}/fldate/{fldate}") @Produces("awarding/json")        

The CAF bean gets called using the parameters retrieved from the URL:

          out = east.bapiFLIGHTGETDETAIL(goose egg, nada, goose egg, carrid, connid, flightDate);        

That's it. Jersey will practice the rest:

/wp-content/uploads/2012/05/3jsonfirebug_104249.jpg

How the URL gets constructed is up to y'all, the parameters tin exist function of the URL as above or a query. You can as well ascertain if information technology is Get, Postal service, PUT, etc. If you desire to practice some coding you tin adapt the output, or combine the consequence of several BAPIs into 1 Java object that JSON will expose.

At present that the BAPI can be accessed in a RESTful way and the data retrieved is in the JSON format, information technology's piece of cake to use the data in a Javascript framework similar jQuery with Datatables:

/wp-content/uploads/2012/05/4jquerytable_104250.jpg

The actual coding for making the CAF bean accessible to Jersey and expose the data is less than ten lines of code. From CAF to Bailiwick of jersey to a running HTML awarding information technology does not even take xxx minutes.

The framework I used for interacting with the ABAP system is CAF, a framework available for NetWeaver Java since a while (7.0): well documented enterprise set up and supported. If you lot want or need to betrayal your BAPI by REST and JSON or XML and you have a NetWeaver CE >= vii.2 (like Portal 7.iii) available, y'all can start today. Equally your NW CE system is a separate one, upgrades won't affect your backend organization and as Jersey is also a separate application; changes to Jersey don't affect your other CE server and applications. Of course you don't need NW CE for using Jersey and CAF for interacting with BAPI. Every platform that Jersey supports and where you can use JCo from SAP to call a BAPI can be used like tomcat. Information technology only ways that some extra configuration and coding volition be necessary. This as well implies that your backend ABAP system can be used every bit long equally a JCo connection to it is possible.

Source: https://blogs.sap.com/2012/05/22/expose-a-bapi-using-json-and-rest/

Posted by: huynhhicum1949.blogspot.com

0 Response to "How To Find Bapi In Sap Abap"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel