Skip to Content
Author's profile photo Anand V D

How to persist custom data in SAP PI java table – Part 3

In part-1 and part-2 of the blog we created a table in java stack, created and deployed entity and session bean in java server. Also we added HTTP authentication for the deployed service.

In this part we will test the service in SAP PI.

STEP 8: Test the webservice in WSNavigator


Open wsnavigator in SAP PI and select Provider System in search type and search for the webservice

/wp-content/uploads/2016/01/8_a_869979.jpg

Select the interface and click next and you should be able to see all the methods we created in the session bean

/wp-content/uploads/2016/01/8_b_869980.jpg

Let’s test add ticket method. Select AddTicket method and click next. Provide all the input values and click next. If the insert is successful we should get the ticket number back as response

/wp-content/uploads/2016/01/8_c_869987.jpg

Let’s read all the rows in the table and see if the row is actually inserted in the table

/wp-content/uploads/2016/01/8_d_869988.jpg

Web service clients:

     a) PI mapping: Since the web service is available in SAP PI, We can perform SOAP lookup in mapping step to perform any operation on the table.

     b) Adapter Module: Since we have local interface deployed along with the session bean, we can use dependency injection in the adapter modules(local enterprise bean only) with @EJB annotation(on EJB 3.0).

     c) Remote clients: Remote clients need to perform JNDI look up to SAP PI(Not covered in this blog).

Note: 1) Special thanks to my friend and colleague N.Prasanna (SAP UI5 Consultant) for helping me 🙂

      

         2) Developer should take care of table maintenance and that table entries do not overflow.

         3) If the data that needs to be store is small and frequently used then it is better to store the data in value mapping in SAP PI instead of storing the data in database.

Any suggestions or feedback use the comment section below.

Assigned Tags

      13 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Eng Swee Yeoh
      Eng Swee Yeoh

      Nice blog series, Anand. Appreciate your effort in sharing this. Definitely good to know as the ABAP stack is being slowly "phased" out!

      Rgds

      Eng Swee

      Author's profile photo Michal Krawczyk
      Michal Krawczyk

      Hi,

      nice blog, the same can be achieved using CAF with a bit less coding I believe

      but both are useable 🙂

      Regards,

      Michal

      Author's profile photo Rajesh PS
      Rajesh PS

      Hello Experts,

      Your valuable thoughts/suggestions on this please. Many Thanks in advance!

       

      https://answers.sap.com/questions/12882619/how-to-store-and-retrieve-oauth-tokens-in-sap-po.html#

      Author's profile photo Former Member
      Former Member

      Hi, Michal. Thanks for detailed explanation.

      Could you clarify, if using of JPA entity in PI 7.4 database is fully covered by SAP licensing? Is it any restrictions for custom JPA development in PI database?

      Thanks.

      Regards, Sergey.

      Author's profile photo Michal Krawczyk
      Michal Krawczyk

      Hi Sergey,

      That you'd need to check with SAP sales but I hope it is... 🙂

      Best Regards,

      Michal Krawczyk

      Author's profile photo Former Member
      Former Member

      Hi Michal,

       

      Writing to you expecting a quicker reply,sorry.

      I followed all the steps as per this blog. But somehow stuck in Step#7 .

      The Web service is deployed successfully in the NWDS but the service definition is not reflecting in the NWA/SOA- Application and Scenario Communication - Single Service Administration.

      The web service deployment logs is successful in NWA as per basis team inputs.

      But no idea it is not reflecting in the NWA service definition.

      Can you please help?

       

      Regards

      Shaily Chaudhary

      Author's profile photo Madan Agrawal
      Madan Agrawal

      Hi,

      Nice blog. however please suggest how can we call this table (with its methods) from custom adapter module.

      Br,

      Madan

      Author's profile photo Anand V D
      Anand V D
      Blog Post Author

      Hi Madan,

      Use dependency injection in your adapter module

      http://www.oracle.com/technetwork/articles/java/cdi-javaee-bien-225152.html

      Thanks,

      Anand

      Author's profile photo Madan Agrawal
      Madan Agrawal

      Hi Anand,

      Thank you. Please suggest how to transport created java dictionary custom tables and its entries.

      Br,

      Madan

      Author's profile photo Anand V D
      Anand V D
      Blog Post Author

      Hi Madan,

      The java dictionary table can be exported to an ear file. The ear can be attached to cts+ transport and moved to other environments.

      But, I am really not sure how to transport table entries from one environment to other. If I find any way to do this then I will update it here.

      Thanks,

      Anand

      Author's profile photo Leo Klaz
      Leo Klaz

      This is a very helpful blog. Thank you very much.

      Just wondering if anyone had any success with calling the created service from a SOAP client?

      Author's profile photo Former Member
      Former Member

      Nice blog Anand

       

      Regards

      Vinay

      Author's profile photo Orland Louie Reyes
      Orland Louie Reyes

      Very nice blog! I am trying a similar thing but on a smaller scale. I wanted to use a database table to store sequence numbers since we don't have a standard way to do it (unless you have B2B add-on NRO).