Skip to Content

Following on from my previous post about Ruby, Ruby on Rails, and SAP Web Services Integration – I would like to show how to switch to using the SOAP RunTime (SRT) Handler, which makes available SAP Web Services via Virtual Interfaces.

Steps

  • Follow the steps outlined in Ruby, Ruby on Rails, and SAP Web Services Integration upgrading sapwas to at least version 0.06, and sap4rails to at least version 0.05, making sure that the soap/rfc handler works correctly.
  • Create the Virtual Interface, Web Service Definition, and Web Service Config to expose the UserAdmin Function Modules
  • Modify app/models/sap_user.rb to point to the new Web Service definition

Create the SAP Web Service

We need to create a web service that exposes the function modules that were used in the UserAdmin Rails application. To do this – go to transaction SE80, go to the Enterprise Services tab, and create a Virtual Interface of type Funciton Group called Z_USERADMIN. Include into this the function modules:

  • Z_BAPI_USER_GETLIST
  • BAPI_USER_GET_DETAIL
  • BAPI_USER_LOCK
  • BAPI_USER_UNLOCK

Activate this, and then create a Web Services definiton – again, using SE80, go to the Enterprise Services tab, and create a Web Services definition called Z_USERADMIN – referencing the previously activated Vitual Interface Z_USERADMIN.
Finally – activate this in the ICF configuration (SICF), by using transaction WSCONFIG, referencing the Web Service definition Z_USERADMIN created above.
There is an excellent discussion of the details of this process by Thomas Jung, Develop a Web Service that sends an Email – in ABAP, Netweaver 04S, and Develop a Web Service that sends an Email – in ABAP.

Modify model sap_user.rb

Now for the final part – in the UserAdmin Rails application, edit the SapUser model file app/models/sap_user.rb. This needs to switch from referencing the method “function_module” for loading the functions, to using “resources”, as outlined below:

require_gem "sap4rails" class SapUser < SAP4Rails::WS::Base # You must define a list of RESOURCES to preload resources "http://seahorse.local.net:8000/sap/bc/srt/rfc/sap/Z_USERADMIN" ...

Now you can test it as in the previous weblogs.

Unicode!

One thing that I neglected to say in my previous post, is a major advantage of using sapwas for accessing SAP is that it has comprehensive Unicode support – free of charge (but not of pain) 🙂 .

Round Up

For me – this rounds up SAP Web Services and Ruby – you can either access them in Ruby directly by using the library sapwas, or taking advantage of the Rails integration provided by sap4rails.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply